|
|
@@ -214,6 +214,11 @@ return aaa";
|
|
|
{
|
|
|
CopyFleByLuaCfg("Assets\\Editor\\CsvToLua\\luaCopyFileCfg.lua", "", "D:/项目/图/仙境/cn/","_cn");
|
|
|
}
|
|
|
+
|
|
|
+ if (GUILayout.Button("添加图片配置"))
|
|
|
+ {
|
|
|
+ AddLocalizTextureCfgByFileCfg("Assets\\Editor\\CsvToLua\\luaCopyFileCfg.lua");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public static string GetFilePath()
|
|
|
@@ -984,4 +989,65 @@ return aaa";
|
|
|
writer.Write(reader.ReadToEnd()); // 读取并写入文本文件
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public static void AddLocalizTextureCfgByFileCfg(string luacfgpath)
|
|
|
+ {
|
|
|
+ string luaPath = "Assets/Lua/Config/";
|
|
|
+ string csvPath = "Assets/Content/Config/";
|
|
|
+ string OutPutPath = "Build/NewCfg/";
|
|
|
+
|
|
|
+ Dictionary<string, LocalizedTextureCfg> language = GetLanguageTextureCfg("Assets/Content/Config/LocalizeTextureCfg_base.csv");
|
|
|
+
|
|
|
+ using (LuaState runTime = new LuaState())
|
|
|
+ {
|
|
|
+ runTime.Start();
|
|
|
+ LuaTable luaTable = runTime.DoFile<LuaTable>(luacfgpath);
|
|
|
+
|
|
|
+ LuaFunction init_fun = luaTable.GetLuaFunction("Init");
|
|
|
+ LuaFunction SetOutput_fun = luaTable.GetLuaFunction("SetOutput");
|
|
|
+ LuaFunction GetNextCfg_fun = luaTable.GetLuaFunction("GetNextAddlocaizedCfg");
|
|
|
+ LuaFunction GetLen_fun = luaTable.GetLuaFunction("GetLen");
|
|
|
+
|
|
|
+ init_fun.Call<LuaTable>(luaTable);
|
|
|
+ //SetOutput_fun.Call<LuaTable, string>(luaTable, output);
|
|
|
+ int len = GetLen_fun.Invoke<LuaTable, int>(luaTable);
|
|
|
+ int curindex = 1;
|
|
|
+ EditorUtility.DisplayProgressBar("复制中", $"开始复制", 0);
|
|
|
+ string metastr = ".meta";
|
|
|
+ while (true)
|
|
|
+ {
|
|
|
+ EditorUtility.DisplayProgressBar("复制中", $"复制{curindex}/{len}", curindex / len);
|
|
|
+ curindex++;
|
|
|
+ LuaTable cfg = GetNextCfg_fun.Invoke<LuaTable, LuaTable>(luaTable);
|
|
|
+ //{result = false,path = path,outputPath = outputPath}
|
|
|
+ int result = cfg.RawGet<string, int>("result");
|
|
|
+ if (result ==1)
|
|
|
+ {
|
|
|
+ string key = cfg.RawGet<string, string>("key");
|
|
|
+ string Languages = cfg.RawGet<string, string>("Language");
|
|
|
+ string AssetPath = cfg.RawGet<string, string>("AssetPath");
|
|
|
+ string other = cfg.RawGet<string, string>("other");
|
|
|
+ string setN = cfg.RawGet<string, string>("setN");
|
|
|
+
|
|
|
+ if (!language.ContainsKey(key))
|
|
|
+ {
|
|
|
+ language.Add(key,new LocalizedTextureCfg() {key = key,Language = Languages, AssetPath = AssetPath ,OtherSetting = other,SetNativeSize = setN});
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Debug.Log("key重复:"+key);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (result == 0)
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ EditorUtility.ClearProgressBar();
|
|
|
+ }
|
|
|
+ Debug.Log("完成检查");
|
|
|
+ CsvWriter<LocalizedTextureCfg> csvWriter = new CsvWriter<LocalizedTextureCfg>(OutPutPath + "LocalizedTextureCfg.csv", "LocalizedTextureCfg.csv", language.Values.ToList(), LocalizedTextureCfg.GetFormatInfo());
|
|
|
+ csvWriter.Write();
|
|
|
+ }
|
|
|
}
|