少年修仙传客户端基础资源
client_Wu Xijin
2019-02-19 81d3ad0da313741dc0f4e4c9619d4a02c146b716
3335 配置表解析优化工具。
2个文件已添加
73 ■■■■■ 已修改文件
Assets/Editor/Tool/AssetsPostProcessor.cs 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/Tool/AssetsPostProcessor.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/Tool/AssetsPostProcessor.cs
New file
@@ -0,0 +1,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);
    }
}
Assets/Editor/Tool/AssetsPostProcessor.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6da875a38ed2e5e4fb0aa5fd27c2d427
timeCreated: 1550548733
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant: