Esempio n. 1
0
    public IEnumerator downloadReplaceAssetbundle(AssetBundlerMultiplier multiplier)
    {
#if TEST_LOCAL_ASSETBUNDLE
        multiplier = null;
#endif //TEST_LOCAL_ASSETBUNDLE

        // ここではダウンロードするだけ
        if (multiplier != null)
        {
            MasterDataQuestAppearance[] quest_appearances = MasterFinder <MasterDataQuestAppearance> .Instance.GetAll();

            for (int idx = 0; idx < quest_appearances.Length; idx++)
            {
                MasterDataQuestAppearance quest_appearance = quest_appearances[idx];

                MasterDataAssetBundlePath assetbundle_path = MasterFinder <MasterDataAssetBundlePath> .Instance.Find((int)quest_appearance.asset_bundle_id);

                if (assetbundle_path != null)
                {
                    multiplier.Add(
                        AssetBundler.Create().Set(assetbundle_path.name, (result) =>
                    {
#if BUILD_TYPE_DEBUG
                        if (result.AssetBundle != null)
                        {
                            Debug.Log("ReplaseAssetManager:asset download success:" + result.AssetBundle.name);
                        }
#endif //BUILD_TYPE_DEBUG
                    }
                                                  , null
                                                  )
                        );
                }
            }
        }

        yield return(null);
    }
Esempio n. 2
0
    private IEnumerator loadReplaceAssetInfo()
    {
        // 差し替え情報を探す
        MasterDataQuestAppearance[] quest_appearances = MasterFinder <MasterDataQuestAppearance> .Instance.GetAll();

        MasterDataQuestAppearance quest_appearance = null;

        if (m_AreaCategoryID > 0)
        {
            for (int idx = 0; idx < quest_appearances.Length; idx++)
            {
                MasterDataQuestAppearance wrk_quest_appearance = quest_appearances[idx];

                if (wrk_quest_appearance.area_category_id == m_AreaCategoryID)
                {
                    quest_appearance = wrk_quest_appearance;
                    break;
                }
            }
        }

        bool is_finish_download = false;

#if !TEST_LOCAL_ASSETBUNDLE
        // 差し替え情報を元にアセットバンドルをダウンロード
        if (quest_appearance != null)
        {
            MasterDataAssetBundlePath assetbundle_path = MasterFinder <MasterDataAssetBundlePath> .Instance.Find((int)quest_appearance.asset_bundle_id);

            if (assetbundle_path != null)
            {
                AssetBundler.Create().Set(assetbundle_path.name, (result) =>
                {
                    if (result.AssetBundle != null)
                    {
                        m_ReplaceAssetReference = ReplaceAssetReference.getReplaceAssetReference(result.AssetBundle, m_TimingType);
                    }

                    is_finish_download = true;
                },
                                          (o) =>
                {
                    is_finish_download = true;
                }
                                          ).Load();
            }
            else
            {
                is_finish_download = true;
            }
        }
        else
        {
            is_finish_download = true;
        }
#else //TEST_LOCAL_ASSETBUNDLE
        // StreamingAssetsフォルダ内のデータでテスト
        WWW www = debug_LoadLocalAssetBundle("kensyou");
        while (www.isDone == false)
        {
            yield return(null);
        }

        m_AssetBundle = www.assetBundle;
        if (m_AssetBundle != null)
        {
            m_ReplaceAssetReference = ReplaceAssetReference.getReplaceAssetReference(m_AssetBundle, m_TimingType);
            //m_AssetBundle.Unload(false);
        }
        is_finish_download = true;
#endif //TEST_LOCAL_ASSETBUNDLE

        SceneObjReferGameMainEffect effect_assign = null;
        if (m_IsUseEffect)
        {
            GameObject effect_prefab = Resources.Load <GameObject>("Prefab/BattleScene/InGameEffectPrefab");
            GameObject effect_obj    = Instantiate(effect_prefab); // effect_prefabのコンポーネントを書き換えると以前に書き換えた情報が残っているので別オブジェクトを一回生成
            effect_assign = effect_obj.GetComponent <SceneObjReferGameMainEffect>();
        }

        while (is_finish_download == false)
        {
            yield return(null);
        }

        if (m_ReplaceAssetReference != null)
        {
            // エフェクトを差し替え
            if (m_IsUseEffect)
            {
                replaceEffect(ref effect_assign);
            }

            // SEを差し替え
            replaceSound();
        }

        if (m_IsUseEffect)
        {
            SceneObjReferGameMain.Instance.setEffectAssignObj(effect_assign);
        }

        yield return(null);

        m_SerialNo++;

        if (m_ReplaceAssetReference != null)
        {
            m_Status = Status.REPLACE_MODE;
        }
        else
        {
            if (m_AssetBundle != null)
            {
                m_AssetBundle.Unload(false);
                m_AssetBundle = null;
            }

            m_Status = Status.NONE;
        }
    }