Esempio n. 1
0
        /*
         *      Initializer
         */
        private void InitializeAssetBundleFeature()
        {
            // initialize AssetBundleListDownloader.
            AssetBundleListDownloader.HttpResponseHandlingDelegate httpResponseHandlingDel = (p1, p2, p3, p4, p5, p6, p7) => {
                httpResponseHandlingDelegate(p1, p2, p3, p4, p5, p6, p7);
            };
            AssetBundleListDownloader.AssetBundleListGetRequestHeaderDelegate assetBundleGetRequestHeaderDel = (p1, p2) => {
                return(assetBundleListGetRequestHeaderDelegate(p1, p2));
            };

            _assetBundleListDownloader = new AssetBundleListDownloader(assetBundleGetRequestHeaderDel, httpResponseHandlingDel);

            // check if assetBundleList are stored.
            var listCandidate = LoadAssetBundleListFromStorage();

            if (!listCandidate.Exists())
            {
                // no list stored.
                assetBundleFeatState = AssetBundlesFeatureState.None;
                return;
            }

            _currentAssetBundleList = listCandidate;
            assetBundleFeatState    = AssetBundlesFeatureState.Ready;
            ReadyLoaderAndPreloader();
        }
        /*
			Initializer
		 */
        private void InitializeAssetBundleFeature()
        {
            // initialize AssetBundleListDownloader.
            AssetBundleListDownloader.HttpResponseHandlingDelegate httpResponseHandlingDel = (p1, p2, p3, p4, p5, p6, p7) =>
            {
                httpResponseHandlingDelegate(p1, p2, p3, p4, p5, p6, p7);
            };
            AssetBundleListDownloader.AssetBundleListGetRequestHeaderDelegate assetBundleGetRequestHeaderDel = (p1, p2) =>
            {
                return assetBundleListGetRequestHeaderDelegate(p1, p2);
            };

            /*
                by default, only list downloader is ready on boot in AssetBundles feature.
             */
            _assetBundleListDownloader = new AssetBundleListDownloader(assetBundleGetRequestHeaderDel, httpResponseHandlingDel);

            // check if assetBundleList are stored.
            var storedLists = LoadAssetBundleListsFromStorage();
            var storedListIdentities = storedLists.Select(list => list.identity).ToArray();

            // get assetBundleList identitiy from manifest info.
            var runtimeManifestContaindAssetBundleListIdentities = LoadAppUsingAssetBundleListIdentities();


            // 取得失敗などでmanifestの内容の方が多いことがあり得る。差を取り出し、DLが必要な状態かどうか判断する。
            var excepts = runtimeManifestContaindAssetBundleListIdentities.Except(storedListIdentities);

            // not all assetBundleList are stored yet.
            // need to run AssetBundle_DownloadAssetBundleListsIfNeed().
            if (excepts.Any())
            {
                assetBundleFeatState = AssetBundlesFeatureState.None;
                return;
            }

            // all assetBundleList is stored and ready.
            foreach (var listCandidate in storedLists)
            {
                ReadyLoaderAndPreloader(listCandidate);
            }
            assetBundleFeatState = AssetBundlesFeatureState.Ready;
        }
        /*
         *              Initializer
         */
        private IEnumerator InitializeAssetBundleFeature()
        {
            this.assetBundleListGetRequestHeaderDelegate        = OnAssetBundleListGetRequest;
            this.assetBundlePreloadListGetRequestHeaderDelegate = OnAssetBundlePreloadListGetRequest;
            this.assetBundleGetRequestHeaderDelegate            = OnAssetBundleGetRequest;

            // initialize AssetBundleListDownloader.
            AssetBundleListDownloader.HttpResponseHandlingDelegate httpResponseHandlingDel = (p1, p2, p3, p4, p5, p6, p7) =>
            {
                httpResponseHandlingDelegate(p1, p2, p3, p4, p5, p6, p7);
            };
            AssetBundleListDownloader.AssetBundleListGetRequestHeaderDelegate assetBundleGetRequestHeaderDel = (p1, p2) =>
            {
                return(assetBundleListGetRequestHeaderDelegate(p1, p2));
            };

            /*
             *  by default, only list downloader is ready on boot in AssetBundles feature.
             */
            _assetBundleListDownloader = new AssetBundleListDownloader(assetBundleGetRequestHeaderDel, httpResponseHandlingDel);

            // check if assetBundleList are stored.
            var storedLists          = LoadAssetBundleListsFromStorage();
            var storedListIdentities = storedLists.Select(list => list.identity).ToArray();

            // get assetBundleList identitiy from manifest info.
            var runtimeManifestContaindAssetBundleListIdentities = LoadAppUsingAssetBundleListIdentities();

            // remove unnecessary stored ABList if runtimeManifest is changed and ABListInfo is removed.
            {
                var storedMinusManifest = storedListIdentities.Except(runtimeManifestContaindAssetBundleListIdentities);

                if (storedMinusManifest.Any())
                {
                    OnRemoveUnnecessaryAssetBundleListsFromStorage(storedMinusManifest.ToArray());

                    // renew stored list identities.
                    storedLists          = LoadAssetBundleListsFromStorage();
                    storedListIdentities = storedLists.Select(list => list.identity).ToArray();
                }
            }

            // check stored ABList. if less than required by RuntimeManifest, need to download additional ABList.
            {
                var manifestMinusStored = runtimeManifestContaindAssetBundleListIdentities.Except(storedListIdentities);

                // not all assetBundleList are stored yet.
                // need to run AssetBundle_DownloadAssetBundleListsIfNeed().
                if (manifestMinusStored.Any())
                {
                    assetBundleFeatState = AssetBundlesFeatureState.None;
                    yield break;
                }
            }

            // all assetBundleList is stored and ready.
            foreach (var listCandidate in storedLists)
            {
                ReadyLoaderAndPreloader(listCandidate);
            }
            assetBundleFeatState = AssetBundlesFeatureState.Ready;
        }