/// <summary> /// 添加为首包下载文档 /// </summary> public static void FirstLoadFiles(bool delete = false) { Object[] selection = EditorUtils.SelectObjects(); string abName = ""; string apath = ""; foreach (Object s in selection) { abName = GetOriginalAssetBundleName(s, out apath); Debug.LogFormat("abname={0}", abName, apath); if (string.IsNullOrEmpty(abName)) { continue; } if (delete) { HugulaExtensionFolderEditor.RemoveExtendsFile(abName); } else if (!string.IsNullOrEmpty(abName) && !HugulaExtensionFolderEditor.ContainsExtendsPath(apath)) { HugulaExtensionFolderEditor.AddFirstLoadFile(abName); } else { Debug.LogFormat("assetPath({0}) can't add to extends file list ", apath); } } HugulaExtensionFolderEditor.SaveSettingData(); }
/// <summary> /// 清理扩展文件夹 /// </summary> public static void ClearExtendsFloder() { Object[] selection = Selection.objects; string apath = null; foreach (Object s in selection) { if (s is DefaultAsset) { apath = AssetDatabase.GetAssetPath(s); AssetImporter import = AssetImporter.GetAtPath(apath); import.userData = null; import.assetBundleName = null; //import.assetBundleVariant = null; AssetDatabase.SetLabels(s, null); import.SaveAndReimport(); //apath = apath.Replace("\\","/"); if (HugulaExtensionFolderEditor.ContainsExtendsPath(apath)) { Debug.LogFormat("{0},Clear AssetLabels,path ={1}", s.name, apath); HugulaExtensionFolderEditor.RemoveExtendsPath(apath); AssetDatabase.Refresh(); } } } HugulaExtensionFolderEditor.SaveSettingData(); }
/// <summary> /// 设置为扩展包路径文件夹 /// /// </summary> public static void SetAsExtendsFloder() { Object[] selection = Selection.objects; string apath = null; foreach (Object s in selection) { if (s is DefaultAsset) { apath = AssetDatabase.GetAssetPath(s); AssetImporter import = AssetImporter.GetAtPath(apath); import.assetBundleName = null; //import.assetBundleVariant = null; import.userData = EditorUtils.HugulaFolder; AssetDatabase.SetLabels(s, new string[] { EditorUtils.HugulaFolder }); import.SaveAndReimport(); if (!HugulaExtensionFolderEditor.ContainsExtendsPath(apath)) { Debug.LogFormat("add extends path = {0}", s.name); HugulaExtensionFolderEditor.AddExtendsPath(apath); } else { Debug.LogFormat("extends path = {0} is already exists", s.name); } AssetDatabase.Refresh(); } } HugulaExtensionFolderEditor.SaveSettingData(); }