Esempio n. 1
0
        static void DoExcelToLua(bool isForce)
        {
            setting = BattleEditorUtility.LoadSetting(SettingPath);
            string        md5Path       = Application.dataPath + setting.excelFolder + "md5.txt";
            List <string> excelFileList = BattleEditorUtility.GetExcelFileList(setting.excelFolder);

            md5Dict = BattleEditorUtility.GetDictionaryFromFile(md5Path);
            if (md5Dict == null)
            {
                md5Dict = new Dictionary <string, string>();
            }
            Debug.Log("<color=#3A9BF8FF>Begin Export</color><color=#FFFFFFFF>:</color>");
            for (int i = 0; i < excelFileList.Count; i++)
            {
                var excelFilePath = excelFileList[i];
                var excelFileName = Path.GetFileName(excelFilePath);
                var md5           = BattleEditorUtility.GetFileMD5(excelFilePath.Replace("/../", ""));
                md5Dict.TryGetValue(excelFileName, out string oldMd5);
                bool modify = true;
                if (string.IsNullOrEmpty(oldMd5))
                {
                    md5Dict.Add(excelFileName, md5);
                }
                else if (oldMd5 != md5)
                {
                    md5Dict[excelFileName] = md5;
                }
                else
                {
                    modify = false;
                }
                if (isForce || modify)
                {
                    Debug.Log($"<color=#3A9BF8FF>Export Lua Table - </color><color=#FFFFFFFF>{excelFileName}</color>");
                    ExcelEditor excelEditor = new ExcelEditor(excelFilePath);
                    excelEditor.Reload();
                    var outputPath = $"{setting.outputPath}/{Path.GetFileNameWithoutExtension(excelFilePath)}.lua";
                    GenerateLua(excelEditor.excelReader, outputPath);
                    BattleEditorUtility.DisplayProgress(i, excelFileList.Count, excelFilePath);
                }
            }
            Debug.Log("<color=#3A9BF8FF>End Export</color><color=#FFFFFFFF>:</color>");
            BattleEditorUtility.SaveDictionary(md5Path, md5Dict);
            EditorUtility.ClearProgressBar();
        }
Esempio n. 2
0
 public override void Reload()
 {
     excelEditor?.Reload();
 }