Exemple #1
0
        /// <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();
        }
Exemple #2
0
        /// <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();
        }
Exemple #3
0
        /// <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();
        }
Exemple #4
0
        public static void AddOnlyInclusionFilesByTxt()
        {
            Object[] selection = Selection.objects;

            foreach (Object s in selection)
            {
                if (s is TextAsset)
                {
                    string   txt = ((TextAsset)s).text;
                    string[] sps = txt.Split('\n');
                    Debug.Log(s);
                    foreach (var str in sps)
                    {
                        if (!string.IsNullOrEmpty(str.Trim()))
                        {
                            HugulaExtensionFolderEditor.AddOnlyInclusionFiles(str.Trim());
                        }
                    }
                }
            }

            HugulaExtensionFolderEditor.SaveSettingData();
        }
Exemple #5
0
        /// <summary>
        /// 从选中的txt排除extension Files
        /// </summary>
        public static void ExcludeExtensionFiles()
        {
            Object[]      selection = Selection.objects;
            List <string> excludes  = new List <string>();

            foreach (Object s in selection)
            {
                if (s is TextAsset)
                {
                    excludes.Clear();
                    string   txt = ((TextAsset)s).text;
                    string[] sps = txt.Split('\n');
                    Debug.Log(s);
                    foreach (var str in sps)
                    {
                        excludes.Add(str.Trim().Split(' ')[0]);
                    }
                    HugulaExtensionFolderEditor.RemoveExtendsFiles(excludes);
                    Debug.LogFormat("delete: {0}\r\n {1}", s.name, txt);
                }
            }

            HugulaExtensionFolderEditor.SaveSettingData();
        }
Exemple #6
0
 //获取label
 static public string GetLabelsByPath(string abPath)
 {
     return(HugulaExtensionFolderEditor.GetLabelsByPath(abPath));
 }