gdl_123 4 hónapja
szülő
commit
0b317b00b5

+ 32 - 5
Assets/Editor/CsvToLua/CsvToLua.cs

@@ -173,7 +173,7 @@ return aaa";
 
         if (GUILayout.Button("复制luacfg文件"))
         {
-            CopyFleByLuaCfg("Assets\\Editor\\CsvToLua\\LuaCfg.lua","", "D:/项目/图/仙境/cn/","_cn");
+            CopyFleByLuaCfg("Assets\\Editor\\CsvToLua\\luaCopyFileCfg.lua", "", "D:/项目/图/仙境/cn/","_cn");
         }
     }
 
@@ -737,22 +737,49 @@ return aaa";
             LuaFunction SetOutput_fun = luaTable.GetLuaFunction("SetOutput");
             LuaFunction GetNextCfg_fun = luaTable.GetLuaFunction("GetNextCfg");
             LuaFunction GetLen_fun = luaTable.GetLuaFunction("GetLen");
-            int len = GetLen_fun.Invoke<int>();
-            int curindex = 1;
+           
             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);
-                LuaTable cfg = GetNextCfg_fun.Invoke<LuaTable>();
+                LuaTable cfg = GetNextCfg_fun.Invoke<LuaTable, LuaTable>(luaTable);
                 //{result = false,path = path,outputPath = outputPath}
                 bool result = cfg.RawGet<string, bool>("result");
                 if (result)
                 {
                     string path = cfg.RawGet<string, string>("path");
                     string _outputPath = cfg.RawGet<string, string>("outputPath");
-                    File.Copy(fileRootPath+path,outputPath+_outputPath,true);
+                    string filePath = fileRootPath + path;
+                    string fileOutputPath = outputPath + _outputPath;
+
+                    if (path.Contains(".psd"))
+                    {
+                        Debug.Log($"不复制psd文件:[{path}]");
+                        continue;
+                    }
+
+                  
+
+                    FileHelper.CreateDir(FileHelper.PathRemoveBack(fileOutputPath));
+                    if (File.Exists(filePath))
+                    {
+                        File.Copy(filePath, fileOutputPath, true);
+                       
+                        if (!path.Contains(metastr))
+                        {
+                            File.Copy(filePath+ metastr, fileOutputPath+ metastr, true);
+                        }
+                    }
+                       
+                    else
+                    {
+                        Debug.Log($"不存在文件:[{filePath}]");
+                    }
                 }
                 else
                 {

+ 2 - 2
Assets/Editor/CsvToLua/luaCopyFileCfg.lua

@@ -1278,7 +1278,7 @@ function luaCopyFileCfg:SetOutput(output)
     self.curOutput = output
 end
 
-function GetLen()
+function luaCopyFileCfg:GetLen()
     return self.MaxIndex 
 end
 
@@ -1288,7 +1288,7 @@ function luaCopyFileCfg:GetNextCfg()
     end
     local curCfg = self.FileCfg[self.curindex]
     self.curindex = self.curindex + 1
-    local path = curCfg.basepath..curCfg.path..curCfg.fileName
+    local path = curCfg.basepath..curCfg.path..'/'..curCfg.fileName
     local outputPath = curCfg.basepath..curCfg.path..self.curOutput..'/'..curCfg.fileName
     return {result = true,path = path,outputPath = outputPath}
 end