LoadAssetBundle() статический защищенный Метод

static protected LoadAssetBundle ( string assetBundleName, bool isLoadingAssetBundleManifest = false ) : void
assetBundleName string
isLoadingAssetBundleManifest bool
Результат void
Пример #1
0
        /// <summary>
        /// ダウンロードサイズ取得
        /// </summary>
        /// <param name="assetBundleManager">アセットバンドルマネージャー</param>
        /// <returns>コルーチン</returns>
        protected IEnumerator DownloadSize(AssetBundleManager assetBundleManager)
        {
            Assert.IsTrue(assetBundleManager.ClearCache());
            assetBundleManager.SetVariants(new[] { "blue" });

            {
                var size = assetBundleManager.GetDownloadSize("AssetBundleShoshaTest/Primitive"
                                                              , "AssetBundleShoshaTest/ColorMaterials"
                                                              , "DeliveryStreamingAssets:AssetBundleShoshaTest/binary"
                                                              );
                Assert.Greater(size, 0);
            }

            {
                var size = assetBundleManager.GetDownloadSize("AssetBundleShoshaTest/Primitive");
                Assert.Greater(size, 0);
                var assetBundle = assetBundleManager.LoadAssetBundle("AssetBundleShoshaTest/Primitive");
                yield return(assetBundle);

                assetBundle.Dispose();
                size = assetBundleManager.GetDownloadSize("AssetBundleShoshaTest/Primitive");
                Assert.AreEqual(0, size);
            }

            {
                var size = assetBundleManager.GetDownloadSize("AssetBundleShoshaTest/ColorMaterials");
                Assert.Greater(size, 0);
                var assetBundle = assetBundleManager.LoadAssetBundle("AssetBundleShoshaTest/ColorMaterials");
                yield return(assetBundle);

                assetBundle.Dispose();
                size = assetBundleManager.GetDownloadSize("AssetBundleShoshaTest/ColorMaterials");
                Assert.AreEqual(0, size);
            }

            {
                var size = assetBundleManager.GetDownloadSize("DeliveryStreamingAssets:AssetBundleShoshaTest/binary");
                Assert.Greater(size, 0);
                var assetBundle = assetBundleManager.LoadAssetBundle("DeliveryStreamingAssets:AssetBundleShoshaTest/binary");
                yield return(assetBundle);

                assetBundle.Dispose();
                size = assetBundleManager.GetDownloadSize("DeliveryStreamingAssets:AssetBundleShoshaTest/binary");
                Assert.AreEqual(0, size);
            }

            var assetBundleNames = new List <string> {
                "AssetBundleShoshaTest/Primitive"
                , "AssetBundleShoshaTest/ColorMaterials"
                , "DeliveryStreamingAssets:AssetBundleShoshaTest/binary"
            };

            Assert.AreEqual(0, assetBundleManager.GetDownloadSize(assetBundleNames));

            assetBundleManager.SetVariants(null);
            yield break;
        }
Пример #2
0
        public void LateTick()
        {
            bool manifestLoaded = loadOperation == null || loadOperation.IsDone();

            if (!manifestLoaded)
            {
                return;
            }

            if (bundlesToLoad.Count == 0)
            {
                tickableManager.RemoveLate(this);
                isInitialized = true;
                OnInitialized(EventArgs.Empty);
                return;
            }

            if (loadingNowBundle != null)
            {
                string error;
                if (AssetBundleManager.GetLoadedAssetBundle(loadingNowBundle, out error) != null)
                {
                    loadingNowBundle = null;
                }
            }

            loadingNowBundle = bundlesToLoad.Dequeue();
            AssetBundleManager.LoadAssetBundle(loadingNowBundle);
        }
Пример #3
0
        /// <summary>
        /// 配信ストリーミングアセット読み込み
        /// </summary>
        /// <param name="assetBundleManager">アセットバンドルマネージャー</param>
        /// <returns>コルーチン</returns>
        protected IEnumerator LoadDeliveryStreamingAssets(AssetBundleManager assetBundleManager)
        {
            var isloaded = false;
            var deliveryStreamingAsset = assetBundleManager.LoadAssetBundle("DeliveryStreamingAssets:AssetBundleShoshaTest/binary", x => isloaded = true);

            Assert.IsTrue(deliveryStreamingAsset != null);
            yield return(deliveryStreamingAsset);

            Assert.IsTrue(isloaded);
            Assert.AreEqual(AssetBundleErrorCode.Null, deliveryStreamingAsset.errorCode);

            var deliveryStreamingAssetPath = deliveryStreamingAsset.deliveryStreamingAssetPath;

            Assert.IsFalse(string.IsNullOrEmpty(deliveryStreamingAssetPath));

            byte[] deliveryStreamingAssetContents = null;
            Assert.DoesNotThrow(() => {
                deliveryStreamingAssetContents = System.IO.File.ReadAllBytes(deliveryStreamingAssetPath);
            });
            Assert.IsTrue(deliveryStreamingAssetContents != null);
            Assert.AreEqual(256, deliveryStreamingAssetContents.Length);
            for (var i = 0; i < 256; ++i)
            {
                Assert.AreEqual(i, deliveryStreamingAssetContents[i]);
            }

            deliveryStreamingAsset.Dispose();

            yield break;
        }
Пример #4
0
	public Object LoadAsset(string assetBundleName, string assetName) {
		AssetBundle assetBundle = AssetBundleManager.LoadAssetBundle(assetBundleName);
		if (assetBundle != null) {
			Object asset = assetBundle.LoadAsset(assetName);
			return asset;
		}
		return null;
	}
Пример #5
0
 protected IEnumerator LoadAB(string url)
 {
     AssetBundleManager.LoadAssetBundle(url);
     sfx_bundle = AssetBundleManager.getAssetBundle(url);
     //Debug.Log("In LoadAB, sfx_bundle = " + sfx_bundle);
     defaultAttackSound = sfx_bundle.LoadAsset <AudioClip>(name);
     //Debug.Log("Default attack sound null? " + defaultAttackSound == null);
     yield return(null);
 }
Пример #6
0
    // Update is called once per frame
    protected override void Start()
    {
        Debug.Log("로그인 타입 : " + ((Constant.LOGIN_TYPE)m_LoginType).ToString());
        Debug.Log("유저 아이디 : " + m_UserID);
        Debug.Log("유저 닉네임 : " + m_UserName);
        Debug.Log("유저 점수   : " + m_UserScore.ToString());

        AssetBundleManager.LoadAssetBundle(AssetManager.Instance._assetBundleKeys[ASSET_TYPE.GAME_CHARACTER]);
    }
Пример #7
0
        /// <summary>
        /// 間接参照系除外アセットバンドル読み込み
        /// </summary>
        /// <param name="assetBundleManager">アセットバンドルマネージャー</param>
        /// <returns>コルーチン</returns>
        protected IEnumerator LoadIndirectExcludeAssetBundle(AssetBundleManager assetBundleManager)
        {
            var isloaded    = false;
            var assetBundle = assetBundleManager.LoadAssetBundle("AssetBundleShoshaTest/IndirectExcludeMaterials", x => isloaded = true);

            Assert.IsTrue(assetBundle != null);
            yield return(assetBundle);

            Assert.IsTrue(isloaded);
            Assert.AreEqual(AssetBundleErrorCode.Null, assetBundle.errorCode);

            Assert.IsTrue(assetBundle.Contains("Exclude"));
            var allAssetNames = assetBundle.GetAllAssetNames();

            Assert.IsTrue(allAssetNames != null);
            Assert.AreEqual(1, allAssetNames.Length);
            Assert.AreEqual("assets/assetbundleshoshatest/materials/indirectexcludematerials/exclude.mat", allAssetNames[0]);
            var allScenePaths = assetBundle.GetAllScenePaths();

            Assert.IsTrue(allScenePaths != null);
            Assert.AreEqual(0, allScenePaths.Length);

            IAssetBundleRequest assetBundleRequest;

            isloaded           = false;
            assetBundleRequest = null;
            Assert.DoesNotThrow(() => {
                assetBundleRequest = assetBundle.LoadAssetAsync <Material>("Exclude");
            });
            Assert.IsTrue(assetBundleRequest != null);
            assetBundleRequest.completed += x => {
                isloaded = true;
            };
            yield return(assetBundleRequest);

            for (var i = 0; i < 2; ++i)
            {
                if (isloaded)
                {
                    break;
                }
                yield return(null);                //コルーチンを抜けてからcompletedが呼ばれる迄に2f掛かる
            }
            Assert.IsTrue(isloaded);
            Assert.IsTrue(assetBundleRequest.asset != null);
            Assert.IsTrue(assetBundleRequest.allAssets != null);
            Assert.AreEqual(1, assetBundleRequest.allAssets.Length);

            var material = (Material)assetBundleRequest.asset;

            Assert.IsTrue(material.mainTexture == null);

            assetBundle.Dispose();

            yield break;
        }
Пример #8
0
        private static void LoadDependencyAssetBundles(string bundleName, AssetBundleManifest asset)
        {
            asset.GetAllDependencies(bundleName).ToList().ForEach(depBundle =>
            {
#if HS2
                AssetBundleManager.LoadAssetBundle(depBundle);
#else
                AssetBundleManager.LoadAssetBundle(depBundle, false);
#endif
            });
        }
Пример #9
0
        /// <summary>
        /// 暗号化アセットバンドル読み込み
        /// </summary>
        /// <param name="assetBundleManager">アセットバンドルマネージャー</param>
        /// <returns>コルーチン</returns>
        protected IEnumerator LoadCryptoAssetBundle(AssetBundleManager assetBundleManager)
        {
            var isloaded    = false;
            var assetBundle = assetBundleManager.LoadAssetBundle("AssetBundleShoshaTest/CryptoAssetBundle", x => isloaded = true);

            Assert.IsTrue(assetBundle != null);
            yield return(assetBundle);

            Assert.IsTrue(isloaded);
            Assert.AreEqual(AssetBundleErrorCode.Null, assetBundle.errorCode);

            Assert.IsTrue(assetBundle.mainAsset == null);
            Assert.IsTrue(assetBundle.Contains("CryptoAssetBundle"));
            var allAssetNames = assetBundle.GetAllAssetNames();

            Assert.IsTrue(allAssetNames != null);
            Assert.AreEqual(1, allAssetNames.Length);
            Assert.AreEqual("assets/assetbundleshoshatest/textures/cryptoassetbundle.png", allAssetNames[0]);
            var allScenePaths = assetBundle.GetAllScenePaths();

            Assert.IsTrue(allScenePaths != null);
            Assert.AreEqual(0, allScenePaths.Length);

            IAssetBundleRequest assetBundleRequest;

            isloaded           = false;
            assetBundleRequest = null;
            Assert.DoesNotThrow(() => {
                assetBundleRequest = assetBundle.LoadAllAssetsAsync <Texture>();
            });
            Assert.IsTrue(assetBundleRequest != null);
            assetBundleRequest.completed += x => {
                isloaded = true;
            };
            yield return(assetBundleRequest);

            for (var i = 0; i < 2; ++i)
            {
                if (isloaded)
                {
                    break;
                }
                yield return(null);                //コルーチンを抜けてからcompletedが呼ばれる迄に2f掛かる
            }
            Assert.IsTrue(isloaded);
            Assert.IsTrue(assetBundleRequest.asset != null);
            Assert.IsTrue(assetBundleRequest.allAssets != null);
            Assert.AreEqual(1, assetBundleRequest.allAssets.Length);

            assetBundle.Dispose();

            yield break;
        }
Пример #10
0
    protected IEnumerator InstantiateGameObjectAsync(List <string> assetBundleNameList, bool loadingBar = true)
    {
        int totalProgress = assetBundleNameList.Count * 100;
        int completeCount = 0;
        int nowProgress   = 0;
        int rate          = 0;

        if (loadingBar)
        {
            LoadingManager.Instance.Open();
            LoadingManager.Instance.SetDownloadBar(rate);
            yield return(new WaitForSeconds(0.5f));
        }

        foreach (string name in assetBundleNameList)
        {
            AssetBundleManager.LoadAssetBundle(name);
            for (;;)
            {
                if (AssetBundleManager.m_DownloadingWWWs.ContainsKey(name))
                {
                    //ダウンロード中
                    nowProgress = (int)(AssetBundleManager.m_DownloadingWWWs[name].progress * 100);
                    rate        = (completeCount * 100 + nowProgress) * 100 / totalProgress;
                    if (loadingBar)
                    {
                        LoadingManager.Instance.SetDownloadBar(rate);
                    }
                }
                else
                {
                    //ダウンロード完了
                    completeCount++;
                    rate = (completeCount * 100) * 100 / totalProgress;
                    if (loadingBar)
                    {
                        LoadingManager.Instance.SetDownloadBar(rate);
                    }
                    nowProgress = 0;
                    break;
                }
                yield return(null);
            }
        }

        if (loadingBar)
        {
            yield return(new WaitForSeconds(0.5f));

            LoadingManager.Instance.Close();
        }
    }
Пример #11
0
        /// <summary>
        /// アセットバンドル読み込みエラー(カスタム)
        /// </summary>
        /// <param name="assetBundleManager">アセットバンドルマネージャー</param>
        /// <returns>コルーチン</returns>
        protected IEnumerator CustomErrorAssetBundle(AssetBundleManager assetBundleManager)
        {
            IErrorHandler errorHandlerOld = assetBundleManager.errorHandler;
            IErrorHandle  errorHandleCommon;

            assetBundleManager.errorHandler = new ErrorAction(x => errorHandleCommon = x);

            try {
                errorHandleCommon = null;
                var          isloaded    = false;
                var          assetBundle = assetBundleManager.LoadAssetBundle("AssetBundleShoshaTest/MissingAssetBundle", x => isloaded = true);
                IErrorHandle errorHandle = null;
                assetBundle.errorHandler = new ErrorAction(x => errorHandle = x);
                Assert.IsTrue(assetBundle != null);
                while (!assetBundle.isDone)
                {
                    if (errorHandle != null)
                    {
                        break;
                    }
                    if (errorHandleCommon != null)
                    {
                        break;
                    }
                    yield return(null);
                }
                Assert.IsFalse(assetBundle.isDone);
                Assert.IsFalse(isloaded);
                Assert.IsTrue(errorHandle != null);
                Assert.IsTrue(errorHandleCommon == null);
                errorHandle.Ignore();
                while (!assetBundle.isDone)
                {
                    yield return(null);
                }
                Assert.IsTrue(assetBundle.isDone);
                Assert.IsTrue(isloaded);
                Assert.Throws <System.NullReferenceException>(() => {
                    assetBundle.LoadAllAssets();
                });
                Assert.Throws <System.NullReferenceException>(() => {
                    assetBundle.LoadAllAssetsAsync();
                });

                assetBundle.Dispose();
            } finally {
                assetBundleManager.errorHandler = errorHandlerOld;
            }

            yield break;
        }
 // Use this for initialization
 void Start()
 {
     // アセットバンドルマネージャーインスタンス取得
     bundleMng = AssetBundleManager.Instance;
     // キャッシュから読み込み
     string[] bundleNames = { "unitychan_std", "unitychan_crs", "unitychan_baseassets" };
     bundleMng.LoadAssetBundle (bundleNames, ((bool isSuccess, string error) => {
         if (isSuccess) {
             isButtonEnabled = true;
             Debug.Log("ロード成功");
         }
         else {
             Debug.Log("ロード失敗 : "+error);
         }
     }));
 }
Пример #13
0
        /// <summary>
        /// 依存アセットバンドル読み込み
        /// </summary>
        /// <param name="assetBundleManager">アセットバンドルマネージャー</param>
        /// <returns>コルーチン</returns>
        protected IEnumerator LoadDependenciesAssetBundle(AssetBundleManager assetBundleManager)
        {
            assetBundleManager.SetVariants(new[] { "blue" });

            try {
                var isloaded    = false;
                var assetBundle = assetBundleManager.LoadAssetBundle("AssetBundleShoshaTest/ColorMaterials", x => isloaded = true);
                Assert.IsTrue(assetBundle != null);
                yield return(assetBundle);

                Assert.IsTrue(isloaded);
                Assert.AreEqual(AssetBundleErrorCode.Null, assetBundle.errorCode);

                IAssetBundleRequest assetBundleRequest;

                isloaded           = false;
                assetBundleRequest = null;
                Assert.DoesNotThrow(() => {
                    assetBundleRequest = assetBundle.LoadAssetAsync <Material>("Circle");
                });
                Assert.IsTrue(assetBundleRequest != null);
                assetBundleRequest.completed += x => isloaded = true;
                yield return(assetBundleRequest);

                for (var i = 0; i < 2; ++i)
                {
                    if (isloaded)
                    {
                        break;
                    }
                    yield return(null);                    //コルーチンを抜けてからcompletedが呼ばれる迄に2f掛かる
                }
                Assert.IsTrue(isloaded);
                Assert.IsTrue(assetBundleRequest.asset != null);
                Assert.IsTrue(assetBundleRequest.allAssets != null);
                Assert.AreEqual(1, assetBundleRequest.allAssets.Length);
                var material = (Material)assetBundleRequest.asset;
                Assert.IsTrue(material != null);
                Assert.IsTrue(material.mainTexture != null);

                assetBundle.Dispose();
            } finally {
                assetBundleManager.SetVariants(null);
            }

            yield break;
        }
Пример #14
0
 // Use this for initialization
 void Start()
 {
     // アセットバンドルマネージャーインスタンス取得
     // キャッシュから読み込み
     string[] bundleNames = { "unitychan_std", "unitychan_crs", "unitychan_baseassets" };
     AssetBundleManager.LoadAssetBundle(bundleNames, ((bool isSuccess, string error) => {
         if (isSuccess)
         {
             isButtonEnabled = true;
             Debug.Log("ロード成功");
         }
         else
         {
             Debug.Log("ロード失敗 : " + error);
         }
     }));
 }
Пример #15
0
        /// <summary>
        /// 配信ストリーミングアセット読み込みエラー(カスタム)
        /// </summary>
        /// <param name="assetBundleManager">アセットバンドルマネージャー</param>
        /// <returns>コルーチン</returns>
        protected IEnumerator CustomErrorDeliveryStreamingAssets(AssetBundleManager assetBundleManager)
        {
            IErrorHandler errorHandlerOld = assetBundleManager.errorHandler;
            IErrorHandle  errorHandleCommon;

            assetBundleManager.errorHandler = new ErrorAction(x => errorHandleCommon = x);

            try {
                errorHandleCommon = null;
                var          isloaded    = false;
                var          assetBundle = assetBundleManager.LoadAssetBundle("DeliveryStreamingAssets:AssetBundleShoshaTest/MissingDeliveryStreamingAssets", x => isloaded = true);
                IErrorHandle errorHandle = null;
                assetBundle.errorHandler = new ErrorAction(x => errorHandle = x);
                Assert.IsTrue(assetBundle != null);
                while (!assetBundle.isDone)
                {
                    if (errorHandle != null)
                    {
                        break;
                    }
                    if (errorHandleCommon != null)
                    {
                        break;
                    }
                    yield return(null);
                }
                Assert.IsFalse(assetBundle.isDone);
                Assert.IsFalse(isloaded);
                Assert.IsTrue(errorHandle != null);
                Assert.IsTrue(errorHandleCommon == null);
                errorHandle.Ignore();
                while (!assetBundle.isDone)
                {
                    yield return(null);
                }
                Assert.IsTrue(assetBundle.isDone);
                Assert.IsTrue(isloaded);
                Assert.IsTrue(string.IsNullOrEmpty(assetBundle.deliveryStreamingAssetPath));

                assetBundle.Dispose();
            } finally {
                assetBundleManager.errorHandler = errorHandlerOld;
            }

            yield break;
        }
Пример #16
0
        /// <summary>
        /// 直接参照系除外アセットバンドル読み込み
        /// </summary>
        /// <param name="assetBundleManager">アセットバンドルマネージャー</param>
        /// <returns>コルーチン</returns>
        protected IEnumerator LoadDirectExcludeAssetBundle(AssetBundleManager assetBundleManager)
        {
            var downloadTimeoutSecondsOld = assetBundleManager.downloadTimeoutSeconds;

            assetBundleManager.downloadTimeoutSeconds = 4;

            var isloaded = false;
            AssetBundleErrorCode?errorCode = null;
            var assetBundle = assetBundleManager.LoadAssetBundle("AssetBundleShoshaTest/ExcldeMatrials", x => isloaded = true);

            assetBundle.errorHandler = new ErrorAction(x => errorCode = x.errorCode);
            Assert.IsTrue(assetBundle != null);
            yield return(assetBundle);

            Assert.IsTrue(isloaded);
            Assert.IsTrue(errorCode.HasValue);
            Assert.AreNotEqual(AssetBundleErrorCode.Null, assetBundle.errorCode);

            assetBundle.Dispose();

            yield break;
        }
Пример #17
0
        static int _m_LoadAssetBundle(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                AssetBundleManager gen_to_be_invoked = (AssetBundleManager)translator.FastGetCSObj(L, 1);



                {
                    string _assetBundleName = LuaAPI.lua_tostring(L, 2);

                    gen_to_be_invoked.LoadAssetBundle(_assetBundleName);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Пример #18
0
    IEnumerator Start()
    {
        AssetBundleManager abManager = AssetBundleManager.Curr;

        // load info
        for (int i = 0; i < _info.Count; i++)
        {
            string key = _info [i];
            abManager.UpdateAssetBundleInfo(key, new AssetBundleInfo("/AssetBundles/Bundles/" + key, ""), false);
            yield return(abManager.LoadAssetBundle(key));
        }


        if (CurrKey == "perfab")
        {
            AssetBundleRequest abRequst = abManager.GetAssetBundle(CurrKey).LoadAssetAsync <GameObject> (CurrKey);
            yield return(abRequst);

            GameObject go = Instantiate(abRequst.asset) as GameObject;
            go.transform.SetParent(GameObject.FindObjectOfType <Canvas>().transform);
            go.transform.localPosition = Vector3.zero;
        }
    }
Пример #19
0
        static int _m_LoadAssetBundle(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            AssetBundleManager __cl_gen_to_be_invoked = (AssetBundleManager)translator.FastGetCSObj(L, 1);


            try {
                {
                    string       sceneName  = LuaAPI.lua_tostring(L, 2);
                    string       folderName = LuaAPI.lua_tostring(L, 3);
                    LoadProgress lp         = translator.GetDelegate <LoadProgress>(L, 4);

                    __cl_gen_to_be_invoked.LoadAssetBundle(sceneName, folderName, lp);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Пример #20
0
        private IEnumerator StartUpMgrs()
        {
            // start up StateMgr
            yield return(YieldFactory.GetWaitForEndOfFrame());

            GStateManager.Instance.ForceStateInfo(_stateInfo);

            // warmup shaders inside /Resources/Shaders/ (do this once)
            Shader.WarmupAllShaders();

            // ensure the rest are setup
            yield return(YieldFactory.GetWaitForEndOfFrame());

            GCore.Instance.EnsureMgrsAreSetup();

            while (!GCore.Instance.IsInitialized)
            {
                yield return(YieldFactory.GetWaitForEndOfFrame());
            }

            // play music
            //GSoundMgr.Instance.PlayMusic("commonMusic");

#if ENABLE_ASSET_BUNDLES
#if SMRJ_HACK
            AssetBundleManager.SetDevelopmentAssetBundleServer();
#else
            // LIVE URL
            if (GCore.Wrapper.Client.AppId == "30015")
            {
                AssetBundleManager.SetSourceAssetBundleURL(ASSET_BUNDLE_URL_LIVE);
            }
            // TEST URL
            else
            {
                AssetBundleManager.SetSourceAssetBundleURL(ASSET_BUNDLE_URL);
            }
#endif

#if UNITY_EDITOR
            if (!AssetBundleManager.SimulateAssetBundleInEditor)
#endif
            {
                AssetBundleLoadManifestOperation request = AssetBundles.AssetBundleManager.Initialize();
                if (request != null)
                {
                    yield return(StartCoroutine(request));
                }

                while (AssetBundleManager.AssetBundleManifestObject == null)
                {
                    yield return(YieldFactory.GetWaitForEndOfFrame());
                }
            }

            AssetBundleManager.LoadAssetBundle("eggiesslotstate");
            while (AssetBundleManager.IsDownloadingBundles())
            {
                GStateManager.Instance.ForcedUpdatedLoadingAssetBundle();
                yield return(YieldFactory.GetWaitForEndOfFrame());
            }
            GStateManager.Instance.EnableLoadingScreen(false);
#endif

            yield return(StartCoroutine(loadCommonSounds()));

            yield return(YieldFactory.GetWaitForEndOfFrame());
        }
Пример #21
0
    static public IEnumerator LoadTextAssets()
    {
        s_dicTextAsset.Clear();


        if (AssetBundleManager.SimulateAssetBundleInEditor == true)
        {
            string[] arrSettingData = AssetDatabase.GetAssetPathsFromAssetBundle("setting_data");
            if (arrSettingData == null)
            {
                yield break;
            }

            string stringData = string.Empty;
            for (int i = 0; i < arrSettingData.Length; ++i)
            {
                stringData = Path.GetFileName(arrSettingData[i]);
                stringData = stringData.Replace(".json", "");
                TextAsset assetData = AssetDatabase.LoadAssetAtPath <TextAsset>(arrSettingData[i]);
                s_dicTextAsset.Add(stringData, assetData.text);
            }

            yield break;
        }



        {
            while (AssetBundleManager.AssetBundleManifestObject == null)
            {
                yield return(new WaitForSeconds(1f));
            }


            AssetBundleManager.LoadAssetBundle("setting_data");


            string strError = string.Empty;


            LoadedAssetBundle loadBundle = AssetBundleManager.GetLoadedAssetBundle("setting_data", out strError);
            while (loadBundle == null)
            {
                yield return(new WaitForSeconds(0.1f));

                loadBundle = AssetBundleManager.GetLoadedAssetBundle("setting_data", out strError);
            }


            string[] strAssetData = loadBundle.m_AssetBundle.GetAllAssetNames();

            if (strAssetData != null)
            {
                string stringData = string.Empty;
                for (int i = 0; i < strAssetData.Length; ++i)
                {
                    stringData = Path.GetFileName(strAssetData[i]);
                    stringData = stringData.Replace(".json", "");
                    stringData = stringData.ToUpper();

                    AssetBundleLoadAssetOperation operation = AssetBundleManager.LoadAssetAsync("setting_data", stringData, typeof(TextAsset));
                    if (operation != null)
                    {
                        while (operation.IsDone() == false)
                        {
                            yield return(new WaitForEndOfFrame());
                        }

                        TextAsset assetData = operation.GetAsset <TextAsset>();
                        s_dicTextAsset.Add(stringData, assetData.text);
                    }

                    AssetBundleManager.UnloadAssetBundle("setting_data");
                }
            }
        }
    }