public static AssetBundleEditorInfo GetAssetBundleEditorInfo(string path) { if (path.Equals(string.Empty)) { return(null); } string assetBundleName; string assetBundleVartian; string guid; AssetBundleManagerEditor.GetAssetBundleInfoFromMeta(path, out assetBundleName, out assetBundleVartian, out guid); if (assetBundleName.Equals(string.Empty) || assetBundleVartian.Equals(string.Empty) || guid.Equals(string.Empty)) { return(null); } string assetName = Path.GetFileNameWithoutExtension(path); if (assetName.Equals(string.Empty)) { return(null); } AssetBundleEditorInfo info = new AssetBundleEditorInfo(); info.AssetBundleName = assetBundleName; info.AssetBundleVarian = assetBundleVartian; info.guid = guid; info.assetName = assetName; return(info); }
public static void Init() { AssetBundleManagerEditor uv = EditorWindow.GetWindow <AssetBundleManagerEditor>(false, "AssetBundle管理理器", true); uv.Show(); uv.autoRepaintOnSceneChange = true; }
private static void ApplyFixed(string overridefixedLogPath) { string fileText = string.Empty; string reladyPath = "FixedFillPathInfo.txt"; if (!string.IsNullOrEmpty(overridefixedLogPath)) { reladyPath = overridefixedLogPath; } if (needtoFixDll) { Debug.Log("正在修复DLL"); ComponentUtily.ReimportUI(); AssetBundleManagerEditor.SaveAndRefershAssets(); } fileText = "needToFixDll:" + needtoFixDll + "\r\n"; foreach (FixedPathNode str in needToFixedFilePath) { fileText += "FixedFileInfo:" + str.getDesc() + "\r\n"; Debug.Log("资源导入时发生错误,正在重新导入:" + str.FixedPath); AssetDatabase.ImportAsset(str.FixedPath, ImportAssetOptions.ForceUpdate); } File.WriteAllText(reladyPath, fileText); if (needToFixedFilePath.Count > 0) { Debug.Log("资源重新导入完成.."); } AssetBundleManagerEditor.SaveAndRefershAssets(); }
/// <summary> /// 加载所有的音频资源 /// </summary> public static void LoadAudioClipSource() { GenerateAllAudioPatch(); for (int i = 0; i < AudioAssetRelativePathList.Count; i++) { AudioClip cli = AssetDatabase.LoadAssetAtPath <AudioClip>(AudioAssetRelativePathList[i]); if (cli) { string guid = AssetBundleManagerEditor.GetAssetGUIDFromMeta(AudioAssetAbsolutePathList[i]); if (!string.IsNullOrEmpty(guid)) { AudioClipInfo inf = new AudioClipInfo(); inf.AssetGUID = guid; inf.AssetName = GetAssetNameFromPatchWithOutExe(AudioAssetRelativePathList[i]); inf.AssetNameWithExe = GetAssetNameFromPatch(AudioAssetRelativePathList[i]); AssetImporter importer = AssetImporter.GetAtPath(AudioAssetRelativePathList[i]); inf.AssetBundleName = importer.assetBundleName; if (!string.IsNullOrEmpty(importer.assetBundleVariant)) { inf.AssetBundleName += "." + importer.assetBundleVariant; } inf.AudioLength = cli.length; inf.ResObj = cli; inf.AbsolutePatch = AudioAssetAbsolutePathList[i]; inf.RelativePatch = AudioAssetRelativePathList[i]; inf.HostTreeViewName = string.Empty; AudioSourceList.Add(inf); AudioSourceTable.Add(guid, inf); } } } GenrateResTreeView(); }
public static AssetBundleManagerEditor.AssetBundleEditorInfo MakeSchemeAssetBundleInfo(string patch) { AssetBundleManagerEditor.AssetBundleEditorInfo info = null; AssetImporter assetImporter = AssetImporter.GetAtPath(patch); if (!assetImporter) { return(info); } string asPatch = assetImporter.assetPath; //不是在这个路径下的,不是场景文件,不处理 if (!isSchemeAssets(asPatch)) { return(info); } //移除头部 asPatch = asPatch.Replace(SchemePatch, ""); string[] strs = asPatch.Split('/'); //没有放到其他文件夹下,则使用默认的包 if (strs.Length <= 1) { asPatch = "Default"; } else { //移除名字 asPatch = asPatch.Replace(strs[strs.Length - 1], ""); //再移除最后的斜杠 asPatch = asPatch.Remove(asPatch.Length - 1); } string assetName = Path.GetFileNameWithoutExtension(assetImporter.assetPath); string guid = AssetBundleManagerEditor.GetAssetGUIDFromMeta(assetImporter.assetPath); if (guid.Equals(string.Empty)) { return(info); } //最后就是包名 string abName = AssetBundleManager.SchemeVariant + "/" + asPatch; string variant = AssetBundleManager.SchemeVariant; SaveAssetBundleData(assetImporter, abName, variant); info = new AssetBundleManagerEditor.AssetBundleEditorInfo(); info.AssetBundleName = abName; info.AssetBundleVarian = variant; info.guid = guid; info.assetName = assetName; DispatchScheme(patch); return(info); }
public static AssetBundleManagerEditor.AssetBundleEditorInfo MakePrefabAssetBundleInfo(string patch) { AssetBundleManagerEditor.AssetBundleEditorInfo info = null; string lowerPatch = patch; if (!IsPrefabAssets(lowerPatch)) { return(info); } AssetImporter assetImporter = AssetImporter.GetAtPath(patch); if (!assetImporter) { return(info); } string asPatch = assetImporter.assetPath; //移除头部 asPatch = asPatch.Replace(PrefabPatch, ""); asPatch = asPatch.Replace(ArtitsPatch, ""); string[] strs = asPatch.Split('/'); //没有放到其他文件夹下,则使用默认的包 if (strs.Length <= 1) { asPatch = "Default"; } else { //移除名字 asPatch = asPatch.Replace(strs[strs.Length - 1], ""); //再移除最后的斜杠 asPatch = asPatch.Remove(asPatch.Length - 1); } string assetName = Path.GetFileNameWithoutExtension(assetImporter.assetPath); string guid = AssetBundleManagerEditor.GetAssetGUIDFromMeta(assetImporter.assetPath); if (guid.Equals(string.Empty)) { return(info); } string abName = "gameobject/" + asPatch + "/" + assetName; string variant = AssetBundleManager.PrefabVariant; SaveAssetBundleData(assetImporter, abName, variant); info = new AssetBundleManagerEditor.AssetBundleEditorInfo(); info.AssetBundleName = abName; info.AssetBundleVarian = variant; info.guid = guid; info.assetName = assetName; return(info); }
public static string GetGUID(string assetPath) { string ablotePatch = Application.dataPath; ablotePatch = ablotePatch.Replace("Assets", ""); ablotePatch += assetPath; return(AssetBundleManagerEditor.GetAssetGUIDFromMeta(ablotePatch)); }
public static void BuildProject_Debug64() { CreateFileHelper(GetCommand_BuildingDebugProjectPath64()); AssetBundleManagerEditor uv = EditorWindow.GetWindow <AssetBundleManagerEditor>(false, "AssetBundle管理理器", true); uv.Show(); uv.autoRepaintOnSceneChange = true; }
public static void BuildFullPackage64() { CreateFileHelper(GetCommand_PackingAssetsPath64()); AssetBundleManagerEditor uv = EditorWindow.GetWindow <AssetBundleManagerEditor>(false, "AssetBundle管理理器", true); uv.Show(); uv.autoRepaintOnSceneChange = true; }
private static void SaveAssetBundleData(AssetImporter assetImporter, string AssetbundleName, string AssetVarian) { if (!assetImporter) { return; } AssetbundleName = AssetbundleName.ToLower(); AssetVarian = AssetVarian.ToLower(); if (assetImporter.assetBundleName.Equals(AssetbundleName) && assetImporter.assetBundleVariant.Equals(AssetVarian)) { return; } string filePatch = AssetBundleManagerEditor.ConverRelativePatchToObslotePatch(assetImporter.assetPath); filePatch += ".meta"; if (!File.Exists(filePatch)) { return; } string text = System.IO.File.ReadAllText(filePatch); List <string> alltext = new List <string>(); alltext.AddRange(text.Split('\n')); string strAbVar = " assetBundleVariant: "; string StrAbNa = " assetBundleName: "; for (int i = alltext.Count - 1; i >= 0; i--) { string s = alltext[i]; if (s.Contains(StrAbNa)) { alltext[i] = StrAbNa + AssetbundleName; } if (s.Contains(strAbVar)) { alltext[i] = strAbVar + AssetVarian; } } string result = string.Empty; result = alltext[0]; for (int i = 1; i < alltext.Count; i++) { result += '\n'; result += alltext[i]; } System.IO.File.WriteAllText(filePatch, result); assetImporter.assetBundleName = AssetbundleName; if (!AssetbundleName.Equals(string.Empty)) { assetImporter.assetBundleVariant = AssetVarian; } }
public static void BuildProject_Release64_CommandLine() { EditorRunTypeWindow.RunFromCommandLine(); CreateFileHelper(GetCommand_BuildingReleaseProjectPath64()); AssetBundleManagerEditor uv = EditorWindow.GetWindow <AssetBundleManagerEditor>(false, "AssetBundle管理理器", true); uv.Show(); uv.autoRepaintOnSceneChange = true; }
private static bool GetTextureInfo(AssetImporter assetImporter, out int width, out int height) { width = 0; height = 0; string filePatch = AssetBundleManagerEditor.ConverRelativePatchToObslotePatch(assetImporter.assetPath); filePatch += ".meta"; if (!File.Exists(filePatch)) { return(false); } //CubeMap特殊处理一下 if (IsCubeMap(assetImporter.assetPath)) { width = 2048; height = width; return(true); } string userData = assetImporter.userData; //if (!userData.Contains(TextureInfoBegin)) //{ //string text = System.IO.File.ReadAllText(filePatch); //List<string> alltext = new List<string>(); //alltext.AddRange(text.Split('\n')); //string strAbVar = " userData: "; //for (int i = alltext.Count - 1; i >= 0; i--) //{ // string s = alltext[i]; // if (s.Contains(strAbVar)) // { // userData = s.Replace(strAbVar, string.Empty); // } //} //} if (!userData.Contains(TextureInfoBegin)) { return(false); } int begin = userData.IndexOf(TextureInfoBegin); int end = userData.IndexOf(TextureInfoEnd); string reslut = userData.Substring(begin, end - begin); reslut = reslut.Replace(TextureInfoBegin, string.Empty); reslut = reslut.Replace(TextureInfoEnd, string.Empty); string[] str = reslut.Split(','); bool re = int.TryParse(str[0], out width); re = re && int.TryParse(str[1], out height); return(re); }
public static bool DoImporterFixed(string CopyeditorLogPath = null, string fixedLogPath = null) { needToFixedFilePath.Clear(); GenerateErrorFile(CopyeditorLogPath); ApplyFixed(fixedLogPath); AssetBundleManagerEditor.SaveAndRefershAssets(); return(needToFixedFilePath.Count > 0); }
private static void ProcessUpdateResourcesImpl(string channel) { var versionPath = string.Format("../../Public/Version/Cn/Android/{0}/Game.ver", channel); GameVersionPath = Path.Combine(Application.dataPath, versionPath); string AssetBundlePath = Path.Combine(Application.dataPath, "BundleAsset"); AssetBundleManagerEditor.RefreshDirectory(); AssetBundleManagerEditor.RebuildAll(); }
public static AssetBundleManagerEditor.AssetBundleEditorInfo MakeSoundAssetBundleInfoFromReference(string patch) { AssetBundleManagerEditor.AssetBundleEditorInfo info = AssetBundleManagerEditor.GetAssetBundleEditorInfo(patch); if (null != info) { return(info); } info = MakeSoundAssetBundleData(patch); return(info); }
public static void OpenAssetBundleImporterFixedEditorFromCommandLine() { EditorRunTypeWindow.RunFromCommandLine(); AssetBundleManagerEditor uv1 = EditorWindow.GetWindow <AssetBundleManagerEditor>(false, "AssetBundle管理理器", false); uv1.Close(); AssetBundleImporterFixedEditor uv = EditorWindow.GetWindow <AssetBundleImporterFixedEditor>(false, "导入修复管理理器", true); uv.Show(); uv.autoRepaintOnSceneChange = true; }
public static ResConfigData BuildResConfigData(string path, string referenceAssetbundleName, string referenceVariant) { if (!referenceAssetbundleName.Equals(string.Empty) && !referenceVariant.Equals(string.Empty)) { string guid = AssetBundleManagerEditor.GetAssetGUIDFromMeta(path); string assetName = Path.GetFileNameWithoutExtension(path); ResConfigData cof = new ResConfigData(); cof.AssetBundleName = referenceAssetbundleName + "." + referenceVariant; cof.AssetGUID = guid; cof.AssetName = assetName; return(cof); } return(null); }
/// <summary> /// ab信息从meta中获取 /// </summary> /// <param name="assetImporter"></param> public static void GetAssetBundleInfoFromMeta(string assetPath, out string AssetBundleName, out string AssetBundleVariant, out string guid) { AssetBundleName = string.Empty; AssetBundleVariant = string.Empty; guid = string.Empty; if (assetPath.Equals(string.Empty)) { return; } string filePatch = AssetBundleManagerEditor.ConverRelativePatchToObslotePatch(assetPath); filePatch += ".meta"; if (!File.Exists(filePatch)) { Debug.LogError("找不到文件,请确认文件路径:" + assetPath); return; } string text = System.IO.File.ReadAllText(filePatch); List <string> alltext = new List <string>(); alltext.AddRange(text.Split('\n')); string strAbVar = " assetBundleVariant: "; string StrAbNa = " assetBundleName: "; string StrGuid = "guid: "; for (int i = 0; i < alltext.Count; i++) { string s = alltext[i]; if (s.Contains(StrAbNa)) { AssetBundleName = s.Replace(StrAbNa, string.Empty); AssetBundleName = AssetBundleName.Trim(); } if (s.Contains(strAbVar)) { AssetBundleVariant = s.Replace(strAbVar, string.Empty); AssetBundleVariant = AssetBundleVariant.Trim(); } if (s.Contains(StrGuid)) { guid = s.Replace(StrGuid, string.Empty); guid = guid.Trim(); } } }
/// <summary> /// 保存AssetBundle,版本升级后,再onpostallassets阶段,ab名不会写入到meta文件了,需要手动写入 /// </summary> /// <param name="assetImporter"></param> private static void SaveAssetBundleUserData(AssetImporter assetImporter, string userData) { if (!assetImporter) { return; } string filePatch = AssetBundleManagerEditor.ConverRelativePatchToObslotePatch(assetImporter.assetPath); filePatch += ".meta"; if (!File.Exists(filePatch)) { return; } //if (assetImporter.userData.Equals(userData)) //{ // return; //} assetImporter.userData = userData; string text = System.IO.File.ReadAllText(filePatch); List <string> alltext = new List <string>(); alltext.AddRange(text.Split('\n')); string StrUSD = " userData: "; for (int i = alltext.Count - 1; i >= 0; i--) { string s = alltext[i]; if (s.Contains(StrUSD)) { alltext[i] = StrUSD + userData; } } string result = string.Empty; result = alltext[0]; for (int i = 1; i < alltext.Count; i++) { result += '\n'; result += alltext[i]; } System.IO.File.WriteAllText(filePatch, result); }
private static AssetBundleManagerEditor.AssetBundleEditorInfo MakeSceneAssetBundleInfo(string patch) { AssetBundleManagerEditor.AssetBundleEditorInfo info = null; AssetImporter assetImporter = AssetImporter.GetAtPath(patch); if (!assetImporter) { return(info); } string asPatch = assetImporter.assetPath; //不是在这个路径下的,不是场景文件,不处理 if (!isSceneAssets(asPatch)) { return(info); } //场景文件是一个文件一个包,所以去掉头,然后去调后缀名就是包了 //移除头部 asPatch = asPatch.Replace(scenePatch, ""); //就去掉后缀名 asPatch = asPatch.Replace(".unity", ""); string abName = "Scene/" + asPatch; string variant = AssetBundleManager.sceneVariant; string guid = AssetBundleManagerEditor.GetAssetGUIDFromMeta(assetImporter.assetPath); if (guid.Equals(string.Empty)) { return(info); } string assetName = Path.GetFileNameWithoutExtension(assetImporter.assetPath); SaveAssetBundleData(assetImporter, abName, variant); info = new AssetBundleManagerEditor.AssetBundleEditorInfo(); info.AssetBundleName = abName; info.AssetBundleVarian = variant; info.guid = guid; info.assetName = assetName; return(info); }
// 默认的成员编辑 public void DefaultMemberEdit(MemberInfo info) { SerializedProperty prop = serializedObject.FindProperty(info.Name); if (prop == null) { return; } // 显示名字 EditorGUILayout.BeginVertical(editorInstance.rootGroupStyle); { EditorGUILayout.BeginHorizontal(); { // 根据info.Name和prop.type自己选择不同的编辑方式 if (prop.type != "") { //AssetBundleName和AssetName不可编辑 if (info.Name.Equals("AssetGUID")) { GUI.enabled = false; } EditorGUILayout.PropertyField(prop, true); GUI.enabled = true; //拖拽预制体的时候,同时赋值三个信息 if (info.Name.Equals("effectPrefb") && prop.objectReferenceValue) { AssetImporter asp = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(prop.objectReferenceValue)); SerializedProperty AssetGUID_prop = serializedObject.FindProperty("AssetGUID"); if (asp && null != AssetGUID_prop) { AssetGUID_prop.stringValue = AssetBundleManagerEditor.GetAssetGUIDFromMeta(asp.assetPath); //prop.objectReferenceValue = null; } else { Debug.LogError("获取资源信息失败!"); } } serializedObject.ApplyModifiedProperties(); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); }
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { bool bMovedSound = false; bool bImportSound = false; //处理的是否是UI文件 bool bImportUI = false; OnPreProcessScheme(); for (int i = 0; i < importedAssets.Length; i++) { //看看是不是场景文件 string s = importedAssets[i]; AssetBundleManagerEditor.CheckAssetName(s); if (isSceneAssets(s)) { MakeSceneAssetBundleInfo(s); } else if (isShaderAssets(s)) { MakeShaderAssetBundle(s); } else if (isMeshAssets(s)) { MakeMeshAssetBundle(s); } else if (isAudioAssets(s)) { bImportSound = true; MakeSoundAssetBundleData(s); } else if (IsFontAsset(s)) { MakeFontBundleData(AssetImporter.GetAtPath(s)); } else if (IsFBXAsset(s)) { MakeFBXAssetBundle(AssetImporter.GetAtPath(s) as ModelImporter); } else if (IsMaterialAsset(s)) { MakeMaterialAssetBundle(s); } else if (IsAniClipAsset(s)) { MakeAnimatorClipAssetBundleData(s); } else if (IsControllerAsset(s)) { MakeAnimatorControllerAssetBundleData(s); } else if (IsTextureAsset(s)) { MakeTextureAssetBundle(s); } else if (isSchemeAssets(s)) { MakeSchemeAssetBundleInfo(s); } string path = importedAssets[i]; //载入的话弄到表里 if (path.Contains(UIDynamicAssetPatch)) { if (!IsTextureAsset(path)) { continue; } bImportUI = true; UFileData data = new UFileData(); data.configData = MakeTextureAssetBundleFromReference(path, string.Empty); if (null != data.configData) { PostprocessUITextureToCSV.nEditorInstance.InsetConfig(data); } else { Debug.LogError("取得UI资源失败:" + path); } } } //资源移动了 List <string> movedGUID = new List <string>(); for (int i = 0; i < movedAssets.Length; i++) { string str = movedAssets[i]; AssetBundleManagerEditor.CheckAssetName(movedAssets[i]); //先清掉ab ClearAssetBundleData(AssetImporter.GetAtPath(str)); //再根据资源类型来重新生成ab //是音效的 if (isAudioAssets(str)) { MakeSoundAssetBundleData(str); movedGUID.Add(AssetBundleManagerEditor.GetAssetGUIDFromMeta(str)); bMovedSound = true; } //是贴图 else if (IsTextureAsset(str)) { MakeTextureAssetBundle(str); } //是场景 else if (isSceneAssets(str)) { MakeSceneAssetBundleInfo(str); } else if (IsFontAsset(str)) { MakeFontBundleData(AssetImporter.GetAtPath(str)); } else if (IsFBXAsset(str)) { CheckFBXInImportTime(str); MakeFBXAssetBundle(AssetImporter.GetAtPath(str) as ModelImporter); } else if (IsMaterialAsset(str)) { MakeMaterialAssetBundle(str); } else if (IsAniClipAsset(str)) { MakeAnimatorClipAssetBundleData(str); } else if (IsControllerAsset(str)) { MakeAnimatorControllerAssetBundleData(str); } else if (isSchemeAssets(str)) { MakeSchemeAssetBundleInfo(str); } else if (isShaderAssets(str)) { MakeShaderAssetBundle(str); } else if (isMeshAssets(str)) { MakeMeshAssetBundle(str); } string path = movedAssets[i]; if (path.Contains(UIDynamicAssetPatch)) { bImportUI = true; AssetImporter assetImporter = AssetImporter.GetAtPath(path); PostprocessUITextureToCSV.nEditorInstance.RemoveConfig(PostprocessUITextureToCSV.GetGUID(assetImporter.assetPath)); } } if (SoundSystem.SoundSystemEditorWindow.EditorInstance) { if (bMovedSound || bImportSound) { if (bMovedSound) { SoundSystem.SoundSystemEditorWindow.RefrshAudioClipSource(movedGUID); } else { SoundSystem.SoundSystemEditorWindow.RefrshAudioClipSource(); } } } //UI的处理完保存配置 if (bImportUI) { PostprocessUITextureToCSV.nEditorInstance.ExportConfig(); } OnPostProcessScheme(); if (!AssetBundleManagerEditor.isBuildingPackage && !AssetBundleManagerEditor.isCleaningAssets) { AssetBundleManager.LoadPrefabConfig(); for (int i = 0; i < movedAssets.Length; i++) { string str = movedAssets[i]; if (IsPrefabAssets(movedFromAssetPaths[i])) { ClearSinglePrefab(str); } if (IsPrefabAssets(str)) { ImportSinglePrefab(str, true); } } for (int i = 0; i < importedAssets.Length; i++) { ImportSinglePrefab(importedAssets[i], true); } SchemeExport.Export_PrefabScheme(); AssetBundleManager.ClearPrefabConfig(); } //进入播放模式的时候会调用一次这个postallasets,所以要加载一次配置 if (Application.isPlaying) { AssetBundleManager.LoadPrefabConfig(); } if (movedAssets.Length > 0) { AssetDatabase.Refresh(); } //移除无用的ab名 AssetDatabase.RemoveUnusedAssetBundleNames(); }
private static void ProcessResourcesImpl(bool bRebuildBundle) { string AssetBundlePath = Path.Combine(Application.dataPath, "BundleAsset"); if (bRebuildBundle) { if (Directory.Exists(AssetBundlePath)) { Directory.Delete(AssetBundlePath, true); Directory.CreateDirectory(AssetBundlePath); } AssetBundleManagerEditor.RefreshDirectory(); AssetBundleManagerEditor.RebuildAll(); } else { var data = AssetBundleManager.GetManageData(false); var index = 0; { var __list3 = data.assetbundles; var __listCount3 = __list3.Count; for (int __i3 = 0; __i3 < __listCount3; ++__i3) { var assetBundleData = __list3[__i3]; { if (assetBundleData.File.Contains("Script")) { AssetBundleManagerEditor.CreateAssetBundleWithDependency(data, index, true); break; } index++; } } } } string streamAssetsPath = Application.streamingAssetsPath; if (Directory.Exists(streamAssetsPath)) { Directory.Delete(streamAssetsPath, true); } Directory.CreateDirectory(streamAssetsPath); //是不是要打小包 string path = Path.Combine(Application.dataPath, "../../thinpackage.txt"); if (File.Exists(path)) { s_IsThinPackage = true; File.Delete(path); } else { s_IsThinPackage = false; } if (s_IsThinPackage) { ModifyVersionFile(GameVersionPath, 1); ProcessThinPackageResource(); string destPath = Path.Combine(Application.streamingAssetsPath, "Game.ver"); File.Copy(GameVersionPath, destPath, true); if (bRebuildBundle) { ModifyVersionFile(GameVersionPath, 1); } } else { DirectoryCopy(AssetBundlePath, streamAssetsPath, true); if (bRebuildBundle) { ModifyVersionFile(GameVersionPath, 1); } string destPath = Path.Combine(Application.streamingAssetsPath, "Game.ver"); File.Copy(GameVersionPath, destPath, true); } string destPath3 = Path.Combine(Application.streamingAssetsPath, "logo.mp4"); string mp4Path = Path.Combine(Application.dataPath, "../../PlatformPlugin/logo.mp4"); if (File.Exists(mp4Path)) { File.Copy(mp4Path, destPath3, true); } ToLuaMenu.BuildNotJitBundles(); DirectoryCopy(Path.Combine(Application.streamingAssetsPath, LuaConst.osDir), Path.Combine(AssetBundlePath, LuaConst.osDir), true); //把需要更新文件备份 string assetBundlePath = Path.Combine(Application.dataPath, "BundleAsset"); string verInfo = File.ReadAllText(GameVersionPath).Trim(); var config = verInfo.Split(','); var backupPathStr = string.Format("../../Update/{0}/{1}/{2}/{3}/BundleAsset", config[0], config[1], config[2], config[3]); var backupPath = Path.Combine(Application.dataPath, backupPathStr); CheckTargetPath(backupPath); if (Directory.Exists(backupPath)) { Directory.Delete(backupPath, true); } DirectoryCopy(assetBundlePath, backupPath, true); DllBackupPath = backupPath; }
private static void OnImportLightingEffectSceheme(string path) { AssetBundleManagerEditor.AssetBundleEditorInfo da = AssetBundleManagerEditor.GetAssetBundleEditorInfo(path); }
private static void MakeUpdatePackage(string platform, string channel, string version, string cSharp, string script) { if (platform.Equals("Android")) { EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.Android); EditorUserBuildSettings.androidBuildSubtarget = AndroidBuildSubtarget.ETC2; } //config读取 var buildPath = Path.Combine(Application.dataPath, "../build/"); var versionPath = string.Format("../../Public/Version/Cn/{0}/{1}/Game.ver", platform, channel); var versionFullPath = Path.Combine(Application.dataPath, versionPath); var verInfo = File.ReadAllText(versionFullPath).Trim(); var config = verInfo.Split(','); var ver = config[3]; if (!string.IsNullOrEmpty(version)) { ver = version; } ver = ver.Trim().Replace(Environment.NewLine, ""); //设置updatepath var backupPathStr = string.Format("../../Update/{0}/{1}/{2}/{3}/BundleAsset", config[0], config[1], config[2], ver); var backupPath = Path.Combine(Application.dataPath, backupPathStr); var assetBundlePath = Path.Combine(Application.dataPath, "BundleAsset"); DllBackupPath = backupPath; var svnVer = string.Format("../../Update/{0}/{1}/{2}/{3}/svn.ver", config[0], config[1], config[2], ver); var svnVerPath = Path.Combine(Application.dataPath, svnVer); if (!File.Exists(svnVerPath)) { throw new Exception("找不到上次svn版本号文件" + svnVerPath); } ModifyVersionFile(versionFullPath, 1); if (cSharp.Equals("1")) { GenerateAssemblyCSharpToRes(versionFullPath); } var svnVersion = File.ReadAllText(svnVerPath); RunLinuxShell(buildPath + "Getsvndiff.sh", svnVersion, Application.dataPath); var diffPath = Path.Combine(buildPath, "changelist.txt"); if (!File.Exists(diffPath)) { throw new Exception("生成svndiff失败!!"); } var difflist = GetDiffList(diffPath); AssetBundleManagerEditor.CreateAssetBundleWithDiffList(difflist, cSharp.Equals("1"), script.Equals("1")); Logger.Debug("CreateAssetBundleWithDiffList finish!"); RunLinuxShell(buildPath + "SaveSvnVersion.sh", Application.dataPath, svnVerPath); DirectoryCopy(assetBundlePath, backupPath, true); CleanAndroidPlugins(); }
private static AssetBundleManagerEditor.AssetBundleEditorInfo BuildAnimatorClipAssetBundleInfo(AssetImporter assetImporter, string referenceAssetbundleName) { string AbName = string.Empty; string AbVirtant = string.Empty; if (!assetImporter) { return(null); } string asPatch = assetImporter.assetPath; //移除头部 asPatch = asPatch.Replace(ArtitsPatch, ""); string[] strs = asPatch.Split('/'); //没有放到其他文件夹下,则使用默认的包 if (strs.Length <= 1) { asPatch = "Default"; } else { //移除名字 asPatch = asPatch.Replace(strs[strs.Length - 1], ""); //再移除最后的斜杠 asPatch = asPatch.Remove(asPatch.Length - 1); } //最后就是包名 AbName = "animclip/" + asPatch; AbVirtant = AssetBundleManager.AnimatorClipVariant; string assetName = Path.GetFileNameWithoutExtension(assetImporter.assetPath); string assetGUID = AssetBundleManagerEditor.GetAssetGUIDFromMeta(assetImporter.assetPath); if (assetName.Equals(string.Empty) || assetGUID.Equals(string.Empty)) { return(null); } if (!referenceAssetbundleName.Equals(string.Empty)) { AbName = referenceAssetbundleName; } AssetBundleManagerEditor.AssetBundleEditorInfo info = new AssetBundleManagerEditor.AssetBundleEditorInfo(); info.AssetBundleName = AbName; info.AssetBundleVarian = AbVirtant; info.guid = assetGUID; info.assetName = assetName; AssetBundleManagerEditor.AssetFileInfo fileInfo = AssetBundleManagerEditor.GetFileInfo(AssetBundleManagerEditor.ConverRelativePatchToObslotePatch(assetImporter.assetPath)); if (fileInfo != null) { info.Asset_X = fileInfo.fileLengthInMB; info.Asset_Y = fileInfo.fileLengthInMB; } return(info); }
private static AssetBundleManagerEditor.AssetBundleEditorInfo BuildMaterialAssetBundleInfo(AssetImporter assetImporter, string referenceAssetbundleName) { string AbName = string.Empty; string AbVirtant = string.Empty; if (!assetImporter) { return(null); } if (!CheckAssetDependices(assetImporter.assetPath)) { return(null); } string asPatch = assetImporter.assetPath; if (!IsMaterialAsset(asPatch)) { return(null); } //移除头部 asPatch = asPatch.Replace(ArtitsPatch, ""); string[] strs = asPatch.Split('/'); //没有放到其他文件夹下,则使用默认的包 if (strs.Length <= 1) { asPatch = "Default"; } else { //移除名字 asPatch = asPatch.Replace(strs[strs.Length - 1], ""); //再移除最后的斜杠 asPatch = asPatch.Remove(asPatch.Length - 1); } //最后就是包名 AbName = "Material/" + asPatch; AbVirtant = AssetBundleManager.MatVariant; if (AbName.Equals(string.Empty) || AbVirtant.Equals(string.Empty)) { return(null); } string assetName = Path.GetFileNameWithoutExtension(assetImporter.assetPath); string assetGUID = AssetBundleManagerEditor.GetAssetGUIDFromMeta(assetImporter.assetPath); if (assetName.Equals(string.Empty) || assetGUID.Equals(string.Empty)) { return(null); } if (!referenceAssetbundleName.Equals(string.Empty)) { AbName = referenceAssetbundleName; } AssetBundleManagerEditor.AssetBundleEditorInfo info = new AssetBundleManagerEditor.AssetBundleEditorInfo(); info.AssetBundleName = AbName; info.AssetBundleVarian = AbVirtant; info.guid = assetGUID; info.assetName = assetName; return(info); }
private static AssetBundleManagerEditor.AssetBundleEditorInfo BuildAnimatorControllerAssetBundleInfo(AssetImporter assetImporter, string referenceAssetbundleName) { string AbName = string.Empty; string AbVirtant = string.Empty; if (!assetImporter) { return(null); } if (!CheckAssetDependices(assetImporter.assetPath)) { return(null); } string asPatch = assetImporter.assetPath; if (!IsControllerAsset(asPatch)) { return(null); } //区分一下是模型还是特效 string patchHead = string.Empty; if (asPatch.Contains(ModelAnimatorControllerPatch)) { patchHead = "model/"; } //移除头部 asPatch = asPatch.Replace(ModelAnimatorControllerPatch, ""); asPatch = asPatch.Replace(ArtitsPatch, ""); string[] strs = asPatch.Split('/'); //没有放到其他文件夹下,则使用默认的包 if (strs.Length <= 1) { asPatch = "Default"; } else { //移除名字 asPatch = asPatch.Replace(strs[strs.Length - 1], ""); //再移除最后的斜杠 asPatch = asPatch.Remove(asPatch.Length - 1); } AbName = "animcontroller/" + patchHead + asPatch; AbVirtant = AssetBundleManager.AnimatorControllerVariant; string assetName = Path.GetFileNameWithoutExtension(assetImporter.assetPath); string assetGUID = AssetBundleManagerEditor.GetAssetGUIDFromMeta(assetImporter.assetPath); if (assetName.Equals(string.Empty) || assetGUID.Equals(string.Empty)) { return(null); } if (!referenceAssetbundleName.Equals(string.Empty)) { AbName = referenceAssetbundleName; } AssetBundleManagerEditor.AssetBundleEditorInfo info = new AssetBundleManagerEditor.AssetBundleEditorInfo(); info.AssetBundleName = AbName; info.AssetBundleVarian = AbVirtant; info.guid = assetGUID; info.assetName = assetName; return(info); }
/// <summary> /// 绘制配置信息 /// </summary> private void DrawConfigInfo() { Rect pos = position; AudioConfigInfoRect.x = ConfigViewListRect.width; AudioConfigInfoRect.y = 0; AudioConfigInfoRect.width = pos.width - ConfigViewListRect.width - AudioResourceListRect.width; AudioConfigInfoRect.height = AudioResourceListRect.height * 0.67f; GUI.Box(AudioConfigInfoRect, ""); GUILayout.BeginArea(AudioConfigInfoRect); ConfigInofScrollViewPos = GUILayout.BeginScrollView(ConfigInofScrollViewPos, GUILayout.Height(AudioConfigInfoRect.height)); GUILayout.BeginVertical("box"); if (currentSelectedConfig == null) { GUILayout.Label("无可用配置信息.."); } else { GUILayout.Label("配置信息:"); GUILayout.BeginHorizontal("box"); currentSelectedConfig.data.nID = EditorGUILayout.IntField("ID:", currentSelectedConfig.data.nID); GUILayout.EndHorizontal(); currentSelectedConfig.data.soundType = (EMSoundType)EditorGUILayout.EnumPopup("声音类型:", currentSelectedConfig.data.soundType); currentSelectedConfig.data.mixerGroupType = (AudioMixerGroupType)EditorGUILayout.EnumPopup("混音组类型:", currentSelectedConfig.data.mixerGroupType); currentSelectedConfig.data.nMixerGroupIndex = EditorGUILayout.IntField("混音组序号:", currentSelectedConfig.data.nMixerGroupIndex); GUI.changed = false; currentSelectedConfig.data.bBypassEffect = EditorGUILayout.Toggle("Bypass Effects:", currentSelectedConfig.data.bBypassEffect); currentSelectedConfig.data.bBypassReverbZone = EditorGUILayout.Toggle("Bypass Reverb Zone:", currentSelectedConfig.data.bBypassReverbZone); currentSelectedConfig.data.bPlayOnAwake = EditorGUILayout.Toggle("Play On Awake:", currentSelectedConfig.data.bPlayOnAwake); currentSelectedConfig.data.nPriority = EditorGUILayout.IntField("Priority:", currentSelectedConfig.data.nPriority); currentSelectedConfig.data.fPitch = EditorGUILayout.FloatField("Pitch:", currentSelectedConfig.data.fPitch); currentSelectedConfig.data.fStereoPan = EditorGUILayout.FloatField("Stereo Pan:", currentSelectedConfig.data.fStereoPan); currentSelectedConfig.data.fReverZoneMix = EditorGUILayout.FloatField("Rever Zone Mix:", currentSelectedConfig.data.fReverZoneMix); currentSelectedConfig.data.b3DSound = EditorGUILayout.Toggle("是否3D音效:", currentSelectedConfig.data.b3DSound); if (currentSelectedConfig.data.b3DSound) { currentSelectedConfig.data.fDopplerLv = EditorGUILayout.FloatField("Doppler Level:", currentSelectedConfig.data.fDopplerLv); currentSelectedConfig.data.nSpread = EditorGUILayout.IntField("Spread:", currentSelectedConfig.data.nSpread); currentSelectedConfig.data.audioRoffType = (AudioRolloffMode)EditorGUILayout.EnumPopup("Volume Rolloff:", currentSelectedConfig.data.audioRoffType); currentSelectedConfig.data.fMinDistance = EditorGUILayout.FloatField("Min Distance:", currentSelectedConfig.data.fMinDistance); currentSelectedConfig.data.fMaxDistance = EditorGUILayout.FloatField("Max Distance:", currentSelectedConfig.data.fMaxDistance); } currentSelectedConfig.data.nPlayTimes = EditorGUILayout.IntField("播放次数(≤0循环):", currentSelectedConfig.data.nPlayTimes); currentSelectedConfig.data.fDuartion = EditorGUILayout.FloatField("持续时间(≤0无限):", currentSelectedConfig.data.fDuartion); currentSelectedConfig.data.fDelayPlayTime = EditorGUILayout.FloatField("延迟时间(≤0.03无延迟):", currentSelectedConfig.data.fDelayPlayTime); currentSelectedConfig.data.fIntervalBetweenPlayTimes = EditorGUILayout.FloatField("两次之间播放间隔(≤0无间隔):", currentSelectedConfig.data.fIntervalBetweenPlayTimes); if (GUI.changed) { // CurrentSoundConfigTable[currentSelectedConfig.data.nID] = currentSelectedConfig; } GUILayout.BeginVertical("box"); GUILayout.Label("依赖预制体:"); currentSelectedConfig.data.dependAsset = (GameObject)EditorGUILayout.ObjectField(currentSelectedConfig.data.dependAsset, typeof(Object), true); GUILayout.EndVertical(); AssetImporter asp = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(currentSelectedConfig.data.dependAsset)); if (asp) { string szGUID = AssetBundleManagerEditor.GetAssetGUIDFromMeta(asp.assetPath); if (currentSelectedConfig.data.szDependAssetGUID == string.Empty || (currentSelectedConfig.data.szDependAssetGUID != string.Empty && szGUID != string.Empty)) { currentSelectedConfig.data.szDependAssetGUID = szGUID; } } GUI.enabled = false; currentSelectedConfig.data.szDependAssetGUID = EditorGUILayout.TextField("资源所在的资源包:", currentSelectedConfig.data.szDependAssetGUID); GUI.enabled = true; GUILayout.Space(5.0f); GUILayout.BeginVertical("box"); GUILayout.Label("资源所在的资源包:" + currentSelectedConfig.data.AssetBundleName); GUILayout.Label("资源名:" + currentSelectedConfig.data.AssetName); GUILayout.Label("资源GUID:" + currentSelectedConfig.data.AssetGUID); GUILayout.EndVertical(); } GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.EndArea(); }
private static AssetBundleManagerEditor.AssetBundleEditorInfo MakeSoundAssetBundleData(string path) { AssetBundleManagerEditor.AssetBundleEditorInfo info = null; AssetImporter importer = AssetImporter.GetAtPath(path); if (!importer) { return(info); } AudioImporter assetImporter = importer as AudioImporter; if (!assetImporter) { return(info); } string asPatch = assetImporter.assetPath; //不是在这个路径下的,不处理 if (!isAudioAssets(asPatch)) { return(info); } //移除头部 asPatch = asPatch.Replace(soundAssetPatch, ""); string[] strs = asPatch.Split('/'); //没有放到其他文件夹下,则使用默认的音效包名 if (strs.Length <= 1) { asPatch = "DefaultSound"; } else { //移除名字 asPatch = asPatch.Replace(strs[strs.Length - 1], ""); //再移除最后的斜杠 asPatch = asPatch.Remove(asPatch.Length - 1); } string assetName = Path.GetFileNameWithoutExtension(assetImporter.assetPath); string guid = AssetBundleManagerEditor.GetAssetGUIDFromMeta(assetImporter.assetPath); if (guid.Equals(string.Empty)) { return(info); } string abName = "Sound/" + asPatch; string variant = AssetBundleManager.soundVariant; SaveAssetBundleData(assetImporter, abName, variant); info = new AssetBundleManagerEditor.AssetBundleEditorInfo(); info.AssetBundleName = abName; info.AssetBundleVarian = variant; info.guid = guid; info.assetName = assetName; return(info); }