Explorar el Código

语言提取优化

ybx_Gdn hace 1 año
padre
commit
fb592c5e17
Se han modificado 1 ficheros con 10 adiciones y 6 borrados
  1. 10 6
      Assets/Editor/CsvToLua/CsvToLua.cs

+ 10 - 6
Assets/Editor/CsvToLua/CsvToLua.cs

@@ -574,7 +574,7 @@ return aaa";
     private static void CheckLauCfg_CS(List<CfgLanguageCfg> cfg, string path, Dictionary<string, LanguageCfg> language, string outputPath)
     {
         string[] rowDatas = File.ReadAllLines(path);
-       
+        bool iswrite = true;
         using (LuaState runTime = new LuaState())
         {
             runTime.Start();
@@ -584,7 +584,10 @@ return aaa";
                 for (int i = 0; i < cfg.Count; i++)
                 {
                     if (cfg[i].Enable == 0)
+                    {
+                        iswrite = false;
                         continue;
+                    }
                     string value = luatable.RawGet<string, string>(cfg[i].Field);
                     if (string.IsNullOrEmpty(value))
                     {
@@ -607,11 +610,12 @@ return aaa";
                         SetLuaLine(rowDatas, id, cfg[i].Field, key);
                         if (value.Contains("\n"))
                         {
-                            Debug.Log(value);
+                            //Debug.Log(value);
                             value = value.Replace("\n", "\\n");
-                            Debug.Log(value);
+                            //Debug.Log(value);
                         }
-                        language.Add(key, new LanguageCfg() { key = key, Language = value });
+                        if(!language.ContainsKey(key))
+                            language.Add(key, new LanguageCfg() { key = key, Language = value });
                     }
 
                 }
@@ -619,8 +623,8 @@ return aaa";
             });
 
         }
-
-        File.WriteAllLines(outputPath,rowDatas);
+        if (iswrite)
+            File.WriteAllLines(outputPath,rowDatas);
 
     }