/** CoroutineMain */ public System.Collections.IEnumerator CoroutineMain(OnSoundPoolCoroutine_CallBackInterface a_callback_interface, Fee.File.Path a_path) { //result this.result = new ResultType(); //ローカル、パックJSONのロード。 Fee.JsonItem.JsonItem t_local_pack_json = null; { Fee.File.Item t_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadLocalTextFile, a_path); do { if (a_callback_interface != null) { a_callback_interface.OnSoundPoolCoroutine(t_item.GetResultProgress()); } yield return(null); }while(t_item.IsBusy() == true); if (t_item.GetResultAssetType() == Asset.AssetType.Text) { t_local_pack_json = new JsonItem.JsonItem(t_item.GetResultAssetText()); if (t_local_pack_json == null) { //コンバート失敗。 this.result.errorstring = "Coroutine_LoadLocalPack : local_pack_json == null"; yield break; } } else { //ローカルにキャッシュなし。 } } Pack t_local_pack = Fee.JsonItem.Convert.JsonItemToObject <Pack>(t_local_pack_json); if (t_local_pack == null) { //コンバート失敗。 this.result.errorstring = "Coroutine_LoadLocalPack : local_pack == null"; yield break; } //パス解決。 { t_local_pack.fullpath_list = new System.Collections.Generic.List <File.Path>(); for (int ii = 0; ii < t_local_pack.name_list.Count; ii++) { t_local_pack.fullpath_list.Add(File.Path.CreateLocalPath(t_local_pack.name_list[ii], Fee.File.Path.SEPARATOR)); } } this.result.pack = t_local_pack; yield break; }
/** コンバート。シート。 */ private void Convert_Sheet() { /** pos */ CellPosition t_pos_root = new CellPosition(0, 0); CellPosition t_pos_param_type = new CellPosition(0, 0); CellPosition t_pos_param_name = new CellPosition(0, 0); CellPosition t_pos_end_y = new CellPosition(0, 0); CellPosition t_pos_end_x = new CellPosition(0, 0); //ルート。検索。 if (this.FindCell_Root(out t_pos_root) == false) { return; } //パラメータタイプ。検索。 if (this.CellStringCheck(t_pos_root.x, t_pos_root.y + 1, Config.COMMAND_PARAM_TYPE, out t_pos_param_type) == false) { Tool.Assert(false); return; } //パラメータ名。検索。 if (this.CellStringCheck(t_pos_root.x, t_pos_root.y + 2, Config.COMMAND_PARAM_NAME, out t_pos_param_name) == false) { Tool.Assert(false); return; } //X軸方向。終端検索。 if (this.FindCellXLine(t_pos_param_type.x + 1, t_pos_param_type.y, Config.END_SEARCH_WIDTH, Config.COMMAND_PARAM_END, out t_pos_end_x) == false) { Tool.Assert(false); return; } //Y軸方向。終端検索。 if (this.FindCellYLine(t_pos_param_type.x, t_pos_param_type.y + 1, Config.END_SEARCH_HEIGHT, Config.COMMAND_PARAM_END, out t_pos_end_y) == false) { Tool.Assert(false); return; } //パラメータリスト。作成。 System.Collections.Generic.List <ParamListItem> t_param_list = this.CreateParamTypeList(t_pos_param_type.y, t_pos_param_name.y, t_pos_param_type.x + 1, t_pos_end_x.x); { Fee.JsonItem.JsonItem t_jsonitem_list = new JsonItem.JsonItem(new Fee.JsonItem.Value_IndexArray()); for (int yy = t_pos_param_name.y + 1; yy < t_pos_end_y.y; yy++) { string t_flag = this.GetTryCellString(t_pos_param_name.x, yy); if (t_flag == Config.COMMAND_ON) { Fee.JsonItem.JsonItem t_jsonitem_item = new JsonItem.JsonItem(new Fee.JsonItem.Value_AssociativeArray()); for (int ii = 0; ii < t_param_list.Count; ii++) { switch (t_param_list[ii].param_type) { case ParamType.StringType: { //string string t_value = this.GetTryCellString(t_param_list[ii].pos_x, yy); t_jsonitem_item.AddItem(t_param_list[ii].param_name, new JsonItem.JsonItem(new Fee.JsonItem.Value_StringData(t_value)), false); } break; case ParamType.IntType: { //int double t_value = this.GetTryCellNumeric(t_param_list[ii].pos_x, yy); t_jsonitem_item.AddItem(t_param_list[ii].param_name, new JsonItem.JsonItem(new Fee.JsonItem.Value_Number <int>((int)t_value)), false); } break; case ParamType.FloatType: { //float double t_value = this.GetTryCellNumeric(t_param_list[ii].pos_x, yy); t_jsonitem_item.AddItem(t_param_list[ii].param_name, new JsonItem.JsonItem(new Fee.JsonItem.Value_Number <float>((float)t_value)), false); } break; default: { Tool.Assert(false); } break; } } t_jsonitem_list.AddItem(t_jsonitem_item, false); } } string t_root_name = this.GetTryCellString(t_pos_root.x + 1, t_pos_root.y); if (this.jsonitem_jsonsheet.IsExistItem(t_root_name) == false) { this.jsonitem_jsonsheet.AddItem(t_root_name, t_jsonitem_list, false); } else { //ルート名が他のシートと重複している。 Tool.Assert(false); return; } } }
/** 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; }