コード例 #1
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="path"></param>
        /// <param name="onInitEnd"></param>
        public void Init(string path, Action onInitEnd)
        {
            //多热更切换,需要卸载
            if (this.loder != null)
            {
                this.UnloadAllAsset();
                GC.Collect();
            }

            this.AssetbundleMap   = new Dictionary <string, AssetBundleWapper>();
            this.allTaskGroupList = new List <LoaderTaskGroup>();
            //1.设置加载路径
            artRootPath    = (path + "/" + BApplication.GetPlatformPath(Application.platform) + "/Art").Replace("\\", "/");
            secArtRootPath = (Application.streamingAssetsPath + "/" +
                              BApplication.GetPlatformPath(Application.platform) + "/Art")
                             .Replace("\\", "/");
            //
            string configPath = FindAsset("Config.json");

            BDebug.Log("AssetBundle Version: V2", "red");
            BDebug.Log("Art加载路径:" + configPath, "red");
            //
            this.loder = new ManifestLoder();
            this.loder.Load(configPath, onInitEnd);
        }
コード例 #2
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="path"></param>
        public void Init(string path)
        {
            //多热更切换,需要卸载
            if (this.loder != null)
            {
                this.UnloadAllAsset();
            }

            this.AssetbundleMap   = new Dictionary <string, AssetBundleWapper>(StringComparer.OrdinalIgnoreCase);
            this.allTaskGroupList = new List <LoaderTaskGroup>();
            var platformPath = BDApplication.GetPlatformPath(Application.platform);

            //1.设置加载路径
            firstArtDirectory =
                ZString.Format("{0}/{1}/Art", path, platformPath);
            //当路径为persistent时,第二路径生效
            secArtDirectory = ZString.Format("{0}/{1}/Art", Application.streamingAssetsPath,
                                             platformPath); //


            //路径替换
            switch (Application.platform)
            {
            case RuntimePlatform.OSXEditor:
            case RuntimePlatform.OSXPlayer:
            case RuntimePlatform.WindowsEditor:
            case RuntimePlatform.WindowsPlayer:
            {
                firstArtDirectory = firstArtDirectory.Replace("\\", "/");
                secArtDirectory   = secArtDirectory.Replace("\\", "/");
            }
            break;
            }


            //加载Config
            var artconfigPath = "";

            this.loder = new ManifestLoder();
            if (Application.isEditor)
            {
                artconfigPath = ZString.Format("{0}/{1}/{2}", path, platformPath, BResources.ART_CONFIG_PATH);
            }
            else
            {
                //真机环境config在persistent,跟dll和db保持一致
                artconfigPath = ZString.Format("{0}/{1}/{2}", Application.persistentDataPath, platformPath,
                                               BResources.ART_CONFIG_PATH);
            }

            this.loder.Load(artconfigPath);
        }
コード例 #3
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="path"></param>
        public void Init(string path)
        {
            //多热更切换,需要卸载
            if (this.loder != null)
            {
                this.UnloadAllAsset();
                GC.Collect();
            }

            this.AssetbundleMap   = new Dictionary <string, AssetBundleWapper>();
            this.allTaskGroupList = new List <LoaderTaskGroup>();
            //1.设置加载路径
            firstArtDirectory = string.Format("{0}/{1}/Art", path, BDApplication.GetPlatformPath(Application.platform))
                                .Replace("\\", "/");
            //当路径为persistent时,第二路径生效
            secArtDirectory = string.Format("{0}/{1}/Art", Application.streamingAssetsPath,
                                            BDApplication.GetPlatformPath(Application.platform)) //
                              .Replace("\\", "/");

            //加载Config
            var configPath = "";

            this.loder = new ManifestLoder();
            if (Application.isEditor)
            {
                configPath = string.Format("{0}/{1}/{2}", path, BDApplication.GetPlatformPath(Application.platform),
                                           BResources.CONFIGPATH);
            }
            else
            {
                //真机环境config在persistent,跟dll和db保持一致
                configPath = string.Format("{0}/{1}/{2}", Application.persistentDataPath,
                                           BDApplication.GetPlatformPath(Application.platform), BResources.CONFIGPATH);
            }

            this.loder.Load(configPath);
        }