diff --git a/Assets/Scripts/Editor/GameEditor/FrameTool/ImportResWindow.cs b/Assets/Scripts/Editor/GameEditor/FrameTool/ImportResWindow.cs index 513a96afe6..03721caa50 100644 --- a/Assets/Scripts/Editor/GameEditor/FrameTool/ImportResWindow.cs +++ b/Assets/Scripts/Editor/GameEditor/FrameTool/ImportResWindow.cs @@ -21,9 +21,10 @@ namespace GameEditor.Util string[] usedPath; bool[] usedPathSelect; string[] filePath; + List upLoadPathList; [MenuItem("资源导入/资源导入")] static void InitWindow() - { + { // Get existing open window or if none, make a new one: ImportResWindow window = (ImportResWindow)EditorWindow.GetWindow(typeof(ImportResWindow)); window.InitData(); @@ -47,73 +48,100 @@ namespace GameEditor.Util { EditorGUILayout.BeginVertical(); - EditorGUILayout.BeginHorizontal(); - GUILayout.Label("导入图片"); - importTexturePath = GUILayout.TextArea(importTexturePath); - if (GUILayout.Button("Select", GUILayout.ExpandWidth(false))) + EditorGUILayout.BeginHorizontal(); + GUILayout.Label("导入图片"); + importTexturePath = GUILayout.TextArea(importTexturePath); + if (GUILayout.Button("Select", GUILayout.ExpandWidth(false))) + { + filePath = ProcessUtil.OpenFileWin(importTexturePath, "*.*"); + if (filePath != null && filePath.Length > 0) { - filePath = ProcessUtil.OpenFileWin(importTexturePath,"*.*"); - if (filePath != null && filePath.Length > 0) + importTexturePath = filePath[0]; + PlayerPrefs.SetString("ImportResWindow_importTexturePath", importTexturePath); + } + } + EditorGUILayout.EndHorizontal(); + + for (int i = 0; i < usedPath.Length; i++) + { + usedPathSelect[i] = EditorGUILayout.Toggle(usedPath[i], usedPathSelect[i]); + } + + EditorGUILayout.BeginHorizontal(); + GUILayout.Label("导入音频"); + importAudioPath = GUILayout.TextArea(importAudioPath); + if (GUILayout.Button("Select", GUILayout.ExpandWidth(false))) + { + filePath = ProcessUtil.OpenFileWin(importTexturePath, "*.*"); + if (filePath != null && filePath.Length > 0) + { + importTexturePath = filePath[0]; + PlayerPrefs.SetString("ImportResWindow_importTexturePath", importTexturePath); + } + } + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.BeginHorizontal(); + GUILayout.Label("导入路径"); + GUILayout.Label(tag1); + targetPath = GUILayout.TextArea(targetPath); + if (GUILayout.Button("Brown", GUILayout.ExpandWidth(false))) + { + string path = Path.Combine(tag, tag1) + "/" + targetPath; + path = EditorUtility.OpenFolderPanel("Resource path", path, "*.*"); + targetPath = path.Replace((Path.Combine(tag, tag1) + "/").Replace("\\", "/"), ""); + PlayerPrefs.SetString("ImportResWindow_targetPath", targetPath); + } + if (GUILayout.Button("导入", GUILayout.ExpandWidth(false))) + { + upLoadPathList = new List(); + string path = ""; + for (int i = 0; i < usedPathSelect.Length; i++) + { + if (usedPathSelect[i]) { - importTexturePath = filePath[0]; - PlayerPrefs.SetString("ImportResWindow_importTexturePath", importTexturePath); + path = usedPath[i]; } } - EditorGUILayout.EndHorizontal(); - - for (int i = 0; i < usedPath.Length; i++) + if (string.IsNullOrEmpty(path) && !string.IsNullOrEmpty(targetPath)) { - usedPathSelect[i] = EditorGUILayout.Toggle(usedPath[i], usedPathSelect[i]); + path = targetPath; } + ImportTexture(path); + } + EditorGUILayout.EndHorizontal(); - EditorGUILayout.BeginHorizontal(); - GUILayout.Label("导入音频"); - importAudioPath = GUILayout.TextArea(importAudioPath); - if (GUILayout.Button("Select", GUILayout.ExpandWidth(false))) + + if (GUILayout.Button("上传", GUILayout.ExpandWidth(false))) + { + string v = ""; + for (int i = 0; i < upLoadPathList.Count(); i++) { - filePath = ProcessUtil.OpenFileWin(importTexturePath, "*.*"); - if (filePath != null && filePath.Length > 0) + if (string.IsNullOrEmpty(v)) { - importTexturePath = filePath[0]; - PlayerPrefs.SetString("ImportResWindow_importTexturePath", importTexturePath); + v = upLoadPathList[i]; + } + else + { + v = v + "," + upLoadPathList[i]; } } - EditorGUILayout.EndHorizontal(); + string s = string.Format("/K 一键提交到git.bat {0}", v); + System.Diagnostics.Process.Start("cmd.exe", s); + } - - - - EditorGUILayout.BeginHorizontal(); - GUILayout.Label("导入路径"); - GUILayout.Label(tag1); - targetPath = GUILayout.TextArea(targetPath); - if (GUILayout.Button("Brown", GUILayout.ExpandWidth(false))) - { - string path = Path.Combine(tag,tag1) +"/"+ targetPath; - path = EditorUtility.OpenFolderPanel("Resource path", path, "*.*"); - targetPath = path.Replace((Path.Combine(tag, tag1) + "/").Replace("\\","/"), ""); - PlayerPrefs.SetString("ImportResWindow_targetPath", targetPath); - } - if (GUILayout.Button("导入", GUILayout.ExpandWidth(false))) - { - string path = ""; - for (int i = 0; i < usedPathSelect.Length; i++) - { - if (usedPathSelect[i]) - { - path = usedPath[i]; - } - } - if (string.IsNullOrEmpty(path) && !string.IsNullOrEmpty(targetPath)) - { - path = targetPath; - } - ImportTexture(path); - } - EditorGUILayout.EndHorizontal(); - EditorGUILayout.EndVertical(); } + + void SetUpLoadPathList(string subPath) + { + if (upLoadPathList.Contains(subPath)) + { + return; + } + upLoadPathList.Add(subPath); + } + void ImportTexture(string path) { if (filePath == null || filePath.Length < 2) @@ -125,6 +153,7 @@ namespace GameEditor.Util if (!Directory.Exists(fullPath)) { Directory.CreateDirectory(fullPath); + SetUpLoadPathList(tag1 + "/" + path); AssetDatabase.Refresh(); } string desPath = Environment.CurrentDirectory + "/Assets/ImportFloder"; @@ -153,9 +182,9 @@ namespace GameEditor.Util if (sourceFileName.EndsWith("_zh")) { sourceFileName = sourceFileName.Substring(0, sourceFileName.Length - 3); - } - string[] guids = AssetDatabase.FindAssets(sourceFileName + " t:Texture",new string[] { tag1 }); - + } + string[] guids = AssetDatabase.FindAssets(sourceFileName + " t:Texture", new string[] { tag1 }); + bool isReplace = false; if (guids != null && guids.Length > 0) { @@ -176,19 +205,23 @@ namespace GameEditor.Util if (sourceExt == desExt) { AssetDatabase.CopyAsset("Assets/ImportFloder/" + fileName, desFilePath); + SetUpLoadPathList(desFilePath); } else { AssetDatabase.MoveAssetToTrash(desFilePath); + SetUpLoadPathList(desFilePath); AssetDatabase.MoveAsset("Assets/ImportFloder/" + fileName, rootPath + "/" + fileName); + SetUpLoadPathList(rootPath + "/" + sourceFileName); } } } } - + if (!isReplace) { AssetDatabase.MoveAsset("Assets/ImportFloder/" + fileName, Path.Combine(tag1, path) + "/" + fileName); + SetUpLoadPathList(Path.Combine(tag1, path) + "/" + sourceFileName); } } AssetDatabase.StopAssetEditing(); @@ -196,7 +229,7 @@ namespace GameEditor.Util AssetDatabase.Refresh(); if (Directory.Exists(desPath)) { - Directory.Delete(desPath,true); + Directory.Delete(desPath, true); AssetDatabase.Refresh(); } Debug.Log("导入完成"); diff --git a/一键提交到git.bat b/一键提交到git.bat new file mode 100644 index 0000000000..64ee5102d2 --- /dev/null +++ b/一键提交到git.bat @@ -0,0 +1,22 @@ +@echo off +set words=%* +:: 获取当前脚本的路径 +cd /d %~dp0 +:: 自动提交 +git init +for %%i in (%words%) do ( + git add %%i* +) + + git commit -m "bat批处理自动推送:%date:~0,10%,%time:~0,8%" +:: git commit -m "%commitMessage%" +git push origin master +@echo 已经完成, + +SET daoTime=60 +:dao +set /a daoTime=daoTime-1 +ping -n 2 -w 500 127.1>nul +cls +echo 上传Git完成 ,倒计时退出: %daoTime%秒 +if %daoTime%==0 (exit) else (goto dao) \ No newline at end of file