//**************************** CSVのロード用 ****************************// /// <summary> /// CSVファイルからロードして初期化 /// </summary> /// <param name="parent">コルーチンをまわすためのMonoBehaviour</param> /// <param name="url">ファイルパス</param> /// <param name="version">シナリオバージョン(-1以下で必ずサーバーからデータを読み直す)</param> /// <returns></returns> public IEnumerator LoadCsvAsync(MonoBehaviour parent, string url, int version) { //起動ファイルの読み込み { AssetFile file = AssetFileManager.GetFileCreateIfMissing(url); if (version < 0) { file.Version = file.CacheVersion + 1; } AssetFileManager.Load(file, this); while (!file.IsLoadEnd) { yield return(0); } SettingData.InitFromCsv(file.Csv, url); file.Unuse(this); } parent.StartCoroutine(ScenarioSetting.LoadCsvAsync(SettingData.ScenarioSettingUrlList)); parent.StartCoroutine(CharacterSetting.LoadCsvAsync(SettingData.CharacterSettingUrlList)); parent.StartCoroutine(TextureSetting.LoadCsvAsync(SettingData.TextureSettingUrlList)); parent.StartCoroutine(SoundSetting.LoadCsvAsync(SettingData.SoundSettingUrlList)); parent.StartCoroutine(DefaultParam.LoadCsvAsync(SettingData.ParamSettingUrlList)); parent.StartCoroutine(LayerSetting.LoadCsvAsync(SettingData.LayerSettingUrlList)); parent.StartCoroutine(SceneGallerySetting.LoadCsvAsync(SettingData.SceneGallerySettingUrlList)); while (!IsLoadEndCsv()) { yield return(0); } }
/// <summary> /// テクスチャファイルを設定 /// </summary> /// <param name="path">ファイルパス</param> public void LoadTextureFile(string path) { AssetFile file = AssetFileManager.Load(path, this); SetTextureFile(file); file.Unuse(this); }
/// <summary> /// テクスチャファイルを設定 /// </summary> /// <param name="path">ファイルパス</param> /// <param name="pixelsToUnits">スプライトを作成する際の、座標1.0単位辺りのピクセル数</param> public void SetTextureFile(string path, float pixelsToUnits) { AssetFile file = AssetFileManager.Load(path, this); SetTextureFile(file, pixelsToUnits); file.Unuse(this); }
//**************************** CSVのロード用 ****************************// /// <summary> /// CSVファイルからロードして初期化 /// </summary> /// <param name="parent">コルーチンをまわすためのMonoBehaviour</param> /// <param name="url">ファイルパス</param> /// <param name="version">シナリオバージョン(-1以下で必ずサーバーからデータを読み直す)</param> /// <returns></returns> public IEnumerator LoadCsvAsync(MonoBehaviour parent, string url, int version) { //起動ファイルの読み込み { AssetFile file = AssetFileManager.Load(url, version, this); Debug.Log("Boot Scenario Version:" + file.Version); while (!file.IsLoadEnd) { yield return(0); } SettingData.InitFromCsv(file.Csv, url); file.Unuse(this); } importVersion = Version; parent.StartCoroutine(ScenarioSetting.LoadCsvAsync(SettingData.ScenarioSettingUrlList)); parent.StartCoroutine(CharacterSetting.LoadCsvAsync(SettingData.CharacterSettingUrlList)); parent.StartCoroutine(TextureSetting.LoadCsvAsync(SettingData.TextureSettingUrlList)); parent.StartCoroutine(SoundSetting.LoadCsvAsync(SettingData.SoundSettingUrlList)); parent.StartCoroutine(DefaultParam.LoadCsvAsync(SettingData.ParamSettingUrlList)); parent.StartCoroutine(LayerSetting.LoadCsvAsync(SettingData.LayerSettingUrlList)); parent.StartCoroutine(SceneGallerySetting.LoadCsvAsync(SettingData.SceneGallerySettingUrlList)); while (!IsLoadEndCsv()) { yield return(0); } }
IEnumerator CoLoadAndInitScenariodData(AdvScenarioSettingData scenarioSetting) { string scenaioFileName = scenarioSetting.ScenaioFile; //既にある(エクスポートされたデータの可能性あり) if (scenarioDataTbl.ContainsKey(scenaioFileName)) { yield break; } string path = SettingDataManager.ScenarioSetting.ScenaioFileToPath(scenaioFileName); AdvScenarioData data = new AdvScenarioData(); AssetFile file = AssetFileManager.BackGroundLoad(path, this); while (!file.IsLoadEnd) { yield return(0); } data.Init(scenaioFileName, file.Csv, SettingDataManager); file.Unuse(this); scenarioDataTbl.Add(scenaioFileName, data); --loadingScenarioCount; }
//サウンドをロードして鳴らす IEnumerator CoPlaySound(string path) { AssetFile file = AssetFileManager.Load(path, this); while (!file.IsLoadEnd) { yield return(0); } Engine.SoundManager.PlayBgm(file); file.Unuse(this); }
//サウンドをロードして鳴らす IEnumerator CoPlaySound(string path) { AssetFile file = AssetFileManager.Load(path, this); while (!file.IsLoadEnd) { yield return(0); } Engine.SoundManager.Play(SoundManager.StreamType.Bgm, file, true, false); file.Unuse(this); }
//サウンドをロードして鳴らす protected virtual IEnumerator CoPlaySound(string path) { isChangedBgm = true; AssetFile file = AssetFileManager.Load(path, this); while (!file.IsLoadEnd) { yield return(null); } Engine.SoundManager.PlayBgm(file); file.Unuse(this); }
//ボイスの再生 IEnumerator CoPlayVoice(AdvEngine engine, AssetFile voiceFile, string charcterLabel) { if (voiceFile == null) { Debug.LogError("Backlog voiceFile is NULL"); } AssetFileManager.Load(voiceFile, this); while (!voiceFile.IsReadyStreaming) { yield return(0); } engine.SoundManager.PlayVoice(charcterLabel, voiceFile); voiceFile.Unuse(this); }
//ボイスの再生 IEnumerator CoPlayVoice(AdvEngine engine, AssetFile voiceFile) { if (voiceFile == null) { Debug.LogError("Backlog voiceFile is NULL"); } AssetFileManager.Load(voiceFile, this); while (!voiceFile.IsReadyStreaming) { yield return(0); } engine.SoundManager.Play(SoundManager.StreamType.Voice, voiceFile, false, true); voiceFile.Unuse(this); }
//指定のファイル名をロードして鳴らす IEnumerator CoLoadAndPlayFile(string path, float masterVolume, float volume, bool isLoop, bool isStreaming) { if (!string.IsNullOrEmpty(path)) { AssetFile file = AssetFileManager.GetFileCreateIfMissing(path); if (isStreaming) { file.AddLoadFlag(AssetFileLoadFlags.Streaming); } AssetFileManager.Load(file, this); while (!file.IsLoadEnd) { yield return(0); } file.AddReferenceComponet(this.gameObject); file.Unuse(this); Play(file.Sound, 0.1f, masterVolume, volume, isLoop, isStreaming); } }
internal IEnumerator CoLoadAndiInit(System.Action <string, AssetFile> OnCompleteLoadScenario, System.Action OnCompleteLoadScenarioAll) { IsLoadEndAllScenario = false; //TSVシナリオファイルをロード foreach (AdvScenarioSettingData scenarioSetting in List) { string sheetName = scenarioSetting.ScenaioSheetName; string path = ScenaioFileToPath(scenarioSetting.ScenaioFile); AssetFile file = AssetFileManager.BackGroundLoad(path, this); while (!file.IsLoadEnd) { yield return(0); } OnCompleteLoadScenario(sheetName, file); file.Unuse(this); } OnCompleteLoadScenarioAll(); IsLoadEndAllScenario = true; }
/// <summary> /// セーブデータ用のバイナリ読みこみ /// </summary> /// <param name="reader">バイナリリーダー</param> public void Read(BinaryReader reader) { UtageToolKit.ReadLocalTransform(this.transform, reader); this.LocalColor = UtageToolKit.ReadColor(reader); //Tweenがある場合は、Tween情報を読み込む int tweenCount = reader.ReadInt32(); for (int i = 0; i < tweenCount; ++i) { iTweenPlayer tween = this.gameObject.AddComponent <iTweenPlayer>() as iTweenPlayer; tween.Read(reader, pixelsToUnits); } string nameCurrenTexture = reader.ReadString(); AssetFile texture = AssetFileManager.Load(nameCurrenTexture, this); currentSprite = CreateSprite(texture); texture.Unuse(this); }
/// <summary> /// テクスチャファイルを設定 /// </summary> /// <param name="file">テクスチャファイル</param> /// <param name="pixelsToUnits">スプライトを作成する際の、座標1.0単位辺りのピクセル数</param> public void SetTextureFile(GraphicInfo graphic, float pixelsToUnits) { this.GraphicInfo = graphic; //直前のファイルがあればそれを削除 ClearTextureFile(); AssetFile file = AssetFileManager.Load(graphicInfo.File, this); File.AddReferenceComponet(this.gameObject); file.Unuse(this); if (File.IsLoadEnd) { SetTextureFileSprite(pixelsToUnits); } else { StartCoroutine(CoWaitTextureFileLoading(pixelsToUnits)); } }
//ボイスの再生 IEnumerator CoPlayVoice(string voiceFileName, string charcterLabel) { AssetFile file = AssetFileManager.Load(voiceFileName, this); if (file == null) { Debug.LogError("Backlog voiceFile is NULL"); yield break; } while (!file.IsLoadEnd) { yield return(0); } SoundManager manager = SoundManager.GetInstance(); if (manager) { manager.PlayVoice(charcterLabel, file); } file.Unuse(this); }
//指定のファイル名をロードして鳴らす IEnumerator CoLoadAndPlayFile(string path, float volume, bool isLoop, bool isStreaming, Func <float> callbackMasterVolume) { if (!string.IsNullOrEmpty(path)) { AssetFile file = AssetFileManager.GetFileCreateIfMissing(path); if (isStreaming) { file.AddLoadFlag(AssetFileLoadFlags.Streaming); } AssetFileManager.Load(file, this); while (!file.IsLoadEnd) { yield return(0); } SoundStream stream = Play(file.Sound, 0.1f, volume, isLoop, isStreaming, callbackMasterVolume); stream.FadeIn(0.1f); file.AddReferenceComponet(stream.gameObject); file.Unuse(this); } isLoading = false; }
protected IEnumerator CoLoadGraphic(GraphicInfoList graphic, Action OnComplete) { IsLoading = true; //直前のファイルがあればそれを削除 foreach (var item in this.GetComponents <AssetFileReference>()) { Destroy(item); } foreach (var item in graphic.InfoList) { AssetFile file = AssetFileManager.Load(item.File, this); file.AddReferenceComponet(this.gameObject); file.Unuse(this); } while (!graphic.IsLoadEnd) { yield return(0); } OnComplete(); IsLoading = false; }
//**************************** TSVのロード用 ****************************// /// <summary> /// TSVをロード /// </summary> /// <param name="url">ファイルパス</param> /// <param name="version">シナリオバージョン(-1以下で必ずサーバーからデータを読み直す)</param> /// <returns></returns> internal IEnumerator CoLoadFromTsv(string url, int version) { //起動ファイルの読み込み AssetFile bootFile = AssetFileManager.Load(url, version, this); Debug.Log("Load Chapter : " + ChapterName + " :Ver " + bootFile.Version); while (!bootFile.IsLoadEnd) { yield return(null); } string rootDir = FilePathUtil.GetDirectoryPath(url); //設定ファイルの読み込み List <AssetFile> settingFileList = new List <AssetFile>(); { StringGrid grid = bootFile.Csv; foreach (StringGridRow row in grid.Rows) { if (row.RowIndex < grid.DataTopRow) { continue; //データの行じゃない } if (row.IsEmptyOrCommantOut) { continue; //データがない } string path = AdvParser.ParseCell <string>(row, AdvColumnName.Param1); int ver = AdvParser.ParseCell <int>(row, AdvColumnName.Version); settingFileList.Add(AssetFileManager.Load(FilePathUtil.Combine(rootDir, path), ver, this)); } } //設定ファイルの読み込み List <AssetFile> scenarioFileList = new List <AssetFile>(); foreach (var item in settingFileList) { while (!item.IsLoadEnd) { yield return(null); } if (!item.IsLoadError) { StringGrid grid = item.Csv; if (grid.SheetName != AdvSheetParser.SheetNameScenario) { this.RuntimeGridList.Add(grid); } else { foreach (StringGridRow row in grid.Rows) { if (row.RowIndex < grid.DataTopRow) { continue; //データの行じゃない } if (row.IsEmptyOrCommantOut) { continue; //データがない } string path = AdvParser.ParseCell <string>(row, AdvColumnName.FileName); int ver = AdvParser.ParseCellOptional <int>(row, AdvColumnName.Version, 0); //旧形式(ファイル分割なし)に対応 if (!path.Contains("/")) { path = "Scenario/" + path; } path += ".tsv"; scenarioFileList.Add(AssetFileManager.Load(FilePathUtil.Combine(rootDir, path), ver, this)); } } } item.Unuse(this); } foreach (var item in scenarioFileList) { while (!item.IsLoadEnd) { yield return(null); } if (!item.IsLoadError) { this.RuntimeGridList.Add(item.Csv); } item.Unuse(this); } bootFile.Unuse(this); // Debug.Log("Load End Chapter : " + url + " :Ver " + bootFile.Version); Debug.Log("Load End Chapter : " + ChapterName + " :Ver " + bootFile.Version); }
//ボイスの再生 IEnumerator CoPlayVoice( AdvEngine engine, AssetFile voiceFile, string charcterLabel) { if (voiceFile == null) { Debug.LogError("Backlog voiceFile is NULL"); } AssetFileManager.Load(voiceFile, this); while (!voiceFile.IsReadyStreaming) { yield return 0; } engine.SoundManager.PlayVoice(charcterLabel, voiceFile); voiceFile.Unuse(this); }