/** CoroutineMain */ public System.Collections.IEnumerator CoroutineMain(Fee.Data.OnDataCoroutine_CallBackInterface a_callback_interface, ListItem a_listitem) { //result this.result = new ResultType(); AssetBundleList.Item t_assetbundlelist_item = null; Fee.File.Item t_file_item = null; switch (a_listitem.path_type) { case PathType.AssetBundle_Prefab: { t_assetbundlelist_item = Fee.AssetBundleList.AssetBundleList.GetInstance().RequestLoadAssetBundleItemPrefabFile(a_listitem.assetbundle_name, a_listitem.id); if (t_assetbundlelist_item == null) { //失敗。 this.result.errorstring = "Coroutine_Load : " + a_listitem.assetbundle_name + " : " + a_listitem.id; yield break; } } break; case PathType.AssetBundle_Texture: { t_assetbundlelist_item = Fee.AssetBundleList.AssetBundleList.GetInstance().RequestLoadAssetBundleItemTextureFile(a_listitem.assetbundle_name, a_listitem.id); if (t_assetbundlelist_item == null) { //失敗。 this.result.errorstring = "Coroutine_Load : " + a_listitem.assetbundle_name + " : " + a_listitem.id; yield break; } } break; case PathType.AssetBundle_Text: { t_assetbundlelist_item = Fee.AssetBundleList.AssetBundleList.GetInstance().RequestLoadAssetBundleItemTextFile(a_listitem.assetbundle_name, a_listitem.id); if (t_assetbundlelist_item == null) { //失敗。 this.result.errorstring = "Coroutine_Load : " + a_listitem.assetbundle_name + " : " + a_listitem.id; yield break; } } break; case PathType.Resources_Prefab: { //リソース。プレハブ。 t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadResourcesPrefabFile, a_listitem.path); if (t_file_item == null) { //失敗。 this.result.errorstring = "Coroutine_Load : " + a_listitem.path; yield break; } } break; case PathType.Resources_Texture: { //リソース。テクスチャ。 t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadResourcesTextureFile, a_listitem.path); if (t_file_item == null) { //失敗。 this.result.errorstring = "Coroutine_Load : " + a_listitem.path; yield break; } } break; case PathType.Resources_Text: { //リソース。テキスト。 t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadResourcesTextFile, a_listitem.path); if (t_file_item == null) { //失敗。 this.result.errorstring = "Coroutine_Load : " + a_listitem.path; yield break; } } break; case PathType.StreamingAssets_Texture: { //ストリーミングアセット。テクスチャ。 t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadStreamingAssetsTextureFile, a_listitem.path); if (t_file_item == null) { //失敗。 this.result.errorstring = "Coroutine_Load : " + a_listitem.path; yield break; } } break; case PathType.StreamingAssets_Text: { //ストリーミングアセット。テキスト。 t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadStreamingAssetsTextFile, a_listitem.path); if (t_file_item == null) { //失敗。 this.result.errorstring = "Coroutine_Load : " + a_listitem.path; yield break; } } break; case PathType.StreamingAssets_Binary: { //ストリーミングアセット。バイナリ。 t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadStreamingAssetsBinaryFile, a_listitem.path); if (t_file_item == null) { //失敗。 this.result.errorstring = "Coroutine_Load : " + a_listitem.path; yield break; } } break; case PathType.Url_Texture: { //URL。テクスチャ。 t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadUrlTextureFile, a_listitem.path); if (t_file_item == null) { //失敗。 this.result.errorstring = "Coroutine_Load : " + a_listitem.path; yield break; } } break; case PathType.Url_Text: { //URL。テキスト。 t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadUrlTextFile, a_listitem.path); if (t_file_item == null) { //失敗。 this.result.errorstring = "Coroutine_Load : " + a_listitem.path; yield break; } } break; case PathType.Url_Binary: { //URL。バイナリ。 t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadUrlBinaryFile, a_listitem.path); if (t_file_item == null) { //失敗。 this.result.errorstring = "Coroutine_Load : " + a_listitem.path; yield break; } } break; #if (UNITY_EDITOR) case PathType.AssetsPath_Prefab: { //TODO: /* * //アセット。プレハブ。 * t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadAssetsPathTextFile,a_listitem.path); * if(t_file_item == null){ * //失敗。 * this.result.errorstring = "Coroutine_Load : " + a_listitem.path; * yield break; * } */ } break; case PathType.AssetsPath_Text: { //アセット。テキスト。 t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadAssetsPathTextFile, a_listitem.path); if (t_file_item == null) { //失敗。 this.result.errorstring = "Coroutine_Load : " + a_listitem.path; yield break; } } break; case PathType.AssetsPath_Texture: { //TODO: /* * //アセット。テクスチャ。 * t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadUrlBinaryFile,a_listitem.path); * if(t_file_item == null){ * //失敗。 * this.result.errorstring = "Coroutine_Load : " + a_listitem.path; * yield break; * } */ } break; #endif default: { Tool.Assert(false); } break; } if (t_assetbundlelist_item != null) { //ロード中。 do { if (a_callback_interface != null) { a_callback_interface.OnDataCoroutine(t_assetbundlelist_item.GetResultProgress()); } yield return(null); }while(t_assetbundlelist_item.IsBusy() == true); switch (a_listitem.path_type) { case PathType.AssetBundle_Prefab: { if (t_assetbundlelist_item.GetResultAssetType() == Asset.AssetType.Prefab) { if (t_assetbundlelist_item.GetResultAssetPrefab() != null) { this.result.asset_file = t_assetbundlelist_item.GetResultAsset(); yield break; } } } break; case PathType.AssetBundle_Texture: { if (t_assetbundlelist_item.GetResultAssetType() == Asset.AssetType.Texture) { if (t_assetbundlelist_item.GetResultAssetTexture() != null) { this.result.asset_file = t_assetbundlelist_item.GetResultAsset(); yield break; } } } break; case PathType.AssetBundle_Text: { if (t_assetbundlelist_item.GetResultAssetType() == Asset.AssetType.Text) { if (t_assetbundlelist_item.GetResultAssetText() != null) { this.result.asset_file = t_assetbundlelist_item.GetResultAsset(); yield break; } } } break; default: { Tool.Assert(false); } break; } //失敗。 this.result.errorstring = "Coroutine_Load : " + t_assetbundlelist_item.GetResultErrorString(); yield break; } if (t_file_item != null) { //ロード中。 do { if (a_callback_interface != null) { a_callback_interface.OnDataCoroutine(t_file_item.GetResultProgress()); } yield return(null); }while(t_file_item.IsBusy() == true); switch (a_listitem.path_type) { case PathType.Resources_Prefab: { //リソース。プレハブ。 if (t_file_item.GetResultAssetType() == Asset.AssetType.Prefab) { if (t_file_item.GetResultAssetPrefab() != null) { this.result.asset_file = t_file_item.GetResultAsset(); yield break; } } } break; case PathType.Resources_Texture: case PathType.StreamingAssets_Texture: case PathType.Url_Texture: { //リソース。テクスチャ。 //ストリーミングアセット。テクスチャ。 //URL。テクスチャ。 if (t_file_item.GetResultAssetType() == Asset.AssetType.Texture) { if (t_file_item.GetResultAssetTexture() != null) { this.result.asset_file = t_file_item.GetResultAsset(); yield break; } } } break; case PathType.Resources_Text: case PathType.StreamingAssets_Text: case PathType.Url_Text: { //リソース。テキスト。 //ストリーミングアセット。テキスト。 //URL。テキスト。 if (t_file_item.GetResultAssetType() == Asset.AssetType.Text) { if (t_file_item.GetResultAssetText() != null) { this.result.asset_file = t_file_item.GetResultAsset(); yield break; } } } break; case PathType.StreamingAssets_Binary: case PathType.Url_Binary: { //ストリーミングアセット。バイナリ。 //URL。バイナリ。 if (t_file_item.GetResultAssetType() == Asset.AssetType.Binary) { if (t_file_item.GetResultAssetBinary() != null) { this.result.asset_file = t_file_item.GetResultAsset(); yield break; } } } break; default: { Tool.Assert(false); } break; } //失敗。 this.result.errorstring = "Coroutine_Load : " + t_file_item.GetResultErrorString(); yield break; } //不明。 Tool.Assert(false); this.result.errorstring = "Coroutine_Load : " + "Unknown"; yield break; }
/** CoroutineMain */ public System.Collections.IEnumerator CoroutineMain(OnSoundPoolCoroutine_CallBackInterface a_callback_interface, File.Path a_path, UnityEngine.WWWForm a_post_data, Fee.File.CustomCertificateHandler a_certificate_handler, bool a_is_streamingassets, uint a_data_version) { //result this.result = new ResultType(); Fee.Pattern.Progress t_progress = new Fee.Pattern.Progress(new float[] { 0.05f, 0.1f, 0.8f, 0.05f }); //ローカル、サウンロプール管理ファイル。相対パス。 Fee.File.Path t_local_caoundpool_path = new File.Path(a_path.GetFileName()); //ローカル、サウンドプール管理ファイルのロード。 Fee.JsonItem.JsonItem t_local_soundpool_json = null; if (Config.USE_LOADURL_SOUNDPOOL_CACHE == true) { Fee.File.Item t_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadLocalTextFile, t_local_caoundpool_path); do { //■ステップ0。 if (a_callback_interface != null) { t_progress.SetStep((int)Progress_MainStep.Progress_MainStep_0_LoadLocal_SoundPool, 0, 1); a_callback_interface.OnSoundPoolCoroutine(t_progress.CalcProgress(t_item.GetResultProgress())); } yield return(null); }while(t_item.IsBusy() == true); if (t_item.GetResultAssetType() == Asset.AssetType.Text) { t_local_soundpool_json = new JsonItem.JsonItem(t_item.GetResultAssetText()); if (t_local_soundpool_json == null) { //コンバート失敗。 this.result.errorstring = "Coroutine_LoadSoundPool : local_soundpool_json == null"; yield break; } } else { //ローカルにキャッシュなし。 } } //チェック。 if (t_local_soundpool_json != null) { if ((t_local_soundpool_json.IsAssociativeArray() == true) && (t_local_soundpool_json.IsExistItem("data_version"))) { uint t_data_version = t_local_soundpool_json.GetItem("data_version").CastToUint16(); if (t_data_version == a_data_version) { Fee.Audio.Pack_SoundPool t_local_soundpool = Fee.JsonItem.Convert.JsonItemToObject <Fee.Audio.Pack_SoundPool>(t_local_soundpool_json); if (t_local_soundpool != null) { //最新を取得する必要なし。 //パス解決。 { t_local_soundpool.fullpath_list = new System.Collections.Generic.List <File.Path>(); for (int ii = 0; ii < t_local_soundpool.name_list.Count; ii++) { t_local_soundpool.fullpath_list.Add(File.Path.CreateLocalPath(t_local_soundpool.name_list[ii])); } } this.result.soundpool = t_local_soundpool; this.result.responseheader = null; yield break; } else { //コンバート失敗。 } } else { //最新のバージョンが必要。 } } else { //不明なデータ。 } t_local_soundpool_json = null; } //ロード。 string t_load_stringjson = null; Fee.Audio.Pack_SoundPool t_load_soundpool = null; //サウンドプール管理ファイルのロード。 { Fee.File.Item t_item = null; if (a_is_streamingassets == true) { t_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadStreamingAssetsTextFile, a_path); } else { t_item = Fee.File.File.GetInstance().RequestLoadUrl(File.File.LoadRequestType.LoadUrlTextFile, a_path, a_post_data, a_certificate_handler); } do { //■ステップ1。 if (a_callback_interface != null) { t_progress.SetStep((int)Progress_MainStep.Progress_MainStep_1_Load_SoundPool, 0, 1); a_callback_interface.OnSoundPoolCoroutine(t_progress.CalcProgress(t_item.GetResultProgress())); } yield return(null); }while(t_item.IsBusy() == true); this.result.responseheader = t_item.GetResultResponseHeader(); if (t_item.GetResultAssetType() == Asset.AssetType.Text) { //成功。 t_load_stringjson = t_item.GetResultAssetText(); } else { //失敗。 this.result.errorstring = t_item.GetResultErrorString(); yield break; } t_load_soundpool = JsonItem.Convert.JsonStringToObject <Fee.Audio.Pack_SoundPool>(t_load_stringjson); if (t_load_soundpool == null) { //コンバート失敗。 this.result.errorstring = "Coroutine_LoadSoundPool : load_soundpool == null"; yield break; } else if (t_load_soundpool.name_list == null) { //不明なデータ。 this.result.errorstring = "Coroutine_LoadSoundPool : load_soundpool.name_list == null"; yield break; } else if (t_load_soundpool.volume_list == null) { //不明なデータ。 this.result.errorstring = "Coroutine_LoadSoundPool : load_soundpool.volume_list == null"; yield break; } } //登録サウンドのロード。 { for (int ii = 0; ii < t_load_soundpool.name_list.Count; ii++) { byte[] t_sound_binary = null; //ロード。 { Fee.File.Path t_sound_url = a_path.CreateFileNameChangePath(t_load_soundpool.name_list[ii]); Fee.File.Item t_item = null; if (a_is_streamingassets) { t_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadStreamingAssetsBinaryFile, t_sound_url); } else { t_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadUrlBinaryFile, t_sound_url); } do { //■ステップ2。 if (a_callback_interface != null) { t_progress.SetStep((int)Progress_MainStep.Progress_MainStep_2_Sound, ii * 2 + 0, t_load_soundpool.name_list.Count * 2); a_callback_interface.OnSoundPoolCoroutine(t_progress.CalcProgress(t_item.GetResultProgress())); } yield return(null); }while(t_item.IsBusy() == true); if (t_item.GetResultAssetType() == Asset.AssetType.Binary) { //成功。 t_sound_binary = t_item.GetResultAssetBinary(); } else { //失敗。 this.result.errorstring = t_item.GetResultErrorString(); yield break; } } //セーブローカル。 { Fee.File.Path t_sound_url = new File.Path(t_load_soundpool.name_list[ii]); File.Item t_item = Fee.File.File.GetInstance().RequestSaveBinaryFile(File.File.SaveRequestType.SaveLocalBinaryFile, t_sound_url, t_sound_binary); do { //■ステップ2。 if (a_callback_interface != null) { t_progress.SetStep((int)Progress_MainStep.Progress_MainStep_2_Sound, ii * 2 + 1, t_load_soundpool.name_list.Count * 2); a_callback_interface.OnSoundPoolCoroutine(t_progress.CalcProgress(t_item.GetResultProgress())); } yield return(null); }while(t_item.IsBusy() == true); if (t_item.GetResultType() == File.Item.ResultType.SaveEnd) { //成功。 } else { //失敗。 this.result.errorstring = t_item.GetResultErrorString(); yield break; } } } } //ローカル、サウンドプール管理ファイルのセーブ。 { File.Item t_item = Fee.File.File.GetInstance().RequestSaveTextFile(File.File.SaveRequestType.SaveLocalTextFile, t_local_caoundpool_path, t_load_stringjson); do { //■ステップ3。 if (a_callback_interface != null) { t_progress.SetStep((int)Progress_MainStep.Progress_MainStep_3_SaveLocal_SoundPool, 0, 1); a_callback_interface.OnSoundPoolCoroutine(t_progress.CalcProgress(t_item.GetResultProgress())); } yield return(null); }while(t_item.IsBusy() == true); if (t_item.GetResultType() == File.Item.ResultType.SaveEnd) { //成功。 } else { //失敗。 this.result.errorstring = t_item.GetResultErrorString(); yield break; } } //パス解決。 { t_load_soundpool.fullpath_list = new System.Collections.Generic.List <File.Path>(); for (int ii = 0; ii < t_load_soundpool.name_list.Count; ii++) { t_load_soundpool.fullpath_list.Add(Fee.File.Path.CreateLocalPath(t_load_soundpool.name_list[ii])); } } this.result.soundpool = t_load_soundpool; yield break; }