/// <summary> /// 差し替えモードを開始する /// 差し替えモードになるまでは少し時間がかかります(getStatus()で調べる) /// </summary> /// <param name="area_category_id"></param> /// <param name="timing_type"></param> public void startReplaceMode(uint area_category_id, ReplaceAssetReference.ChangeTimingType timing_type) { endReplaceMode(); m_Status = Status.LOADING; m_AreaCategoryID = area_category_id; m_TimingType = timing_type; m_IsUseEffect = (m_TimingType == ReplaceAssetReference.ChangeTimingType.BATTLE_NORMAL || m_TimingType == ReplaceAssetReference.ChangeTimingType.BATTLE_BOSS); StartCoroutine(loadReplaceAssetInfo()); }
/// <summary> /// 差し替えモードを終了する /// </summary> public void endReplaceMode() { StopCoroutine(loadReplaceAssetInfo()); if (SoundManager.HasInstance) { SoundManager.Instance.clearReplaceSE(); } if (m_AssetBundle != null) { m_AssetBundle.Unload(false); m_AssetBundle = null; } m_ReplaceAssetReference = null; m_AreaCategoryID = 0; m_TimingType = ReplaceAssetReference.ChangeTimingType.NONE; m_Status = Status.NONE; }
public static ReplaceAssetReference getReplaceAssetReference(AssetBundle src_assetbundle, ReplaceAssetReference.ChangeTimingType timing_type) { string[] asset_names = src_assetbundle.GetAllAssetNames(); for (int idx = 0; idx < asset_names.Length; idx++) { asset_names[idx] = Path.GetFileName(asset_names[idx]); } string asset_name = searchName(asset_names, ASSET_NAMES[(int)timing_type]); if (asset_name == null) { if (timing_type == ChangeTimingType.BATTLE_NORMAL || timing_type == ChangeTimingType.BATTLE_BOSS ) { asset_name = searchName(asset_names, ASSET_NAME_BATTLE_ALL); } } if (asset_name != null) { string load_name = Path.GetFileNameWithoutExtension(asset_name).ToLower(); GameObject replace_asset_prefab = src_assetbundle.LoadAsset <GameObject>(load_name); if (replace_asset_prefab != null) { ReplaceAssetReference ret_val = replace_asset_prefab.GetComponent <ReplaceAssetReference>(); //Destroy(replace_asset_prefab); //replace_asset_prefab = null; return(ret_val); } } return(null); }