少年修仙传客户端基础资源
client_Wu Xijin
2019-02-19 81d3ad0da313741dc0f4e4c9619d4a02c146b716
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Text;
 
public class AssetsPostProcessor : AssetPostprocessor
{
 
    static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        foreach (string str in importedAssets)
        {
            OnAssetImported(str);
        }
        foreach (string str in deletedAssets)
        {
        }
 
        for (int i = 0; i < movedAssets.Length; i++)
        {
        }
    }
 
    static void OnAssetImported(string assetPath)
    {
        switch (assetPath)
        {
            case "Assets/ResourcesOut/Refdata/Config/Item.txt":
                CreateGemItemConfig();
                break;
        }
    }
 
    static void CreateGemItemConfig()
    {
        var gemItemConfigPath = Application.dataPath + "/ResourcesOut/Refdata/Config/GemItem.txt";
        var lines = new List<string>();
        lines.Add("int\tint");
        lines.Add("ID\tType");
        lines.Add("唯一标识\t类型");
        ItemConfig.Init(true);
        var keys = ItemConfig.GetKeys();
        foreach (var key in keys)
        {
            var config = ItemConfig.Get(key);
            if ((config.Type == 25 || config.Type == 140) && config.Effect1 == 225)
            {
                lines.Add(StringUtility.Contact(config.ID, '\t', config.Type));
            }
        }
 
        if (File.Exists(gemItemConfigPath))
        {
            File.Delete(gemItemConfigPath);
        }
        File.WriteAllLines(gemItemConfigPath, lines.ToArray(), Encoding.UTF8);
    }
 
}