/** 开发 */ void OnGUI_Develop() { HGUILayout.BeginCenterHorizontal(); if (GUILayout.Button("生成版本信息", GUILayout.MinHeight(50), GUILayout.MaxWidth(200))) { if (currentDvancedSettingData.GetValue(DvancedSettingType.GameConstConfig)) { GameConstConfig config = GameConstConfig.Load(); config.DevelopMode = true; config.TestVersionMode = false; config.Save(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.Clear_AssetBundleName)) { AssetBundleEditor.ClearAssetBundleNames(); AssetDatabase.RemoveUnusedAssetBundleNames(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.Set_AssetBundleName)) { AssetBundleEditor.SetNames(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.GeneratorStreamingAssetsFilesCSV)) { FilesCsvForStreamingAssets.Generator(true); } if (currentDvancedSettingData.GetValue(DvancedSettingType.GeneratorResourcesFilesCSV)) { FilesCsvForResources.Generator(); } } HGUILayout.EndCenterHorizontal(); }
/** 补丁 */ void OnGUI_Patch() { Version version = patchVersion; if (version.revised <= 0) { version.revised = 1; } GUILayout.BeginHorizontal(HGUILayout.boxMPStyle, GUILayout.Height(50)); EditorGUILayout.LabelField("参照App版本", HGUILayout.labelCenterStyle, GUILayout.Width(150), GUILayout.Height(25)); int preCompareIndex = compareIndex; compareIndex = EditorGUILayout.Popup(compareIndex, VersionList.appVersionStrArr); if (preCompareIndex != compareIndex && compareIndex != -1) { Version v = VersionList.appVersionList[compareIndex]; compareVersion.Copy(v); version.Copy(VersionList.GetLastAppRevised(compareVersion)); version.verType = VersionType.Patch; version.revised++; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); HGUILayout.Version("补丁版本", version, VersionType.Patch); GUILayout.BeginVertical(); if (GUILayout.Button("最后一次", GUILayout.Width(100), GUILayout.Height(30))) { VersionList.Read(true); compareVersion.Copy(VersionList.lastAppVersion); version.Copy(VersionList.GetLastAppRevised(compareVersion)); version.verType = VersionType.Patch; compareIndex = VersionList.appVersionStrList.IndexOf(compareVersion.ToString()); } if (GUILayout.Button("自动", GUILayout.Width(100), GUILayout.Height(30))) { VersionList.Read(true); compareVersion.Copy(VersionList.lastAppVersion); version.Copy(VersionList.GetLastAppRevised(compareVersion)); version.verType = VersionType.Patch; version.revised++; compareIndex = VersionList.appVersionStrList.IndexOf(compareVersion.ToString()); } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.Space(20); HGUILayout.BeginCenterHorizontal(); if (GUILayout.Button("生成版本信息", GUILayout.MinHeight(50), GUILayout.MaxWidth(200))) { version.SetNowDatetime(); bool isRefresh = false; if (currentDvancedSettingData.GetValue(DvancedSettingType.ClearAllPlatformDirctory)) { PathUtil.ClearAllPlatformDirctory(); isRefresh = true; } if (currentDvancedSettingData.GetValue(DvancedSettingType.ClearOtherPlatformDirctory)) { PathUtil.ClearOtherPlatformDirctory(runtimePlatform); isRefresh = true; } if (currentDvancedSettingData.GetValue(DvancedSettingType.ClearTestData)) { PathUtil.ClearTestData(); isRefresh = true; } if (isRefresh) { AssetDatabase.Refresh(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.AB_luacode)) { AB.Lua(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.AB_config)) { AB.Config(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.AB_luacode)) { AB.Lua(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.AB_config)) { AB.Config(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.Clear_AssetBundleName)) { AssetBundleEditor.ClearAssetBundleNames(); AssetDatabase.RemoveUnusedAssetBundleNames(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.Set_AssetBundleName)) { AssetBundleEditor.SetNames(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.AB_AssetBundle)) { AssetBundleEditor.BuildAssetBundles(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.GameConstConfig)) { GameConstConfig config = GameConstConfig.Load(); config.DevelopMode = false; config.Version = version.ToConfig(); config.Save(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.GeneratorStreamingAssetsFilesCSV)) { FilesCsvForStreamingAssets.Generator(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.GeneratorResourcesFilesCSV)) { FilesCsvForResources.Generator(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.PlayerSettings)) { SetPlayerSettings(runtimePlatform); } if (currentDvancedSettingData.GetValue(DvancedSettingType.PlayerSettingsVersion)) { SetPlayerSettingsVersion(appVersion); } if (currentDvancedSettingData.GetValue(DvancedSettingType.GenerateVersionInfo)) { FilesCsvForStreamingAssets.CopyStreamFilesCsvToVersion(version); } if (currentDvancedSettingData.GetValue(DvancedSettingType.GeneratorUpdateAssetList)) { FilesCsvForStreamingAssets.GeneratorUpdateList(compareVersion); } } HGUILayout.EndCenterHorizontal(); }
/** App */ void OnGUI_App() { Version version = appVersion; GUILayout.BeginHorizontal(); HGUILayout.Version("App版本", version, VersionType.App); GUILayout.BeginVertical(); if (GUILayout.Button("最后一次", GUILayout.Width(100), GUILayout.Height(30))) { VersionList.Read(true); version.Copy(VersionList.lastAppVersion); version.revised = 0; version.verType = VersionType.App; } if (GUILayout.Button("自动", GUILayout.Width(100), GUILayout.Height(30))) { VersionList.Read(true); version.Copy(VersionList.lastAppVersion); version.minor++; version.revised = 0; version.verType = VersionType.App; } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.Space(20); HGUILayout.BeginCenterHorizontal(); if (GUILayout.Button("生成版本信息", GUILayout.MinHeight(50), GUILayout.MaxWidth(200))) { version.SetNowDatetime(); bool isRefresh = false; if (currentDvancedSettingData.GetValue(DvancedSettingType.ClearAllPlatformDirctory)) { PathUtil.ClearAllPlatformDirctory(); isRefresh = true; } if (currentDvancedSettingData.GetValue(DvancedSettingType.ClearOtherPlatformDirctory)) { PathUtil.ClearOtherPlatformDirctory(runtimePlatform); isRefresh = true; } if (currentDvancedSettingData.GetValue(DvancedSettingType.ClearTestData)) { PathUtil.ClearTestData(); isRefresh = true; } if (isRefresh) { AssetDatabase.Refresh(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.AB_luacode)) { AB.Lua(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.AB_config)) { AB.Config(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.Clear_AssetBundleName)) { AssetBundleEditor.ClearAssetBundleNames(); AssetDatabase.RemoveUnusedAssetBundleNames(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.Set_AssetBundleName)) { AssetBundleEditor.SetNames(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.AB_AssetBundle)) { AssetBundleEditor.BuildAssetBundles(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.GameConstConfig)) { GameConstConfig config = GameConstConfig.Load(); config.DevelopMode = false; config.Version = version.ToConfig(); config.Save(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.GeneratorStreamingAssetsFilesCSV)) { FilesCsvForStreamingAssets.Generator(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.GeneratorResourcesFilesCSV)) { FilesCsvForResources.Generator(); } if (currentDvancedSettingData.GetValue(DvancedSettingType.PlayerSettings)) { SetPlayerSettings(runtimePlatform); } if (currentDvancedSettingData.GetValue(DvancedSettingType.PlayerSettingsVersion)) { SetPlayerSettingsVersion(appVersion); } if (currentDvancedSettingData.GetValue(DvancedSettingType.GenerateVersionInfo)) { FilesCsvForStreamingAssets.CopyStreamFilesCsvToVersion(version); } if (currentDvancedSettingData.GetValue(DvancedSettingType.GeneratorUpdateAssetList)) { FilesCsvForStreamingAssets.GeneratorUpdateList(null); } } HGUILayout.EndCenterHorizontal(); }
//path;md5;objType;assetName;assetBundleName;manifestName public static void Generator(bool developMode = false) { List <string> fileList = new List <string>(); string platformRoot = AssetManagerSetting.EditorRootPlatform; string filecsv = AssetManagerSetting.EditorFileCsvForStreaming; if (File.Exists(filecsv)) { File.Delete(filecsv); } PathUtil.CheckPath(filecsv); FileStream fs = new FileStream(filecsv, FileMode.CreateNew); StreamWriter sw = new StreamWriter(fs); string fileinfo; string path, md5, objType, assetName, assetBundleName; string file; AssetBundleInfoList infoList = AssetBundleEditor.GeneratorAssetBundleInfo(); if (developMode) { for (int i = 0; i < infoList.list.Count; i++) { AssetBundleInfo item = infoList.list[i]; fileinfo = SerializeFile("{0}/" + item.assetBundleName, "", item.objType, item.assetBundleName, item.assetName); sw.WriteLine(fileinfo); } } else { // streamingAssetsPath下非platform fileList.Clear(); if (Directory.Exists(Application.streamingAssetsPath)) { PathUtil.RecursiveFileFilter(Application.streamingAssetsPath, fileList, new List <string>(new string[] { ".meta" }), new List <string>(new string[] { "platform", "users" })); for (int i = 0; i < fileList.Count; i++) { file = fileList[i]; if (file.IndexOf("test_") != -1 || file.IndexOf("crash_report") != -1 || file.IndexOf("AssetBundleList.csv") != -1 || file.IndexOf("AssetList.csv") != -1 || file.IndexOf("version_") != -1 ) { continue; } path = file.Replace(Application.streamingAssetsPath + "/", string.Empty); md5 = PathUtil.md5file(file); fileinfo = SerializeFile(path, md5); sw.WriteLine(fileinfo); } } // config.assetbunld, luacode.assetbunld List <string> cl = new List <string>(); string[] byteFiles = new string[] { "config", "luacode" }; for (int i = 0; i < byteFiles.Length; i++) { file = platformRoot + "/" + byteFiles[i] + AssetManagerSetting.AssetbundleExt; if (!File.Exists(file)) { continue; } cl.Add(file); path = file.Replace(platformRoot, "{0}"); md5 = PathUtil.md5file(file); fileinfo = SerializeFile(path, md5); sw.WriteLine(fileinfo); } // streamingAssetsPath下platform fileList.Clear(); Recursive(platformRoot, fileList); objType = ""; int count = fileList.Count; for (int i = 0; i < count; i++) { if (i % 20 == 0) { EditorUtility.DisplayProgressBar("生成文件MD5", i + "/" + count, 1f * i / count); } file = fileList[i]; path = file.Replace(platformRoot, "{0}"); assetBundleName = file.Replace(platformRoot + "/", string.Empty); md5 = PathUtil.md5file(file); if (infoList.Has(assetBundleName)) { AssetBundleInfo info = infoList.Get(assetBundleName); assetName = info.assetName; objType = info.objType; } else { assetName = Path.GetFileName(file); if (path.IndexOf("{0}/assets") == 0) { assetName = ""; } else if (path == "{0}/" + Platform.PlatformDirectoryName) { assetName = "assetbundlemanifest"; } else { assetName = assetName.Replace(AssetManagerSetting.AssetbundleExt, string.Empty); assetName = PathUtil.ChangeExtension(assetName, string.Empty); } } fileinfo = SerializeFile(path, md5, objType, assetBundleName, assetName); sw.WriteLine(fileinfo); } } fileinfo = SerializeFile("{0}/" + AssetManagerSetting.FilesName, DateTime.Now.ToString("yyyyMMddHHmmss")); sw.WriteLine(fileinfo); sw.Close(); fs.Close(); AssetDatabase.Refresh(); Debug.Log("[FilesGenerator]" + filecsv); EditorUtility.ClearProgressBar(); }
void OnGUI() { VersionList.Read(); TabType tabType = HGUILayout.TabGroup <TabType>(tabGroupData); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); GUILayout.Space(20); currentDvancedSettingData = dvancedSettingDataDict[tabType]; switch (tabType) { case TabType.Develop: OnGUI_Develop(); break; case TabType.App: OnGUI_App(); break; case TabType.Patch: OnGUI_Patch(); break; } currentDvancedSettingData.foldout = EditorGUILayout.Foldout(currentDvancedSettingData.foldout, "高级设置"); if (currentDvancedSettingData.foldout) { GUILayout.BeginVertical(HGUILayout.boxMPStyle); for (int i = 0; i < currentDvancedSettingData.list.Count; i++) { DvancedSettingItem item = currentDvancedSettingData.list[i]; GUILayout.BeginHorizontal(); item.value = EditorGUILayout.ToggleLeft(item.name, item.value, GUILayout.Width(250)); if (GUILayout.Button(item.name, GUILayout.Width(250))) { switch (item.type) { case DvancedSettingType.ClearAllPlatformDirctory: PathUtil.ClearAllPlatformDirctory(); AssetDatabase.Refresh(); break; case DvancedSettingType.ClearOtherPlatformDirctory: PathUtil.ClearOtherPlatformDirctory(runtimePlatform); AssetDatabase.Refresh(); break; case DvancedSettingType.ClearTestData: PathUtil.ClearTestData(); AssetDatabase.Refresh(); break; case DvancedSettingType.AB_luacode: AB.Lua(); break; case DvancedSettingType.AB_config: AB.Config(); break; case DvancedSettingType.Clear_AssetBundleName: AssetBundleEditor.ClearAssetBundleNames(); AssetDatabase.RemoveUnusedAssetBundleNames(); break; case DvancedSettingType.Set_AssetBundleName: AssetBundleEditor.SetNames(); break; case DvancedSettingType.GameConstConfig: GameConstConfig config = GameConstConfig.Load(); switch (tabType) { case TabType.Develop: config.DevelopMode = true; config.TestVersionMode = false; break; case TabType.App: config.DevelopMode = false; config.Version = appVersion.ToConfig(); break; case TabType.Patch: config.DevelopMode = false; config.Version = patchVersion.ToConfig(); break; } config.Save(); break; case DvancedSettingType.GeneratorStreamingAssetsFilesCSV: switch (tabType) { case TabType.App: case TabType.Patch: FilesCsvForStreamingAssets.Generator(); break; case TabType.Develop: FilesCsvForStreamingAssets.Generator(true); break; } break; case DvancedSettingType.GeneratorResourcesFilesCSV: FilesCsvForResources.Generator(); break; case DvancedSettingType.PlayerSettings: SetPlayerSettings(runtimePlatform); break; case DvancedSettingType.PlayerSettingsVersion: switch (tabType) { case TabType.App: SetPlayerSettingsVersion(appVersion); break; case TabType.Patch: SetPlayerSettingsVersion(patchVersion); break; } break; case DvancedSettingType.GenerateVersionInfo: switch (tabType) { case TabType.App: appVersion.SetNowDatetime(); FilesCsvForStreamingAssets.CopyStreamFilesCsvToVersion(appVersion); break; case TabType.Patch: patchVersion.SetNowDatetime(); FilesCsvForStreamingAssets.CopyStreamFilesCsvToVersion(patchVersion); break; } break; case DvancedSettingType.GeneratorUpdateAssetList: switch (tabType) { case TabType.App: FilesCsvForStreamingAssets.GeneratorUpdateList(null); break; case TabType.Patch: FilesCsvForStreamingAssets.GeneratorUpdateList(compareVersion); break; } break; } } GUILayout.EndHorizontal(); GUILayout.Space(10); } GUILayout.EndVertical(); } switch (tabType) { case TabType.App: case TabType.Patch: OnGUI_AssetBundleServer(); OnGUI_TestVersionModel(); break; } EditorGUILayout.EndScrollView(); }
public static void GeneratorAssetBundleInfo() { AssetBundleEditor.GeneratorAssetBundleInfo(); }
public static void ClearManifestHelpFile() { AssetBundleEditor.ClearManifestHelpFile(); }
public static void BuildAssetBundles() { AssetBundleEditor.BuildAssetBundles(); }
public static void SetAssetBundleNames() { AssetBundleEditor.SetNames(); }
public static void ClearAssetBundleNames() { AssetBundleEditor.ClearAssetBundleNames(); }