/** リクエスト。ロードURL。サウンドプール。 */ public bool RequestLoadUrlSoundPool(File.Path a_path, UnityEngine.WWWForm a_post_data, Fee.File.CustomCertificateHandler a_certificate_handler, uint a_data_version) { if (this.is_busy == false) { this.is_busy = true; //is_cancel this.is_cancel = false; //request this.request_path = a_path; this.request_post_data = a_post_data; this.request_certificate_handler = a_certificate_handler; this.request_data_version = a_data_version; //result this.result_progress = 0.0f; this.result_errorstring = null; this.result_type = ResultType.None; this.result_soundpool = null; this.result_responseheader = null; Function.Function.StartCoroutine(this.DoLoadUrlSoundPool()); return(true); } return(false); }
/** コンバート。 */ public static void Convert(string a_convert_param, File.Path a_assets_path, Fee.JsonItem.JsonItem[] a_sheet, Fee.JsonSheet.ConvertParam a_convertparam) { try{ if (a_sheet != null) { System.Collections.Generic.List <string> t_tag_list = new System.Collections.Generic.List <string>(); System.Collections.Generic.List <Fee.File.Path> t_path_list = new System.Collections.Generic.List <Fee.File.Path>(); System.Collections.Generic.List <float> t_volume_list = new System.Collections.Generic.List <float>(); for (int ii = 0; ii < a_sheet.Length; ii++) { if (a_sheet[ii] != null) { System.Collections.Generic.List <ListItem> t_sheet = Fee.JsonItem.Convert.JsonItemToObject <System.Collections.Generic.List <ListItem> >(a_sheet[ii]); if (t_sheet != null) { for (int jj = 0; jj < t_sheet.Count; jj++) { if (ConvertSheet_MaterialPrefab.COMMAND_ITEM == t_sheet[jj].materialprefab_command) { //<item> t_tag_list.Add(t_sheet[jj].materialprefab_tag); t_path_list.Add(new File.Path(t_sheet[jj].materialprefab_assetspath)); } else { //無関係。複合シート。 } } } else { Tool.Assert(false); } } } //保存。 { Fee.Instantiate.MaterialList_Tool.ResourceItem[] t_resource_list = new Instantiate.MaterialList_Tool.ResourceItem[t_tag_list.Count]; for (int ii = 0; ii < t_tag_list.Count; ii++) { t_resource_list[ii] = new Instantiate.MaterialList_Tool.ResourceItem(t_tag_list[ii], t_path_list[ii]); } UnityEngine.GameObject t_prefab = new UnityEngine.GameObject("prefab_temp"); Fee.Instantiate.MaterialList_Tool.Add(t_prefab, t_resource_list); Fee.EditorTool.AssetTool.SavePrefab(t_prefab, a_assets_path); UnityEngine.GameObject.DestroyImmediate(t_prefab); } } else { Tool.Assert(false); } }catch (System.Exception t_exception) { Tool.DebugReThrow(t_exception); } }
/** リクエスト。ロードURL。パック。 */ public bool RequestLoadUrlPack(File.Path a_path, System.Collections.Generic.List <UnityEngine.Networking.IMultipartFormSection> a_post_data, Fee.File.CustomCertificateHandler a_certificate_handler, uint a_data_version) { if (this.is_busy == false) { this.is_busy = true; //is_cancel this.is_cancel = false; //request this.request_path = a_path; this.request_post_data = a_post_data; this.request_certificate_handler = a_certificate_handler; this.request_data_version = a_data_version; //result this.result_progress = 0.0f; this.result_errorstring = null; this.result_type = ResultType.None; this.result_pack = null; this.result_responseheader = null; Function.Function.GetInstance().StartCoroutine(this.DoLoadUrlPack()); return(true); } return(false); }
/** すべてのディレクトリの相対パスを列挙。 * * 再帰処理。 * */ public static System.Collections.Generic.List <Fee.File.Path> CreateAllDirectoryPathList(Fee.File.Path a_assets_path) { System.Collections.Generic.List <Fee.File.Path> t_list = new System.Collections.Generic.List <Fee.File.Path>(); System.Collections.Generic.List <Fee.File.Path> t_work = new System.Collections.Generic.List <Fee.File.Path>(); //自分を列挙。 { t_list.Add(a_assets_path); } { t_work.Add(a_assets_path); while (t_work.Count > 0) { Fee.File.Path t_path = t_work[t_work.Count - 1]; t_work.RemoveAt(t_work.Count - 1); System.Collections.Generic.List <string> t_directory_name_list = CreateDirectoryNameList(t_path); for (int ii = 0; ii < t_directory_name_list.Count; ii++) { Fee.File.Path t_new_path = new File.Path(t_path, t_directory_name_list[ii], Fee.File.Path.SEPARATOR); t_list.Add(t_new_path); t_work.Add(t_new_path); } } } return(t_list); }
/** リクエスト。ロードローカル。パック。 */ public bool RequestLoadLocalPack(File.Path a_path) { if (this.is_busy == false) { this.is_busy = true; //is_cancel this.is_cancel = false; //request this.request_path = a_path; this.request_post_data = null; this.request_certificate_handler = null; this.request_data_version = 0; //result this.result_progress = 0.0f; this.result_errorstring = null; this.result_type = ResultType.None; this.result_pack = null; this.result_responseheader = null; Function.Function.GetInstance().StartCoroutine(this.DoLoadLocalPack()); return(true); } return(false); }
/** リクエスト。ロードストリーミングアセット。サウンドプール。 */ public bool RequestLoadStreamingAssetsSoundPool(Fee.File.Path a_path, uint a_data_version) { if (this.is_busy == false) { this.is_busy = true; //is_cancel this.is_cancel = false; //request this.request_path = a_path; this.request_post_data = null; this.request_certificate_handler = null; this.request_data_version = a_data_version; //result this.result_progress = 0.0f; this.result_errorstring = null; this.result_type = ResultType.None; this.result_soundpool = null; this.result_responseheader = null; Function.Function.StartCoroutine(this.DoLoadStreamingAssetsSoundPool()); return(true); } return(false); }
/** リクエスト。ロードURL。サウンドプール。 */ public void RequestLoadUrlBinaryFile(File.Path a_url_path, UnityEngine.WWWForm a_post_data, Fee.File.CustomCertificateHandler a_certificate_handler, uint a_data_version) { this.request_type = RequestType.LoadUrlSoundPool; this.request_path = a_url_path; this.request_post_data = a_post_data; this.request_certificate_handler = a_certificate_handler; this.request_data_version = a_data_version; }
/** リクエスト。ロードURL。パック。 */ public void RequestLoadUrlBinaryFile(File.Path a_url_path, System.Collections.Generic.List <UnityEngine.Networking.IMultipartFormSection> a_post_data, Fee.File.CustomCertificateHandler a_certificate_handler, uint a_data_version) { this.request_type = RequestType.LoadUrlPack; this.request_path = a_url_path; this.request_post_data = a_post_data; this.request_certificate_handler = a_certificate_handler; this.request_data_version = a_data_version; }
/** リクエスト。ロードURL。サウンドプール。 * * ロード後ローカルセーブ。 * */ public Item RequestLoadUrlSoundPool(File.Path a_path, UnityEngine.WWWForm a_post_data, Fee.File.CustomCertificateHandler a_certificate_handler, uint a_data_version) { WorkItem t_work_item = new WorkItem(); t_work_item.RequestLoadUrlBinaryFile(a_path, a_post_data, a_certificate_handler, a_data_version); this.add_list.Add(t_work_item); return(t_work_item.GetItem()); }
/** リクエスト。ロードURL。パック。 * * ロード後ローカルセーブ。 * */ public Item RequestLoadUrlPack(File.Path a_path, System.Collections.Generic.List <UnityEngine.Networking.IMultipartFormSection> a_post_data, Fee.File.CustomCertificateHandler a_certificate_handler, uint a_data_version) { System.Collections.Generic.LinkedListNode <WorkItem> t_work_node = this.work_pool.Alloc(); t_work_node.Value.Reset(); t_work_node.Value.RequestLoadUrlBinaryFile(a_path, a_post_data, a_certificate_handler, a_data_version); this.work_add.AddLast(t_work_node); return(t_work_node.Value.GetItem()); }
/** FindFeePath * * return : アセットフォルダからの相対パス。 * */ public static Fee.File.Path FindFeePath() { Fee.File.Path t_path = null; try{ Fee.File.Path t_directory = Fee.EditorTool.Utility.FindFile(new File.Path(), "fee_buildtarget"); string t_directory_name = System.IO.Path.GetDirectoryName(System.IO.Path.GetFullPath(t_directory.GetDirectoryPath() + "/")); string t_root_directory_name = System.IO.Path.GetFullPath(Fee.File.Path.CreateAssetsPath().GetPath()); t_directory_name = t_directory_name.Substring(t_root_directory_name.Length + 1); UnityEngine.Debug.Log("FindFeePath : " + t_directory_name); t_path = new File.Path(t_directory_name); }catch (System.Exception t_exception) { UnityEngine.Debug.LogError(t_exception.Message); } return(t_path); }
/** constructor */ public Main_File() { this.is_busy = false; this.is_cancel = false; this.is_shutdown = false; //request this.request_path = null; this.request_post_data = null; this.request_certificate_handler = null; this.request_data_version = 0; //result this.result_progress = 0.0f; this.result_errorstring = null; this.result_type = ResultType.None; this.result_soundpool = null; this.result_responseheader = null; }
/** constructor */ public WorkItem() { //mode this.mode = Mode.Start; //request_type this.request_type = RequestType.None; //request_path this.request_path = null; //request_post_data this.request_post_data = null; //request_certificate_handler this.request_certificate_handler = null; //request_data_version this.request_data_version = 0; //item this.item = new Item(); }
/** コンバート。 */ public bool Convert(File.Path a_path) { this.jsonitem_jsonsheet = new JsonItem.JsonItem(new Fee.JsonItem.Value_AssociativeArray()); { #if (USE_DEF_FEE_EXCELDATAREADER) { this.excel = new Excel_ExcelDataReader(); } #else { this.excel = new Excel_Dummy(); } #endif if (this.excel.ReadOpen(a_path) == true) { int t_sheet_count = this.excel.GetSheetCount(); for (int ii = 0; ii < t_sheet_count; ii++) { if (this.excel.SetActiveSheet(ii) == true) { this.Convert_Sheet(); } } this.excel.Close(); } else { //失敗。 return(false); } } return(true); }
/** 1枚のマップチップテクスチャーを分割する。 * * a_use_count == true : 重複する場合に名前を最後にカウントを付ける。 * */ public static void Parse(UnityEngine.Texture2D a_texture, int a_tip_pixsize, Fee.File.Path a_assets_path, bool a_use_count) { if (a_texture != null) { if (a_tip_pixsize > 0) { if (((a_texture.width % a_tip_pixsize) != 0) || ((a_texture.height % a_tip_pixsize) != 0)) { Tool.EditorLogError("Size Error"); } int t_xx_max = a_texture.width / a_tip_pixsize; int t_yy_max = a_texture.height / a_tip_pixsize; for (int yy = 0; yy < t_yy_max; yy++) { for (int xx = 0; xx < t_xx_max; xx++) { //テクスチャー作成。 UnityEngine.Texture2D t_new_texture = Fee.EditorTool.AssetTool.CreateTextureFromTexture(a_texture, xx * a_tip_pixsize, yy * a_tip_pixsize, a_tip_pixsize, a_tip_pixsize); //PNGコンバート。 byte[] t_binary = UnityEngine.ImageConversion.EncodeToPNG(t_new_texture); //MD5. string t_md5 = Fee.MD5.MD5.CalcMD5(t_binary, 0, t_binary.Length); if (a_use_count == true) { //パス。 Fee.File.Path t_path = null; { int t_count = 0; while (true) { if (t_count <= 0) { t_path = new File.Path(a_assets_path, t_md5 + ".png", Fee.File.Path.SEPARATOR); } else { t_path = new File.Path(a_assets_path, t_md5 + "_" + t_count.ToString() + ".png", Fee.File.Path.SEPARATOR); } //ファイル出力。 if (Fee.EditorTool.AssetTool.IsExistFile(t_path) == false) { Fee.EditorTool.AssetTool.WriteBinaryFile(t_path, t_binary); break; } t_count++; } } } else { //パス。 Fee.File.Path t_path = new Fee.File.Path(a_assets_path, t_md5 + ".png", Fee.File.Path.SEPARATOR); //ファイル出力。 if (Fee.EditorTool.AssetTool.IsExistFile(t_path) == false) { Fee.EditorTool.AssetTool.WriteBinaryFile(t_path, t_binary); } } } } } else { Tool.EditorLogError("Error"); } } else { Tool.EditorLogError("Error"); } }
/** 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; }
/** リクエスト。ロードストリーミングアセット。パック。 */ public void RequestLoadStreamingAssetsPack(File.Path a_relative_path, uint a_data_version) { this.request_type = RequestType.LoadStreamingAssetsPack; this.request_path = a_relative_path; this.request_data_version = a_data_version; }
/** リクエスト。ロードローカル。パック。 */ public void RequestLoadLocalPack(File.Path a_relative_path) { this.request_type = RequestType.LoadLocalPack; this.request_path = a_relative_path; }
/** リクエスト。ロードローカル。サウンドプール。 */ public void RequestLoadLocalSoundPool(File.Path a_relative_path) { this.request_type = RequestType.LoadLocalSoundPool; this.request_path = a_relative_path; }
/** コンバート。アセットバンドル作成。 * * a_param : パラメータ。 * a_assets_path : アセットフォルダからの相対パス。 * a_sheet : JSONシート。 * */ public static void Convert_CreateAssetBundle(string a_param, Fee.File.Path a_assets_path, Fee.JsonItem.JsonItem[] a_sheet) { try{ if (a_sheet != null) { //アセットバンドルリスト作成 /* * { * "se.assetbundle" : { * { * "SE" : * "Editor/Test12/se" * }, * { * "UI_BUTTON" : * "Common/Texture/ui_button" * }, * { * "IMAGE" : * "Common/Texture/image.jpg" * }, * * ... * }, * "xx.assetbundle" : { * * }, * ... * } */ System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, ListItem> > t_assetbundlelist = new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, ListItem> >(); { for (int ii = 0; ii < a_sheet.Length; ii++) { if (a_sheet[ii] != null) { System.Collections.Generic.List <ListItem> t_sheet = Fee.JsonItem.Convert.JsonItemToObject <System.Collections.Generic.List <ListItem> >(a_sheet[ii]); if (t_sheet != null) { for (int jj = 0; jj < t_sheet.Count; jj++) { if (string.IsNullOrEmpty(t_sheet[jj].data_assetbundle_name) == false) { switch (t_sheet[jj].data_command) { case Convert_DataSheet.DATACOMMAND_RESOURCES_PREFAB: case Convert_DataSheet.DATACOMMAND_RESOURCES_TEXTURE: case Convert_DataSheet.DATACOMMAND_RESOURCES_TEXT: { System.Collections.Generic.Dictionary <string, ListItem> t_item_list = null; if (t_assetbundlelist.TryGetValue(t_sheet[jj].data_assetbundle_name, out t_item_list) == false) { t_item_list = new System.Collections.Generic.Dictionary <string, ListItem>(); t_assetbundlelist.Add(t_sheet[jj].data_assetbundle_name, t_item_list); } t_item_list.Add(t_sheet[jj].data_id, t_sheet[jj]); } break; default: { Tool.Assert(false); } break; } } else { //アセットバンドルなし。 } } } else { Tool.Assert(false); } } } } switch (a_param) { case Convert_DataSheet.DATAPARAM_DUMMY: { //ダミー。 foreach (System.Collections.Generic.KeyValuePair <string, System.Collections.Generic.Dictionary <string, ListItem> > t_pair in t_assetbundlelist) { Fee.AssetBundleList.DummryAssetBundle t_dummy_assetbundle = new AssetBundleList.DummryAssetBundle(); //asset_list t_dummy_assetbundle.asset_list = new System.Collections.Generic.Dictionary <string, string>(); //key_list System.Collections.Generic.List <string> t_key_list = new System.Collections.Generic.List <string>(t_pair.Value.Keys); for (int ii = 0; ii < t_key_list.Count; ii++) { //asset_name string t_asset_name = t_key_list[ii]; ListItem t_listitem; if (t_pair.Value.TryGetValue(t_asset_name, out t_listitem) == true) { t_dummy_assetbundle.asset_list.Add(t_asset_name, t_listitem.data_path); } else { Tool.Assert(false); } } Fee.File.Path t_path = new File.Path(a_assets_path.GetPath() + t_pair.Key + ".json"); string t_jsonstring = Fee.JsonItem.Convert.ObjectToJsonString <Fee.AssetBundleList.DummryAssetBundle>(t_dummy_assetbundle); EditorTool.Utility.WriteTextFile(Fee.File.Path.CreateAssetsPath(t_path), t_jsonstring, true); } } break; case Convert_DataSheet.DATAPARAM_STANDALONEWINDOWS: case Convert_DataSheet.DATAPARAM_ANDROID: case Convert_DataSheet.DATAPARAM_WEBGL: case Convert_DataSheet.DATAPARAM_IOS: { //アセットバンドル。 //t_assetbundle_build UnityEditor.AssetBundleBuild[] t_assetbundle_build = new UnityEditor.AssetBundleBuild[t_assetbundlelist.Count]; { int t_count = 0; foreach (System.Collections.Generic.KeyValuePair <string, System.Collections.Generic.Dictionary <string, ListItem> > t_pair in t_assetbundlelist) { //パック名。 t_assetbundle_build[t_count].assetBundleName = t_pair.Key; //assetBundleVariant t_assetbundle_build[t_count].assetBundleVariant = null; //key_list System.Collections.Generic.List <string> t_key_list = new System.Collections.Generic.List <string>(t_pair.Value.Keys); t_assetbundle_build[t_count].assetNames = new string[t_key_list.Count]; #if (UNITY_5) //未対応。 #else t_assetbundle_build[t_count].addressableNames = new string[t_key_list.Count]; #endif for (int ii = 0; ii < t_key_list.Count; ii++) { ListItem t_listitem; if (t_pair.Value.TryGetValue(t_key_list[ii], out t_listitem) == true) { string t_asset_path = null; { try{ UnityEngine.Object t_object = UnityEngine.Resources.Load(t_listitem.data_path); if (t_object != null) { t_asset_path = UnityEditor.AssetDatabase.GetAssetPath(t_object); } else { Tool.Assert(false); } }catch (System.Exception t_exception) { Tool.DebugReThrow(t_exception); } } //assetNames t_assetbundle_build[t_count].assetNames[ii] = t_asset_path; //addressableNames #if (UNITY_5) //未対応。 #else t_assetbundle_build[t_count].addressableNames[ii] = t_key_list[ii]; #endif } else { Tool.Assert(false); } } t_count++; } } //BuildAssetBundleOptions UnityEditor.BuildAssetBundleOptions t_option = UnityEditor.BuildAssetBundleOptions.ForceRebuildAssetBundle; //BuildTarget UnityEditor.BuildTarget t_buildtarget = UnityEditor.BuildTarget.StandaloneWindows; switch (a_param) { case Convert_DataSheet.DATAPARAM_STANDALONEWINDOWS: { t_buildtarget = UnityEditor.BuildTarget.StandaloneWindows; } break; case Convert_DataSheet.DATAPARAM_ANDROID: { t_buildtarget = UnityEditor.BuildTarget.Android; } break; case Convert_DataSheet.DATAPARAM_WEBGL: { t_buildtarget = UnityEditor.BuildTarget.WebGL; } break; case Convert_DataSheet.DATAPARAM_IOS: { t_buildtarget = UnityEditor.BuildTarget.iOS; } break; default: { Tool.Assert(false); } break; } if (System.IO.Directory.Exists("Assets/" + a_assets_path.GetPath()) == false) { System.IO.Directory.CreateDirectory("Assets/" + a_assets_path.GetPath()); } UnityEditor.BuildPipeline.BuildAssetBundles("Assets/" + a_assets_path.GetPath(), t_assetbundle_build, t_option, t_buildtarget); } break; default: { Tool.Assert(false); } break; } } else { Tool.Assert(false); } }catch (System.Exception t_exception) { Tool.DebugReThrow(t_exception); } }
static void DoFileWrite(string path, File.Path p) { CodeTask.RunOneThing(path, p); }