Пример #1
0
        //[MenuItem("MXFramework/AssetBundle/Set AssetBundle Label", false, 201)]
        public static void SetAbLabel()
        {
            string abFolder = AssetDefine.GetABResourcePath();

            if (!Directory.Exists(abFolder))
            {
                Directory.CreateDirectory(abFolder);
            }

            FileInfo[] files = DirectoryEx.GetFiles(abFolder, Filter);
            foreach (FileInfo fileInfo in files)
            {
                SetFileABLabel(fileInfo);
            }

            //清空无用AB标记
            AssetDatabase.RemoveUnusedAssetBundleNames();
            AssetDatabase.Refresh();//刷新
            Debug.Log("自动设置标志完成!");
        }
Пример #2
0
        /// <summary>
        /// 自动设置标记
        /// </summary>
        //[MenuItem("MXFramework/AssetBundle/Set AssetBundle Label",false,0)]
        public static void SetAbLabel()
        {
            //需要打包AssetBunld的跟目录
            //string strNeedSetLabelRoot = Application.dataPath + "/Res/AbRes";

            string strNeedSetLabelRoot = AssetDefine.GetABResourcePath();

            //如果打包路径不存在者创建
            if (!Directory.Exists(strNeedSetLabelRoot))
            {
                Directory.CreateDirectory(strNeedSetLabelRoot);
            }

            //目录信息(场景中的目录信息数组)
            DirectoryInfo[] dirScenesDIRArr = null;

            DirectoryInfo dirTempInfo = new DirectoryInfo(strNeedSetLabelRoot);

            dirScenesDIRArr = dirTempInfo.GetDirectories();

            foreach (DirectoryInfo currentDIR in dirScenesDIRArr)
            {
                string tempScenesDIR = strNeedSetLabelRoot + "/" + currentDIR.Name;
                //DirectoryInfo tempScenesDIRInfo = new DirectoryInfo(tempScenesDIR);

                int    tempIndex     = tempScenesDIR.LastIndexOf("/");
                string tmpScenesName = tempScenesDIR.Substring(tempIndex + 1);

                JudgeDIRorFileBuyRecursive(currentDIR, tmpScenesName);
            }

            //清空无用AB标记
            AssetDatabase.RemoveUnusedAssetBundleNames();

            AssetDatabase.Refresh();//刷新

            Debug.Log("自动设置标志完成!");
        }
Пример #3
0
        /// <summary>获取Ab包名</summary>
        private static string GetABName(FileInfo fileInfoObj)
        {
            string strABName    = string.Empty;
            string strABPath    = fileInfoObj.FullName.Replace(fileInfoObj.Extension, null).Replace(AssetDefine.GetABResourcePath(), null);
            string tmpUnityPath = strABPath.Replace("\\", "/");

            string[] strAbPathArr = tmpUnityPath.Split('/');

            if (strAbPathArr.Length < 3)
            {
                strABName = strAbPathArr[1] + "/" + strAbPathArr[1];
            }
            else
            {
                strABName = strAbPathArr[1] + "/" + strAbPathArr[2];
            }

            return(strABName);
        }