static void HandleResourceBundle(BuildTarget target) { string assetPath = AppDataPath + "/StreamingAssets/"; if (Directory.Exists(assetPath)) { Directory.Delete(assetPath, true); } Directory.CreateDirectory(assetPath); AssetBundlesAll.CreateAssetBunldesALL(target); }
public void OnGUI() { //GUIStyle style = new GUIStyle(); //style.fontSize = 12; //style.normal.textColor = new Color(1, 1, 1, 1); GUI.Label(mPathRect, "热更新路径:" + UnityEngine.Application.dataPath.Replace("Assets", "") + "hotupdate"); if (GUI.Button(new Rect(700f, 13f, 100f, 24f), "打开目录")) { System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("Explorer.exe"); psi.Arguments = (UnityEngine.Application.dataPath.Replace("Assets", "") + "hotupdate").Replace("/", "\\"); System.Diagnostics.Process.Start(psi); } GUI.Label(mLastFilesRect, "上个版本files目录:"); mLastFilesPathText = EditorGUI.TextField(mLastFilesPathInputRect, mLastFilesPathText); GUI.Label(mHotupdatePathRect, "热更新目录:"); mHotupdatePathText = EditorGUI.TextField(mHotupdatePathInputRect, mHotupdatePathText); GUI.Label(mPrefabPathRect, "prefab版本(要包括当前版本必须输入前一个版本):"); mPrefabPathText1 = EditorGUI.TextField(mPrefabPathInputRect1, mPrefabPathText1); mPrefabPathText2 = EditorGUI.TextField(mPrefabPathInputRect2, mPrefabPathText2); GUI.Label(mAtlasPathRect, "atlas版本(要包括当前版本必须输入前一个版本):"); mAtlasPathText1 = EditorGUI.TextField(mAtlasPathInputRect1, mAtlasPathText1); mAtlasPathText2 = EditorGUI.TextField(mAtlasPathInputRect2, mAtlasPathText2); if (GUI.Button(mLastFilesPathSetPathBtnRect, "设置目录")) { string tee = EditorUtility.OpenFolderPanel("选择上个版本files目录", "", ""); if (!tee.Equals("")) { mLastFilesPathText = tee; } } if (GUI.Button(mLastFilesPathOpenPathBtnRect, "打开目录")) { System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("Explorer.exe"); psi.Arguments = mLastFilesPathText.Replace("/", "\\"); System.Diagnostics.Process.Start(psi); } if (GUI.Button(mHotupdatePathSetPathBtnRect, "设置目录")) { string tee = EditorUtility.OpenFolderPanel("选择热更新目录", "", ""); if (!tee.Equals("")) { mHotupdatePathText = tee; } } if (GUI.Button(mHotupdatePathOpenPathBtnRect, "打开目录")) { System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("Explorer.exe"); psi.Arguments = mHotupdatePathText.Replace("/", "\\"); System.Diagnostics.Process.Start(psi); } if (Application.platform == RuntimePlatform.WindowsEditor && GUI.Button(mSvnDifferBtnRect, "导出SVN差异文件")) { if (mPrefabPathText1 == "" || mPrefabPathText2 == "" || mAtlasPathText1 == "" || mAtlasPathText2 == "") { UnityEngine.Debug.LogError("SVN版本不能为空!"); return; } string targetDir = string.Format((UnityEngine.Application.dataPath + "/Editor").Replace("/", "\\"));//this is where mybatch.bat lies Process proc = new Process(); proc.StartInfo.WorkingDirectory = targetDir; proc.StartInfo.FileName = "ResHotupdate.bat"; string str = mPrefabPathText1 + " " + mPrefabPathText2 + " " + mAtlasPathText1 + " " + mAtlasPathText2 + " " + UnityEngine.Application.dataPath.Replace("/", "\\"); proc.StartInfo.Arguments = string.Format(str);//this is argument proc.StartInfo.CreateNoWindow = false; proc.Start(); proc.WaitForExit(); } if (GUI.Button(mHotupteLuaBtnRect, "热更新代码")) { AssetLuaCode.HotUpdate(); AssetDatabase.Refresh(); if (Application.platform == RuntimePlatform.WindowsEditor) { CreateFiles(); } else if (Application.platform == RuntimePlatform.OSXEditor) { UnityEngine.Debug.Log("去windows生成files!"); } } if (GUI.Button(mHotupdateResBtnRect, "热更新资源")) { AssetBundlesAll.HotUpdateResources(mHotupdateResNameText); if (Application.platform == RuntimePlatform.WindowsEditor) { CreateFiles(); } else if (Application.platform == RuntimePlatform.OSXEditor) { UnityEngine.Debug.Log("去windows生成files!"); } } if (GUI.Button(mHotupdateAllBtnRect, "热更新代码和资源")) { AssetBundlesAll.HotUpdateAll(mHotupdateResNameText); if (Application.platform == RuntimePlatform.WindowsEditor) { CreateFiles(); } else if (Application.platform == RuntimePlatform.OSXEditor) { UnityEngine.Debug.Log("去windows生成files!"); } } GUI.Label(new Rect(40, 275, 700f, 24f), "资源zip名字(resupdate1): " + " (资源太多可以填resupdate2/3/4/5/6/7.zip等等)"); mHotupdateResNameText = EditorGUI.TextField(mHotupdateResNameRect, mHotupdateResNameText); if (GUI.Button(new Rect(700f, 350f, 100f, 24f), "生成files")) { CreateFiles(); } }