Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 3
0
        public static void ZipFiles(bool delete = false)
        {
            Object[] selection = Selection.objects;
            string   abName    = "";
            string   apath     = "";

            List <string> abNames = new List <string>();

            foreach (Object s in selection)
            {
                abName = GetOriginalAssetBundleName(s, out apath);
                if (!HugulaExtensionFolderEditor.ContainsExtendsPath(apath))
                {
                    abNames.Add(abName);
                }
                else
                {
                    Debug.LogFormat("assetPath({0}) can't add to zip file list ", abName);
                }
            }

            if (abNames.Count > 0 && delete)
            {
                HugulaExtensionFolderEditor.RemoveZipFile(abNames);
            }
            else if (abNames.Count > 0)
            {
                HugulaExtensionFolderEditor.AddZipFile(abNames);
            }
        }
Exemplo n.º 4
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();
        }
Exemplo n.º 5
0
        /// <summary>
        /// 添加为扩展文件
        /// </summary>
        public static void ExtensionFiles(bool delete = false)
        {
            Object[] selection = Selection.objects;
            string   abName    = "";
            string   apath     = "";

            foreach (Object s in selection)
            {
                abName = GetOriginalAssetBundleName(s, out apath);
                // Debug.LogFormat("ExtensionFiles name={0},path={1}",abName,apath);
                if (delete)
                {
                    HugulaExtensionFolderEditor.RemoveExtendsFile(abName);
                }
                else if (!HugulaExtensionFolderEditor.ContainsExtendsPath(apath))
                {
                    HugulaExtensionFolderEditor.AddExtendsFile(abName);
                }
                else
                {
                    Debug.LogFormat("assetPath({0}) can't add to extends file list  ", abName);
                }
            }
        }