/** ロード。 */ public void Load(string a_name) { Item t_item = null; if(this.list.TryGetValue(a_name,out t_item) == true){ //読み込み済み。 if(t_item != null){ t_item.reference_count++; } } if(t_item == null){ int t_sound_id = 0; //読み込み。 #if(UNITY_ANDROID) try{ //1固定。 int t_priority = (int)LoadPriority.RESERVATION; if(this.java_soundpool != null){ Fee.File.Path t_path = Fee.File.Path.CreateLocalPath(a_name,Fee.File.Path.SEPARATOR); t_sound_id = this.java_soundpool.Call<int>("load",t_path.GetPath(),t_priority); } }catch(System.Exception t_exception){ Tool.DebugReThrow(t_exception); } #endif Tool.Log("SoundPool","Load : " + a_name); //追加。 this.list.Add(a_name,new Item(t_sound_id)); } }
/** リクエスト。セーブローカル。テクスチャファイル。 */ public bool RequestSaveLocalTextureFile(Fee.File.Path a_relative_path, UnityEngine.Texture2D a_texture) { if (this.is_busy == false) { this.is_busy = true; //is_cancel this.is_cancel = false; //result this.result_progress = 0.0f; this.result_errorstring = null; this.result_type = ResultType.None; this.result_asset = null; //request this.request_relative_path = a_relative_path; this.request_binary = null; this.request_text = null; this.request_texture = a_texture; Function.Function.StartCoroutine(this.DoSaveLocalTextureFile()); return(true); } return(false); }
/** 鍵作成。 */ public static void CreatePublicKeyPrivateKey(Fee.File.Path a_public_key, Fee.File.Path a_private_key) { string t_public_key; string t_private_key; if (CreateCryptKey(out t_public_key, out t_private_key) == true) { //public { Fee.JsonItem.JsonItem t_jsonitem = new Fee.JsonItem.JsonItem(new Fee.JsonItem.Value_AssociativeArray()); Fee.JsonItem.JsonItem t_jsonitem_public = new Fee.JsonItem.JsonItem(new Fee.JsonItem.Value_StringData(t_public_key)); t_jsonitem.SetItem("public", t_jsonitem_public, false); Utility.WriteJsonFile(a_public_key, t_jsonitem, true); } //private { Fee.JsonItem.JsonItem t_jsonitem = new Fee.JsonItem.JsonItem(new Fee.JsonItem.Value_AssociativeArray()); Fee.JsonItem.JsonItem t_jsonitem_private = new Fee.JsonItem.JsonItem(new Fee.JsonItem.Value_StringData(t_private_key)); t_jsonitem.SetItem("private", t_jsonitem_private, false); Utility.WriteJsonFile(a_private_key, t_jsonitem, true); } UnityEditor.AssetDatabase.Refresh(); } }
/** リクエスト。ロードストリーミングアセット。サウンドプール。 */ 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); }
/** すべてのディレクトリの相対パスを列挙。 * * 再帰処理。 * */ 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); }
/** 実行。ロードストリーミングアセット。テクスチャファイル。 */ private System.Collections.IEnumerator DoLoadStreamingAssetsTextureFile() { //request_pathは相対パス。 Fee.File.Path t_path = Fee.File.Path.CreateStreamingAssetsPath(this.request_path); Coroutine_LoadUrlTextureFile t_coroutine = new Coroutine_LoadUrlTextureFile(); yield return(t_coroutine.CoroutineMain(this, t_path, null, null)); if (t_coroutine.result.texture_file != null) { this.result_progress = 1.0f; this.result_asset = new Asset.Asset(Asset.AssetType.Texture, t_coroutine.result.texture_file); this.result_responseheader = t_coroutine.result.responseheader; this.result_type = ResultType.Asset; yield break; } else { this.result_progress = 1.0f; this.result_errorstring = t_coroutine.result.errorstring; this.result_responseheader = t_coroutine.result.responseheader; this.result_type = ResultType.Error; yield break; } }
/** WEBリクエスト作成。 */ public static UnityEngine.Networking.UnityWebRequest CreateWebRequest(Fee.File.Path a_uri_path, UnityEngine.Networking.CertificateHandler a_certificate) { UnityEngine.Networking.UnityWebRequest t_webrequest = null; try{ t_webrequest = UnityEngine.Networking.UnityWebRequest.Get(a_uri_path.GetPath()); if (a_certificate != null) { t_webrequest.certificateHandler = a_certificate; } UnityEngine.Networking.UnityWebRequestAsyncOperation t_async = t_webrequest.SendWebRequest(); while (t_async.isDone == false) { System.Threading.Thread.Sleep(100); } }catch (System.Exception t_exception) { Tool.EditorLogError(t_exception.Message); t_webrequest = null; } return(t_webrequest); }
/** ビデオプレイヤ。作成。 */ private void CreateVideoPlayer(Fee.File.Path a_full_path) { this.videoplayer = Fee.Video.Video.GetInstance().GetRootGameObject().AddComponent <UnityEngine.Video.VideoPlayer>(); this.videoplayer.playOnAwake = false; //描画先。 this.videoplayer.renderMode = UnityEngine.Video.VideoRenderMode.RenderTexture; this.videoplayer.targetTexture = this.rendertexture; //音声。 this.videoplayer.audioOutputMode = UnityEngine.Video.VideoAudioOutputMode.Direct; //ループ。 this.videoplayer.isLooping = false; //最初のフレームが準備できるまで待つ。 this.videoplayer.waitForFirstFrame = true; //フレームスキップ。 this.videoplayer.skipOnDrop = true; //再生速度。 this.videoplayer.playbackSpeed = 1.0f; //パス。 this.videoplayer.source = UnityEngine.Video.VideoSource.Url; this.videoplayer.url = a_full_path.GetPath(); }
/** リクエスト。セーブローカル。バイナリファイル。 */ public bool RequestSaveLocalBinaryFile(Fee.File.Path a_relative_path, byte[] a_binary) { if (this.is_busy == false) { this.is_busy = true; //is_cancel this.is_cancel = false; //result this.result_progress = 0.0f; this.result_errorstring = null; this.result_type = ResultType.None; this.result_asset = null; //request this.request_relative_path = a_relative_path; this.request_binary = a_binary; this.request_text = null; this.request_texture = null; Function.Function.GetInstance().StartCoroutine(this.DoSaveLocalBinaryFile()); return(true); } return(false); }
/** コンバート。 */ public static void Convert(string a_convert_param, Fee.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_RAControllerPrefab.COMMAND_ITEM == t_sheet[jj].racontrollerprefab_command) { //<item> t_tag_list.Add(t_sheet[jj].racontrollerprefab_tag); t_path_list.Add(new File.Path(t_sheet[jj].racontrollerprefab_assetspath)); } else { //無関係。複合シート。 } } } else { Tool.Assert(false); } } } //保存。 { Fee.Instantiate.RuntimeAnimatorControllerList_Tool.ResourceItem[] t_resource_list = new Instantiate.RuntimeAnimatorControllerList_Tool.ResourceItem[t_tag_list.Count]; for (int ii = 0; ii < t_tag_list.Count; ii++) { t_resource_list[ii] = new Instantiate.RuntimeAnimatorControllerList_Tool.ResourceItem(t_tag_list[ii], t_path_list[ii]); } UnityEngine.GameObject t_prefab = new UnityEngine.GameObject("prefab_temp"); Fee.Instantiate.RuntimeAnimatorControllerList_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); } }
/** リクエスト。ロードアセットパス。テキストファイル。 */ public bool RequestLoadAssetsPathTextFile(Fee.File.Path a_relative_path) { if (this.is_busy == false) { this.is_busy = true; //is_cancel this.is_cancel = false; //result this.result_progress = 0.0f; this.result_errorstring = null; this.result_type = ResultType.None; this.result_asset = null; //request this.request_relative_path = a_relative_path; this.request_binary = null; this.request_text = null; this.request_texture = null; Function.Function.StartCoroutine(this.DoLoadAssetsPathTextFile()); return(true); } return(false); }
/** リクエスト。ロードストリーミングアセット。サウンドプール。 * * ロード後ローカルセーブ。 * */ public Item RequestLoadStreamingAssetsSoundPool(Fee.File.Path a_relative_path, uint a_data_version) { WorkItem t_work_item = new WorkItem(); t_work_item.RequestLoadStreamingAssetsSoundPool(a_relative_path, a_data_version); this.add_list.Add(t_work_item); return(t_work_item.GetItem()); }
/** constructor */ public PathItem(AssetBundlePathType a_assetbundle_pathtype, Fee.File.Path a_assetbundle_path) { //assetbundle_pathtype this.assetbundle_pathtype = a_assetbundle_pathtype; //assetbundle_path this.assetbundle_path = a_assetbundle_path; }
/** シーンを開く。 */ public static void OpenScene(Fee.File.Path a_path) { try{ UnityEditor.SceneManagement.EditorSceneManager.OpenScene("Assets/" + a_path.GetPath(), UnityEditor.SceneManagement.OpenSceneMode.Single); }catch (System.Exception t_exception) { Tool.EditorLogError(t_exception.Message); } }
/** アセットバンドル。作成。 */ public static void BuildAssetBundles(Fee.File.Path a_path, UnityEditor.AssetBundleBuild[] a_list, UnityEditor.BuildAssetBundleOptions a_option, UnityEditor.BuildTarget a_buildtarget) { try{ UnityEditor.BuildPipeline.BuildAssetBundles("Assets/" + a_path.GetPath(), a_list, a_option, a_buildtarget); }catch (System.Exception t_exception) { Tool.EditorLogError(t_exception.Message); } }
/** constructor */ public ResourceItem_Directory(string a_prefix, Fee.File.Path a_assets_path) { //prefix this.prefix = a_prefix; //path this.path = a_assets_path; }
/** constructor */ public ResourceItem(string a_tag, Fee.File.Path a_assets_path) { //tag this.tag = a_tag; //path this.path = a_assets_path; }
/** constructor */ public FindItem(Fee.File.Path a_path, UnityEngine.AnimationClip a_animationclip) { //path this.path = a_path; //animationclip this.animationclip = a_animationclip; }
/** リクエスト。ロードローカル。サウンドプール。 * * 管理ファイルを直接ロード。 * */ public Item RequestLoadLocalSoundPool(Fee.File.Path a_relative_path) { WorkItem t_work_item = new WorkItem(); t_work_item.RequestLoadLocalSoundPool(a_relative_path); this.add_list.Add(t_work_item); return(t_work_item.GetItem()); }
/** コンバート。 */ public static void Convert(string a_convert_param, Fee.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_state_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>(); 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_AnimatorController.COMMAND_ITEM == t_sheet[jj].animatorcontroller_command) { //<item> t_state_list.Add(t_sheet[jj].animatorcontroller_state); t_path_list.Add(new File.Path(t_sheet[jj].animatorcontroller_assetspath)); } else { //無関係。複合シート。 } } } else { Tool.Assert(false); } } } //保存。 { UnityEditor.Animations.AnimatorController t_controller = UnityEditor.Animations.AnimatorController.CreateAnimatorControllerAtPath("Assets/" + a_assets_path.GetPath()); for (int ii = 0; ii < t_state_list.Count; ii++) { UnityEditor.Animations.AnimatorState t_state = t_controller.layers[0].stateMachine.AddState(t_state_list[ii]); t_state.motion = Fee.EditorTool.AssetTool.LoadAsset <UnityEngine.AnimationClip>(t_path_list[ii]); } UnityEditor.AssetDatabase.SaveAssets(); } } else { Tool.Assert(false); } }catch (System.Exception t_exception) { Tool.DebugReThrow(t_exception); } }
/** コンバート。 * * a_param : パラメータ。 * a_assets_path : アセットフォルダからの相対パス。 * a_sheet : JSONシート。 * */ public static void Convert(string a_param, Fee.File.Path a_assets_path, Fee.JsonItem.JsonItem[] a_sheet) { try{ if (a_sheet != null) { System.Collections.Generic.List <string> t_tag_list = new System_Tuple.Collections.Generic.List <string>(); System.Collections.Generic.List <Fee.File.Path> t_path_list = new System_Tuple.Collections.Generic.List <Fee.File.Path>(); System.Collections.Generic.List <float> t_volume_list = new System_Tuple.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 (Convert_TextAssetSheet.TEXTASSETCOMMAND_ITEM == t_sheet[jj].textasset_command) { //<item> t_tag_list.Add(t_sheet[jj].textasset_tag); t_path_list.Add(new File.Path(t_sheet[jj].textasset_assetspath)); } else { //無関係。複合シート。 } } } else { Tool.Assert(false); } } } //保存。 { Fee.Instantiate.TextAssetList_Tool.ResourceItem[] t_textasset_list = new Instantiate.TextAssetList_Tool.ResourceItem[t_tag_list.Count]; for (int ii = 0; ii < t_tag_list.Count; ii++) { t_textasset_list[ii] = new Instantiate.TextAssetList_Tool.ResourceItem(t_tag_list[ii], t_path_list[ii]); } Fee.Instantiate.TextAssetList_Tool.Create(a_assets_path, t_textasset_list); } } else { Tool.Assert(false); } }catch (System.Exception t_exception) { Tool.DebugReThrow(t_exception); } }
/** SaveMesh */ public static void SaveMesh(UnityEngine.Mesh a_mesh, Fee.File.Path a_assets_path) { try{ UnityEngine.Mesh t_new = UnityEngine.Object.Instantiate <UnityEngine.Mesh>(a_mesh); UnityEditor.AssetDatabase.CreateAsset(t_new, "Assets/" + a_assets_path.GetPath()); }catch (System.Exception t_exception) { Tool.EditorLogError(t_exception.Message); } }
/** リクエスト。ロードローカル。パック。 * * 管理ファイルを直接ロード。 * */ public Item RequestLoadLocalPack(Fee.File.Path a_relative_path) { System.Collections.Generic.LinkedListNode <WorkItem> t_work_node = this.work_pool.Alloc(); t_work_node.Value.Reset(); t_work_node.Value.RequestLoadLocalPack(a_relative_path); this.work_add.AddLast(t_work_node); return(t_work_node.Value.GetItem()); }
/** 開く。 */ public bool ReadOpen(Fee.File.Path a_path) { this.raw_excel = Excel_ExcelDataReader_Tool.Open(a_path); if (this.raw_excel == null) { return(false); } return(true); }
/** ディレクトリ。作成。 */ public static void CreateDirectory(Fee.File.Path a_assets_path) { try{ if (System.IO.Directory.Exists(Fee.File.Path.CreateAssetsPath(a_assets_path, Fee.File.Path.SEPARATOR).GetPath()) == false) { System.IO.Directory.CreateDirectory(Fee.File.Path.CreateAssetsPath(a_assets_path, Fee.File.Path.SEPARATOR).GetPath()); } }catch (System.Exception t_exception) { Tool.EditorLogError(t_exception.Message); } }
/** ファイル。削除。 */ public static void DeleteFile(Fee.File.Path a_assets_path) { try{ if (System.IO.File.Exists(Fee.File.Path.CreateAssetsPath(a_assets_path, Fee.File.Path.SEPARATOR).GetPath()) == true) { System.IO.File.Delete(Fee.File.Path.CreateAssetsPath(a_assets_path, Fee.File.Path.SEPARATOR).GetPath()); } }catch (System.Exception t_exception) { Tool.EditorLogError(t_exception.Message); } }
/** ExportPackage */ public static void ExportPackage(Fee.File.Path a_assets_path, string a_package_name, UnityEditor.ExportPackageOptions a_option) { try{ string t_path = "Assets/" + a_assets_path.GetPathCutLastSeparator(); Tool.EditorLog("ExportPackage : " + t_path + " : " + a_package_name); UnityEditor.AssetDatabase.ExportPackage(t_path, a_package_name, a_option); }catch (System.Exception t_exception) { Tool.EditorLogError(t_exception.Message); } }
/** ExportPackage * * a_assets_path : アセットフォルダからの相対パス。 * */ public static void ExportPackage(Fee.File.Path a_assets_path, string a_package_name, UnityEditor.ExportPackageOptions a_option) { try{ string t_path = "Assets/" + a_assets_path.GetNormalizePath(); UnityEngine.Debug.Log("ExportPackage : " + t_path + " : " + a_package_name); UnityEditor.AssetDatabase.ExportPackage(t_path, a_package_name, a_option); }catch (System.Exception t_exception) { UnityEngine.Debug.LogError(t_exception.Message); } }
/** データ。登録。 */ public void RegistDataItem(string a_id, PathType a_path_type, Fee.File.Path a_path, string a_assetbundle_name) { if (this.list.ContainsKey(a_id) == false) { this.list.Add(a_id, new ListItem(a_id, a_path_type, a_path, a_assetbundle_name)); } else { Tool.Assert(false); } }
/** constructor */ public ResourceItem(string a_tag, Fee.File.Path a_assets_path, string a_clipanimation_name) { //tag this.tag = a_tag; //path this.path = a_assets_path; //clipanimation_name this.clipanimation_name = a_clipanimation_name; }