//シナリオラベルを解析・取得 static public string ParseScenarioLabel(StringGridRow row, AdvColumnName name) { string label; if (!TryParseScenarioLabel(row, name, out label)) { Debug.LogError(row.ToErrorString(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.NotScenarioLabel, label))); } return(label); }
// シナリオラベルを解析 static public string ParseScenarioLabel(StringGridRow row, AdvColumnName columnName) { string label = AdvParser.ParseCell <string>(row, columnName); if (!IsScenarioLabel(label)) { Debug.LogError(row.ToErrorString(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.NotScenarioLabel))); } return(label.Substring(1)); }
//シナリオラベルを解析・取得 public virtual string ParseScenarioLabel(AdvColumnName name) { string label; if (!AdvCommandParser.TryParseScenarioLabel(this.RowData, name, out label)) { Debug.LogError(ToErrorString(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.NotScenarioLabel, ParseCell <string>(name)))); } return(label); }
/// <summary> /// 指定シナリオラベルの指定ページのコマンドインデックスを取得 /// </summary> /// <param name="scenarioLabel">シナリオラベル</param> /// <param name="page">ページ</param> /// <returns>ページのコマンドインデックス</returns> public int SeekPageIndex(string scenarioLabel, int page) { int index = 0; if (Name == scenarioLabel) { //シナリオ名そのものだった場合は一番最初から index = 0; } else { //シナリオラベルをシーク while (true) { AdvCommand command = GetCommand(index); if (null == GetCommand(index)) { Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.NotFoundScnarioLabel, scenarioLabel)); return(0); } if (command.GetScenarioLabel() == scenarioLabel) { break; } ++index; } } if (page < 0) { //シナリオラベル冒頭 return(index); } int pageCount = 0; //シナリオラベルからの指定のページまでシーク while (true) { AdvCommand command = GetCommand(index); if (null == command) { //指定のページ数がなかったので、ここまでで終了 return(index - 1); } if (command.IsTypePageEnd()) { if (pageCount >= page) { return(index); } ++pageCount; } ++index; } }
//シナリオラベル区切りのデータを作成 void MakeScanerioLabelData(List <AdvCommand> commandList) { if (commandList.Count <= 0) { return; } //最初のラベル区切りデータは自身の名前(シート名) string scenarioLabel = Name; AdvCommandScenarioLabel scenarioLabelCommand = null; AdvScenarioLabelData scenarioLabelData = null; int commandIndex = 0; do { int begin = commandIndex; //コマンドを追加 while (commandIndex < commandList.Count) { //シナリオラベルがあるので、終了 if (commandList[commandIndex] is AdvCommandScenarioLabel) { break; } ++commandIndex; } if (IsContainsScenarioLabel(scenarioLabel)) { //重複してないかチェック Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.RedefinitionScenarioLabel, scenarioLabel, DataGridName)); } else { //ラベルデータ追加 AdvScenarioLabelData next = new AdvScenarioLabelData(scenarioLabel, scenarioLabelCommand, commandList.GetRange(begin, commandIndex - begin)); if (scenarioLabelData != null) { scenarioLabelData.Next = next; } scenarioLabelData = next; scenarioLabels.Add(scenarioLabel, next); } if (commandIndex >= commandList.Count) { break; } scenarioLabelCommand = commandList[commandIndex] as AdvCommandScenarioLabel; scenarioLabel = scenarioLabelCommand.ScenarioLabel; ++commandIndex; } while (true); }
/// <summary> /// 背景テクスチャの設定 /// </summary> /// <param name="file">テクスチャファイル</param> /// <param name="x">表示座標X floatのobject nullを指定することで位置移動なし</param> /// <param name="y">表示座標Y floatのobject nullを指定することで位置移動なし</param> /// <param name="fadeTime">フェード時間</param> public void SetBgSprite(AssetFile file, object x, object y, float fadeTime) { if (BgLayer == null) { Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.BgLayerIsNotDefined)); } else { BgLayer.SetDefaultSprite(bgSpriteName, file, x, y, fadeTime); } }
/// <summary> /// else if文の開始 /// </summary> /// <param name="param">判定に使う数値パラメーター</param> /// <param name="exp">判定式</param> public void ElseIf(AdvParamManager param, ExpressionParser exp) { if (current == null) { if (!IsLoadInit) { Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.ElseIf, exp)); } current = new AdvIfData(); } current.ElseIf(param, exp); }
/// <summary> /// else文の開始 /// </summary> public void Else() { if (current == null) { if (!IsLoadInit) { Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.Else)); } current = new AdvIfData(); } current.Else(); }
public void Else() { if (this.current == null) { if (!this.IsLoadInit) { Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.Else, new object[0])); } this.current = new AdvIfData(); } this.current.Else(); }
//シナリオラベル区切りのデータを作成 void MakeScanerioLabelData(List <AdvCommand> commandList) { if (commandList.Count <= 0) { return; } //最初のラベル区切りデータは自身の名前(シート名) AdvScenarioLabelData data = new AdvScenarioLabelData(Name, null); int commandIndex = 0; while (true) { //重複してないかチェック if (IsContainsScenarioLabel(data.ScenaioLabel)) { Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.RedefinitionScenarioLabel, data.ScenaioLabel, DataGridName)); break; } scenarioLabelData.Add(data); //コマンドを追加 while (commandIndex < commandList.Count) { AdvCommand command = commandList[commandIndex]; //シナリオラベルがあるので、終了 if (!string.IsNullOrEmpty(command.GetScenarioLabel())) { break; } data.AddCommand(command); ///このシナリオからリンクするジャンプ先のシナリオラベルを取得 string[] jumpLabels = command.GetJumpLabels(); if (jumpLabels != null) { foreach (var jumpLabel in jumpLabels) { jumpScenarioData.Add(new AdvScenarioJumpData(jumpLabel, command.RowData)); } } ++commandIndex; } //ページデータの初期化処理 data.InitPages(); if (commandIndex >= commandList.Count) { break; } data = new AdvScenarioLabelData(commandList[commandIndex].GetScenarioLabel(), commandList[commandIndex] as AdvCommandScenarioLabel); ++commandIndex; } }
public void ElseIf(AdvParamManager param, ExpressionParser exp) { if (this.current == null) { if (!this.IsLoadInit) { object[] args = new object[] { exp }; Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.ElseIf, args)); } this.current = new AdvIfData(); } this.current.ElseIf(param, exp); }
/// <summary> /// シーン回想のためのシーンの終了処理 /// </summary> /// <param name="engine">ADVエンジン</param> public void EndSceneGallery(AdvEngine engine) { if (string.IsNullOrEmpty(currentGallerySceneLabel)) { //シーン回想に登録されていないのに、シーン回想終了がされています Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.EndSceneGallery)); } else { engine.SystemSaveData.GalleryData.AddSceneLabel(currentGallerySceneLabel); currentGallerySceneLabel = ""; } }
bool ImportChapter(string chapterName, List <string> pathList) { if (pathList.Count <= 0) { return(false); } List <AdvImportBook> bookAssetList = new List <AdvImportBook>(); //エクセルファイルのアセットを取得 foreach (var path in pathList) { if (string.IsNullOrEmpty(path)) { continue; } AdvImportBook bookAsset; //再インポートが必要なアセットを取得 //失敗する→再インポートが必要なし if (CheckReimport(path, out bookAsset)) { Debug.Log("Reimport " + path); //対象のエクセルファイルを読み込み StringGridDictionary book = ReadExcel(path); if (book.List.Count <= 0) { //中身がない continue; } //末尾の空白文字をチェック if (Project.CheckWhiteSpaceEndOfCell) { CheckWhiteSpaceEndOfCell(book); } bookAsset.Clear(); bookAsset.AddSrourceBook(book); } bookAssetList.Add(bookAsset); } //インポート処理をする ImportChapter(chapterName, bookAssetList); //変更を反映 foreach (var asset in bookAssetList) { Debug.Log(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.Import, asset.name)); EditorUtility.SetDirty(asset); } return(true); }
/// <summary> /// 指定のシナリオラベルが既にロード終了しているか /// </summary> public bool IsLoadEndScenarioLabel(string label) { AdvScenarioData scenarioData = FindScenarioData(label); if (null != scenarioData) { return(true); } string msg = LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.NotFoundScnarioLabel, label); Debug.LogError(msg); return(false); }
/// <summary> /// 設定データを探す /// </summary> public static IAdvSetting FindSettingData(AdvSettingDataManager settingManager, string sheetName) { switch (sheetName) { case SheetNameCharacter: return(settingManager.CharacterSetting); case SheetNameTexture: return(settingManager.TextureSetting); case SheetNameSound: return(settingManager.SoundSetting); case SheetNameLayer: return(settingManager.LayerSetting); case SheetNameSceneGallery: return(settingManager.SceneGallerySetting); case SheetNameLocalize: return(settingManager.LocalizeSetting); case SheetNameEyeBlink: return(settingManager.EyeBlinkSetting); case SheetNameLipSynch: return(settingManager.LipSynchSetting); case SheetNameParticle: return(settingManager.ParticleSetting); case SheetNameOtherObject: return(settingManager.OtherObjectSetting); default: if (IsParamSheetName(sheetName)) { return(settingManager.DefaultParam); } else if (IsAnimationSheetName(sheetName)) { return(settingManager.AnimationSetting); } else { Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.NotSettingSheet, sheetName)); return(null); } } }
/// <summary> /// else文の開始 /// </summary> public void Else() { if (Current == null) { //Curretがないのはエラー if (!OldSaveDataStart) { Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.Else)); } Current = new AdvIfData(Current); } if (!Current.IsParantSkipping) { Current.Else(); } }
/// <summary> /// else if文の開始 /// </summary> /// <param name="param">判定に使う数値パラメーター</param> /// <param name="exp">判定式</param> public void ElseIf(AdvParamManager param, ExpressionParser exp) { if (Current == null) { //Curretがないのはエラー if (!OldSaveDataStart) { Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.ElseIf, exp)); } Current = new AdvIfData(Current); } if (!Current.IsParantSkipping) { Current.ElseIf(param, exp); } }
/// <summary> /// if文の終了 /// </summary> public void EndIf() { if (current == null) { if (!IsLoadInit) { Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.EndIf)); } current = new AdvIfData(); } if (!current.IsParantSkipping) { current.EndIf(); } current = current.Parent; }
/// <summary> /// 指定のシナリオラベルが既にロード終了しているか /// </summary> public bool IsLoadEndScenarioLabel(string scenarioLabel) { AdvScenarioData scenarioData = FindScenarioData(scenarioLabel); if (null != scenarioData) { return(true); } if (IsLoadEndAllScenario) { Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.NotFoundScnarioLabel, scenarioLabel)); } return(false); }
/// <summary> /// 指定のシナリオラベルが既にロード終了しているか /// </summary> public bool IsLoadEndScenarioLabel(AdvScenarioJumpData jumpData) { AdvScenarioData scenarioData = FindScenarioData(jumpData.ToLabel); if (null != scenarioData) { return(true); } if (IsLoadEndAllScenario) { string msg = LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.NotFoundScnarioLabel, jumpData.ToLabel); Debug.LogError(jumpData.FromRow.ToErrorString(msg)); } return(false); }
/// <summary> /// シーン回想のためにシーンラベルを更新 /// </summary> /// <param name="label">シーンラベル</param> /// <param name="engine">ADVエンジン</param> void UpdateSceneGallery(string label, AdvEngine engine) { AdvSceneGallerySetting galleryData = engine.DataManager.SettingDataManager.SceneGallerySetting; if (galleryData.ContainsKey(label)) { if (currentGallerySceneLabel != label) { if (!string.IsNullOrEmpty(currentGallerySceneLabel)) { //別のシーンが終わってないのに、新しいシーンに移っている Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.UpdateSceneLabel, currentGallerySceneLabel, label)); } currentGallerySceneLabel = label; } } }
void CheckCharacterCount(List <AdvScenarioData> scenarioList, string language) { AdvScenarioCharacterCountChecker checker = new AdvScenarioCharacterCountChecker(); int count; if (checker.TryCheckCharacterCount(scenarioList, out count)) { if (string.IsNullOrEmpty(language)) { Debug.Log(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.ChacacterCountOnImport, count)); } else { Debug.Log(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.ChacacterCountOnImport, count) + " in " + language); } } }
/// <summary> /// if文の終了 /// </summary> public void EndIf() { if (Current == null) { //セーブデータ復帰直後ではないなら、Curretがないのはエラー if (!OldSaveDataStart) { Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.EndIf)); } Current = new AdvIfData(Current); } if (!Current.IsParantSkipping) { Current.EndIf(); } Current = Current.Parent; }
private void MakeScanerioLabelData(List <AdvCommand> commandList) { if (commandList.Count <= 0) { return; } string name = this.Name; AdvCommandScenarioLabel scenarioLabelCommand = null; AdvScenarioLabelData data = null; int num = 0; while (true) { int index = num; while (num < commandList.Count) { if (commandList[num] is AdvCommandScenarioLabel) { break; } num++; } if (this.IsContainsScenarioLabel(name)) { object[] args = new object[] { name, this.DataGridName }; Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.RedefinitionScenarioLabel, args)); } else { AdvScenarioLabelData data2 = new AdvScenarioLabelData(name, scenarioLabelCommand, commandList.GetRange(index, num - index)); if (data != null) { data.Next = data2; } data = data2; this.scenarioLabels.Add(name, data2); } if (num >= commandList.Count) { return; } scenarioLabelCommand = commandList[num] as AdvCommandScenarioLabel; name = scenarioLabelCommand.ScenarioLabel; num++; } }
//エフェクト開始時のコールバック protected override void OnStartEffect(GameObject target, AdvEngine engine, AdvScenarioThread thread) { if (target != null) { LetterBoxCamera camera = target.GetComponentInChildren <LetterBoxCamera>(); //現在の倍率 float zoom0 = camera.Zoom2D; //目標の倍率 float zoomTo = isEmptyZoom ? zoom0 : zoom; //現在の中心点、今の倍率が1の場合は目標の中心点と同じで扱う(無駄な補間を入れないため) Vector2 center0 = (zoom0 == 1) ? zoomCenter : camera.Zoom2DCenter; //目標の中心点 Vector2 centerTo = isEmptyZoomCenter ? center0 : zoomCenter; Timer = target.AddComponent <Timer>(); Timer.AutoDestroy = true; Timer.StartTimer( engine.Page.ToSkippedTime(this.time), engine.Time.Unscaled, (x) => { float zoom1 = Timer.GetCurve(zoom0, zoomTo); Vector2 center1 = Timer.GetCurve(center0, centerTo); camera.SetZoom2D(zoom1, center1); }, (x) => { //倍率1倍なら一応中心点を戻しておく if (zoomTo == 1) { camera.Zoom2DCenter = Vector2.zero; } OnComplete(thread); } ); } else { //記述ミス、タゲーットが見つからない Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.NotFoundTweenGameObject, "SpriteCamera")); OnComplete(thread); } }
public static AdvCommand CreateCommand(StringGridRow row, AdvSettingDataManager dataManager) { if (row.IsCommentOut || IsComment(row)) { return(null); } AdvCommand command = CreateCommand(ParseCommandID(row), row, dataManager); if (command != null) { return(command); } if (row.IsAllEmptyCellNamedColumn()) { return(command); } Debug.LogError(row.ToErrorString(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.CommandParseNull, new object[0]))); return(new AdvCommandError(row)); }
//ブックのインポート AdvImportBook ImportBook(StringGridDictionary book, string path) { //シナリオデータ用のスクリプタブルオブジェクトを宣言 string bookAssetPath = Path.ChangeExtension(path, BookAssetExt); AdvImportBook asset = UtageEditorToolKit.GetImportedAssetCreateIfMissing <AdvImportBook>(bookAssetPath); asset.hideFlags = HideFlags.NotEditable; asset.Clear(); foreach (var sheet in book.List) { asset.AddData(sheet.Grid); } //変更を反映 Debug.Log(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.Import, bookAssetPath)); EditorUtility.SetDirty(asset); return(asset); }
/// <summary> /// 設定データのエクセルシートを読み込む /// </summary> /// <param name="sheetName">シート名</param> /// <param name="grid">シートのStringGridデータ</param> public void ParseFromExcel(string sheetName, StringGrid grid) { importVersion = Version; switch (sheetName) { case SheetNameBoot: SettingData.InitFromStringGrid(grid); break; case SheetNameScenario: ScenarioSetting.InitFromStringGrid(grid); break; case SheetNameCharacter: CharacterSetting.InitFromStringGrid(grid); break; case SheetNameTexture: TextureSetting.InitFromStringGrid(grid); break; case SheetNameSound: SoundSetting.InitFromStringGrid(grid); break; case SheetNameLayer: LayerSetting.InitFromStringGrid(grid); break; case SheetNameParam: DefaultParam.InitFromStringGrid(grid); break; case SheetNameSceneGallery: SceneGallerySetting.InitFromStringGrid(grid); break; default: Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.NotSettingSheet, sheetName)); break; } }
void ParseFromCsvStringGridRow(StringGridRow row, string csvDir) { string tag = AdvParser.ParseCell <string>(row, AdvColumnName.Tag); switch (tag) { case TagScenarioSetting: AddUrltList(ScenarioSettingUrlList, row, csvDir); break; case TagCharacterSetting: AddUrltList(CharacterSettingUrlList, row, csvDir); break; case TagTextureSetting: AddUrltList(TextureSettingUrlList, row, csvDir); break; case TagSoundSetting: AddUrltList(SoundSettingUrlList, row, csvDir); break; case TagParamSetting: AddUrltList(ParamSettingUrlList, row, csvDir); break; case TagLayerSetting: AddUrltList(LayerSettingUrlList, row, csvDir); break; case TagSceneGallerySetting: AddUrltList(SceneGallerySettingUrlList, row, csvDir); break; default: Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.UnknownTag, tag)); break; } }
/// <summary> /// コマンド生成 /// </summary> /// <param name="row">行データ</param> /// <param name="dataManager">データマネージャー</param> /// <returns>生成されたコマンド</returns> static public AdvCommand CreateCommand(StringGridRow row, AdvSettingDataManager dataManager) { Profiler.BeginSample("CreateCommandRow"); Profiler.BeginSample("Check Comment"); if (row.IsCommentOut || IsComment(row)) { Profiler.EndSample(); Profiler.EndSample(); //コメント return(null); } Profiler.EndSample(); ///基本のコマンド解析処理 AdvCommand command = CreateCommand(ParseCommandID(row), row, dataManager); Profiler.BeginSample("Check IsAllEmptyCellNamedColumn"); if (command == null) { //列名がついたセル全て空かどうか if (row.IsAllEmptyCellNamedColumn()) { } else { //記述ミス Debug.LogError(row.ToErrorString(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.CommandParseNull))); Profiler.EndSample(); Profiler.EndSample(); return(new AdvCommandError(row)); } } Profiler.EndSample(); Profiler.EndSample(); return(command); }