少年修仙传客户端基础资源
client_Wu Xijin
2019-02-14 22f1c6cdf3ff6debe7b69d3db3199d8fd5488be9
3335 配置表读取重构。
2个文件已修改
29 ■■■■■ 已修改文件
Assets/Editor/ScriptTemplate/ConfigDataTemplate.txt 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/Tool/ConfigClassGenerate.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/ScriptTemplate/ConfigDataTemplate.txt
@@ -120,8 +120,14 @@
            }
            for (int i = 3; i < lines.Length; i++)
            {
                try
                {
                var line = lines[i];
                var index = line.IndexOf("\t");
                    if (index == -1)
                    {
                        continue;
                    }
                var id = line.Substring(0, index);
                if (preParse)
@@ -133,6 +139,11 @@
                else
                {
                    rawDatas[id] = line;
                    }
                }
                catch (System.Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
            inited = true;
@@ -148,8 +159,14 @@
                }
                for (int i = 3; i < lines.Length; i++)
                {
                    try
                    {
                    var line = lines[i];
                    var index = line.IndexOf("\t");
                        if (index == -1)
                        {
                            continue;
                        }
                    var id = line.Substring(0, index);
                    if (preParse)
@@ -163,6 +180,11 @@
                        rawDatas[id] = line;
                    }
                }
                    catch (System.Exception ex)
                    {
                        Debug.LogError(ex);
                    }
                }
                inited = true;
            });
Assets/Editor/Tool/ConfigClassGenerate.cs
@@ -255,7 +255,6 @@
        var newConfigPath = configClassPath + string.Format("/{0}Config.cs", _name);
        AssetDatabase.DeleteAsset(newConfigPath);
        UnityEngine.Object o = CreateScriptAssetFromTemplate(newConfigPath, templatePath);
        AddConfigInit(newConfigPath);
        ProjectWindowUtil.ShowCreatedAsset(o);
    }
@@ -287,7 +286,7 @@
    internal static void AddConfigInit(string pathName)
    {
        string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(pathName);
        string add1 = string.Format("{0}.Init();{1}", fileNameWithoutExtension, "\r\n\t\ttaskCount++;");
        string add1 = string.Format("{0}.Init();taskCount++;", fileNameWithoutExtension);
        string add2 = string.Format("completeCount += {0}.inited ? 1 : 0;", fileNameWithoutExtension);
        string path = Application.dataPath + "/Scripts/Utility/ConfigInitiator.cs";
@@ -297,6 +296,10 @@
        {
            text = text.Replace("//初始化结束\r\n", add1 + "\r\n" + "\t\t//初始化结束\r\n");
        }
        else
        {
            Debug.Log(fileNameWithoutExtension);
        }
        if (!text.Contains(add2))
        {