/// <summary> /// モデルパスリストを生成する /// </summary> /// <returns></returns> private List <string> CreateModelPathList() { List <string> result = new List <string>(); ////ストリーミングアセットのパスを取得する string path = UtilUnityPath.GetStreamingAssetsPath() + ModelPathDefine.MODELS; ////パス出力 //Debug.Log(path); ////フォルダリスト取得 //string[] dirs = Directory.GetDirectories(path); ////リスト生成 //foreach (string dir in dirs) //{ // result.Add(dir.Replace("\\","/")); //} //result.Add(path + "/Hazuki"); //result.Add(path + "/Kuroha"); //result.Add(path + "/Momoha"); //result.Add(path + "/Shiroha"); LiplisMoonlightModels models = PrisetModelSettingLoader.LoadClassFromJson <LiplisMoonlightModels>(path + ModelPathDefine.LIPLIS_MODELS_JSON); //パスを生成する foreach (var item in models.ModelList) { result.Add(path + item); } return(result); }
/// <summary> /// ラビッツモデルを生成する /// </summary> /// <param name="modelPathAnderResource"></param> /// <returns></returns> private LiplisModel LoadModel(string modelPath, int AllocationId, int modelNum) { //モデル設定を取得する LiplisMoonlightModel lmm = PrisetModelSettingLoader.LoadClassFromJson <LiplisMoonlightModel>(modelPath + ModelPathDefine.LIPLIS_MODEL_JSON); LiplisToneSetting ltn = PrisetModelSettingLoader.LoadClassFromJson <LiplisToneSetting>(modelPath + ModelPathDefine.SETTINGS + ModelPathDefine.LIPLIS_TONE_SETTING); LiplisChatSetting lch = PrisetModelSettingLoader.LoadClassFromJson <LiplisChatSetting>(modelPath + ModelPathDefine.SETTINGS + ModelPathDefine.LIPLIS_CHAT_SETTING); //ウインドウイメージの読み込み Texture2D TextureWindow = PrisetModelSettingLoader.LoadTexture(modelPath + ModelPathDefine.IMAGES + ModelPathDefine.IMG_WINDOW) as Texture2D; Texture2D TextureLogWindow = PrisetModelSettingLoader.LoadTexture(modelPath + ModelPathDefine.IMAGES + ModelPathDefine.IMG_WINDOW_LOG) as Texture2D; Texture2D TextureCharIcon = PrisetModelSettingLoader.LoadTexture(modelPath + ModelPathDefine.IMAGES + ModelPathDefine.IMG_ICON_CHAR) as Texture2D; //モデルを追加する return(new LiplisModel(AllocationId, modelPath, lmm, ltn, lch, TextureWindow, TextureLogWindow, TextureCharIcon, modelNum)); }
/// <summary> /// Loads asset. /// </summary> /// <param name="assetType">Asset type.</param> /// <param name="absolutePath">Path to asset.</param> /// <returns>The asset on success; <see langword="null"/> otherwise.</returns> public static object LoadAsset(Type assetType, string absolutePath) { if (assetType == typeof(byte[])) { return(PrisetModelSettingLoader.LoadBinary(absolutePath)); } else if (assetType == typeof(string)) { return(PrisetModelSettingLoader.LoadText(absolutePath)); } else if (assetType == typeof(Texture2D)) { return(PrisetModelSettingLoader.LoadTexture(absolutePath)); } // Fail hard. throw new NotSupportedException(); }
/// <summary> /// ラビッツモデルを生成する /// </summary> /// <param name="modelPathAnderResource"></param> /// <returns></returns> private LiplisModel CreateModelRabbits(string modelPathAnderResource, int AllocationId) { //モデルパス生成 string modelPath = UtilUnityPath.GetStreamingAssetsPath() + "/" + modelPathAnderResource; //モデル設定を取得する LiplisMoonlightModel lmm = PrisetModelSettingLoader.LoadClassFromJson <LiplisMoonlightModel>(modelPath + ModelPathDefine.LIPLIS_MODEL_JSON); LiplisToneSetting ltn = PrisetModelSettingLoader.LoadClassFromJson <LiplisToneSetting>(modelPath + ModelPathDefine.SETTINGS + ModelPathDefine.LIPLIS_TONE_SETTING); LiplisChatSetting lch = PrisetModelSettingLoader.LoadClassFromJson <LiplisChatSetting>(modelPath + ModelPathDefine.SETTINGS + ModelPathDefine.LIPLIS_CHAT_SETTING); //ウインドウイメージの読み込み Texture2D TextureWindow = PrisetModelSettingLoader.LoadTexture(modelPath + ModelPathDefine.IMAGES + ModelPathDefine.IMG_WINDOW) as Texture2D; Texture2D TextureLogWindow = PrisetModelSettingLoader.LoadTexture(modelPath + ModelPathDefine.IMAGES + ModelPathDefine.IMG_WINDOW_LOG) as Texture2D; Texture2D TextureCharIcon = PrisetModelSettingLoader.LoadTexture(modelPath + ModelPathDefine.IMAGES + ModelPathDefine.IMG_ICON_CHAR) as Texture2D; //モデルを追加する return(new LiplisModel(AllocationId, CanvasRendering, modelPath, ctrlTalk.NextTalkOrSkip, lmm, ltn, lch, TextureWindow, TextureLogWindow, TextureCharIcon)); }