/// <summary>
		/// CSV形式ファイルをロードして初期化
		/// </summary>
		/// <param name="url">CSVのパス</param>
		/// <param name="version">シナリオバージョン(-1以下で必ずサーバーからデータを読み直す)</param>
		/// <returns></returns>
		public IEnumerator LoadCsvAsync(string url, int version )
		{
			exportedScenarioDataTbl = new AdvScenarioDataExported[0];
			scenarioDataTbl.Clear();
			settingDataManager = ScriptableObject.CreateInstance<AdvSettingDataManager>();
			yield return StartCoroutine(SettingDataManager.LoadCsvAsync(this, url, version));
		}
		public AdvCommandSelectionClick(StringGridRow row, AdvSettingDataManager dataManager)
			: base(row)
		{
			this.jumpLabel = AdvCommandParser.ParseScenarioLabel(row, AdvColumnName.Arg1);
			string expStr = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Arg2, "");
			if( string.IsNullOrEmpty(expStr) )
			{
				this.exp = null;
			}
			else
			{
				this.exp = dataManager.DefaultParam.CreateExpressionBoolean(expStr);
				if (this.exp.ErrorMsg != null)
				{
					Debug.LogError(row.ToErrorString(this.exp.ErrorMsg));
				}
			}

			string selectedExpStr = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Arg3, "");
			if (string.IsNullOrEmpty(selectedExpStr))
			{
				this.selectedExp = null;
			}
			else
			{
				this.selectedExp = dataManager.DefaultParam.CreateExpression(selectedExpStr);
				if (this.selectedExp.ErrorMsg != null)
				{
					Debug.LogError(row.ToErrorString(this.selectedExp.ErrorMsg));
				}
			}

			this.name = AdvParser.ParseCell<string>(row, AdvColumnName.Arg4 );
			this.isPolygon = AdvParser.ParseCellOptional<bool>(row, AdvColumnName.Arg5, true );
		}
		public AdvCommandParam(StringGridRow row, AdvSettingDataManager dataManger)
			: base(row)
		{
			this.exp = dataManger.DefaultParam.CreateExpression(AdvParser.ParseCell<string>(row, AdvColumnName.Arg1));
			if (this.exp.ErrorMsg != null)
			{
				Debug.LogError(row.ToErrorString(this.exp.ErrorMsg));
			}
		}
Пример #4
0
        protected virtual void InitVoiceFile(AdvSettingDataManager dataManager)
        {
            //ボイスファイル設定
            string voice = ParseCellOptional <string>(AdvColumnName.Voice, "");

            if (!string.IsNullOrEmpty(voice))
            {
                VoiceFile = ParseVoiceSub(dataManager, voice);
            }
        }
        public void Init(AdvSettingDataManager dataManager)
        {
            this.isInit = false;
            List <AdvCommand> commandList = this.DataGrid.CreateCommandList(dataManager);

            this.AddExtraCommand(commandList, dataManager);
            this.MakeScanerioLabelData(commandList);
            this.MakeJumpDataList(commandList);
            this.isInit = true;
        }
Пример #6
0
 public void MakeScenarioImportData(AdvSettingDataManager dataManager, AdvMacroManager macroManager)
 {
     foreach (var book in DataList)
     {
         if (book.Reimport)
         {
             book.MakeImportData(dataManager, macroManager);
         }
     }
 }
Пример #7
0
        /// <summary>
        /// 起動時の初期化
        /// </summary>
        /// <param name="settingData">設定データ</param>
        internal void BootInit(AdvSettingDataManager dataManager)
        {
            Graphic.BootInit((fileName, fileType) => FileNameToPath(fileName, fileType, dataManager.BootSetting), dataManager);

            ThumbnailPath = dataManager.BootSetting.ThumbnailDirInfo.FileNameToPath(thumbnailName);
            if (!string.IsNullOrEmpty(ThumbnailPath))
            {
                AssetFileManager.GetFileCreateIfMissing(ThumbnailPath);
            }
        }
Пример #8
0
 public AdvCommandZoomCamera(StringGridRow row, AdvSettingDataManager dataManager)
     : base(row)
 {
     this.targetType        = AdvEffectManager.TargetType.Camera;
     this.isEmptyZoom       = IsEmptyCell(AdvColumnName.Arg2);
     this.zoom              = ParseCellOptional <float>(AdvColumnName.Arg2, 1);
     this.isEmptyZoomCenter = IsEmptyCell(AdvColumnName.Arg3) && IsEmptyCell(AdvColumnName.Arg4);
     this.zoomCenter.x      = ParseCellOptional <float>(AdvColumnName.Arg3, 0);
     this.zoomCenter.y      = ParseCellOptional <float>(AdvColumnName.Arg4, 0);
     this.time              = ParseCellOptional <float>(AdvColumnName.Arg6, 0.2f);
 }
Пример #9
0
        public AdvCommandSe(StringGridRow row, AdvSettingDataManager dataManager)
            : base(row)
        {
            this.label = ParseCell <string>(AdvColumnName.Arg1);
            if (!dataManager.SoundSetting.Contains(label, SoundType.Se))
            {
                Debug.LogError(ToErrorString(label + " is not contained in file setting"));
            }

            this.file = AddLoadFile(dataManager.SoundSetting.LabelToFilePath(label, SoundType.Se), dataManager.SoundSetting.FindRowData(label));
        }
 public AdvCommandPageControler(StringGridRow row, AdvSettingDataManager dataManager) : base(row)
 {
     if (row == null)
     {
         this.pageCtrlType = AdvPageControllerType.InputBrPage;
     }
     else
     {
         this.pageCtrlType = base.ParseCellOptional <AdvPageControllerType>(AdvColumnName.PageCtrl, AdvPageControllerType.InputBrPage);
     }
 }
 public AdvCommandSe(StringGridRow row, AdvSettingDataManager dataManager) : base(row)
 {
     this.label = base.ParseCell <string>(AdvColumnName.Arg1);
     if (!dataManager.SoundSetting.Contains(this.label, SoundType.Se))
     {
         Debug.LogError(base.ToErrorString(this.label + " is not contained in file setting"));
     }
     this.isLoop = base.ParseCellOptional <bool>(AdvColumnName.Arg2, false);
     this.volume = base.ParseCellOptional <float>(AdvColumnName.Arg3, 1f);
     this.file   = base.AddLoadFile(dataManager.SoundSetting.LabelToFilePath(this.label, SoundType.Se), dataManager.SoundSetting.FindData(this.label));
 }
Пример #12
0
		public AdvCommandSe(StringGridRow row, AdvSettingDataManager dataManager)
			: base(row)
		{
			string label = AdvParser.ParseCell<string>(row, AdvColumnName.Arg1);
			if (!dataManager.SoundSetting.Contains(label, SoundType.Se))
			{
				Debug.LogError(row.ToErrorString(label + " is not contained in file setting"));
			}

			this.file = AddLoadFile(dataManager.SoundSetting.LabelToFilePath(label, SoundType.Se));
		}
Пример #13
0
 /// <summary>
 /// シナリオ連続ロード時に使用.同名のラベルで連続再生をかけようとすると任意のラベルでロードできない事があるため. yoshida 2018/08/26
 /// </summary>
 public void ClearCache()
 {
     if (scenarioDataTbl != null)
     {
         scenarioDataTbl.Clear();
     }
     scenarioDataTbl    = new Dictionary <string, AdvScenarioData>();
     settingDataManager = new AdvSettingDataManager();
     macroManager       = new AdvMacroManager();
     Debug.Log("ClearCache : scenarioDataTbl=" + (scenarioDataTbl));
 }
Пример #14
0
 public AdvCommandLayerOff(StringGridRow row, AdvSettingDataManager dataManager)
     : base(row)
 {
     this.name = ParseCell <string>(AdvColumnName.Arg1);
     if (!dataManager.LayerSetting.Contains(name))
     {
         Debug.LogError(row.ToErrorString("Not found " + name + " Please input Layer name"));
     }
     //フェード時間
     this.fadeTime = ParseCellOptional <float>(AdvColumnName.Arg6, 0.2f);
 }
Пример #15
0
        public AdvCommandBgm(StringGridRow row, AdvSettingDataManager dataManager)
        {
            string label = AdvParser.ParseCell <string>(row, AdvColumnName.Arg1);

            if (!dataManager.SoundSetting.Contains(label, SoundType.Bgm))
            {
                Debug.LogError(row.ToErrorString(label + " is not contained in file setting"));
            }

            this.file = AddLoadFile(dataManager.SoundSetting.LabelToFilePath(label, SoundType.Bgm));
        }
Пример #16
0
 /// <summary>
 /// 設定されたエクスポートデータからゲームを開始
 /// </summary>
 /// <param name="rootDirResource">リソースディレクトリ</param>
 public void BootFromExportData(AdvSettingDataManager settingDataManager, AdvScenarioDataExported[] exportedScenarioDataTbl, string resourceDir)
 {
     StopAllCoroutines();
     Clear();
     isStarted         = true;
     isWaitBootLoading = true;
     onPreInit.Invoke();
     DataManager.InitData(settingDataManager, exportedScenarioDataTbl);
     BootInit(resourceDir);
     isWaitBootLoading = false;
 }
Пример #17
0
 public AdvCommandBgEvent(StringGridRow row, AdvSettingDataManager dataManager) : base(row)
 {
     this.label = base.ParseCell <string>(AdvColumnName.Arg1);
     if (!dataManager.TextureSetting.ContainsLabel(this.label))
     {
         Debug.LogError(base.ToErrorString(this.label + " is not contained in file setting"));
     }
     this.graphic = dataManager.TextureSetting.LabelToGraphic(this.label);
     base.AddLoadGraphic(this.graphic);
     this.fadeTime = base.ParseCellOptional <float>(AdvColumnName.Arg6, 0.2f);
 }
Пример #18
0
 public AdvCommandChangeLayer(StringGridRow row, AdvSettingDataManager dataManager)
     : base(row)
 {
     this.objectName     = ParseCell <string>(AdvColumnName.Arg1);
     this.repositionType = ParseCellOptional(AdvColumnName.Arg2, AdvChangeLayerRepositionType.KeepGlobal);
     this.layerName      = ParseCell <string>(AdvColumnName.Arg3);
     if (!dataManager.LayerSetting.Contains(layerName))
     {
         Debug.LogError(row.ToErrorString("Not found " + layerName + " Please input Layer name"));
     }
     fadeTime = ParseCellOptional(AdvColumnName.Arg6, 0.2f);
 }
Пример #19
0
        public AdvCommandAmbience(StringGridRow row, AdvSettingDataManager dataManager)
        {
            string label = AdvParser.ParseCell <string>(row, AdvColumnName.Arg1);

            if (!dataManager.SoundSetting.Contains(label, SoundType.Ambience))
            {
                Debug.LogError(row.ToErrorString(label + " is not contained in file setting"));
            }

            this.file   = AddLoadFile(dataManager.SoundSetting.LabelToFilePath(label, SoundType.Ambience));
            this.isLoop = AdvParser.ParseCellOptional <bool>(row, AdvColumnName.Arg2, false);
        }
Пример #20
0
 public AdvCommandTween(StringGridRow row, AdvSettingDataManager dataManager) : base(row)
 {
     this.InitTweenData();
     if (this.tweenData.Type == iTweenType.Stop)
     {
         base.WaitType = AdvCommandWaitType.Add;
     }
     if (!string.IsNullOrEmpty(this.tweenData.ErrorMsg))
     {
         Debug.LogError(base.ToErrorString(this.tweenData.ErrorMsg));
     }
 }
Пример #21
0
        readonly ExpressionParser conditionalExp;                                       //条件式
        public AdvCommandWaitConditional(StringGridRow row, AdvSettingDataManager dataManager)
            : base(row)
        {
            string expStr = ParseCell <string>(AdvColumnName.Arg1);

            this.conditionalExp = dataManager.DefaultParam.CreateExpressionBoolean(expStr);
            if (this.conditionalExp.ErrorMsg != null)
            {
                Debug.LogError(ToErrorString(this.conditionalExp.ErrorMsg));
            }
            this.time = this.ParseCellOptional <float>(AdvColumnName.Arg6, -1);
        }
        public AdvCommandVoice(StringGridRow row, AdvSettingDataManager dataManager) : base(row)
        {
            this.characterLabel = base.ParseCell <string>(AdvColumnName.Arg1);
            string file = base.ParseCell <string>(AdvColumnName.Voice);

            if (!AdvCommand.IsEditorErrorCheck)
            {
                this.voiceFile = base.AddLoadFile(dataManager.BootSetting.GetLocalizeVoiceFilePath(file), null);
            }
            this.isLoop = base.ParseCellOptional <bool>(AdvColumnName.Arg2, false);
            this.volume = base.ParseCellOptional <float>(AdvColumnName.Arg3, 1f);
        }
Пример #23
0
        public AdvCommandVideo(StringGridRow row, AdvSettingDataManager dataManager)
            : base(row)
        {
            this.label      = ParseCell <string>(AdvColumnName.Arg1);
            this.cameraName = ParseCell <string>(AdvColumnName.Arg2);
            this.loop       = ParseCellOptional <bool>(AdvColumnName.Arg3, false);
            this.cancel     = ParseCellOptional <bool>(AdvColumnName.Arg4, true);

            string path = FilePathUtil.Combine(dataManager.BootSetting.ResourceDir, "Video");

            path      = FilePathUtil.Combine(path, label);
            this.file = AddLoadFile(path, new AdvCommandSetting(this));
        }
        public AdvCommandBgEvent(StringGridRow row, AdvSettingDataManager dataManager)
            : base(row)
        {
            this.label = AdvParser.ParseCell <string>(row, AdvColumnName.Arg1);
            if (!dataManager.TextureSetting.ContainsLabel(label))
            {
                Debug.LogError(row.ToErrorString(label + " is not contained in file setting"));
            }

            this.graphic = dataManager.TextureSetting.LabelToGraphic(label);
            AddLoadGraphic(graphic);
            this.graphicOperaitonArg = new AdvGraphicOperaitonArg(row, graphic, AdvParser.ParseCellOptional <float>(row, AdvColumnName.Arg6, 0.2f));
        }
Пример #25
0
        //カスタムコマンドの作成用コールバック
        public void CreateCustomCommand(string id, StringGridRow row, AdvSettingDataManager dataManager, ref AdvCommand command)
        {
            switch (id)
            {
            case "SetParamTblCount":
                command = new AdvCommandParamTblKeyCount(row);
                break;

            case "SetParamTblCount2":
                command = new AdvCommandParamTblKeyCount2(row);
                break;
            }
        }
		public AdvCommandBgEvent(StringGridRow row, AdvSettingDataManager dataManager)
			: base(row)
		{
			this.label = AdvParser.ParseCell<string>(row, AdvColumnName.Arg1);
			if (!dataManager.TextureSetting.ContainsLabel(label))
			{
				Debug.LogError(row.ToErrorString(label + " is not contained in file setting"));
			}

			this.graphic = dataManager.TextureSetting.LabelToGraphic(label);
			AddLoadGraphic(graphic);
			this.graphicOperaitonArg = new AdvGraphicOperaitonArg(row, graphic, AdvParser.ParseCellOptional<float>(row, AdvColumnName.Arg6, 0.2f) );
		}
        public AdvCommandBgm(StringGridRow row, AdvSettingDataManager dataManager) : base(row)
        {
            string label = base.ParseCell <string>(AdvColumnName.Arg1);

            if (!dataManager.SoundSetting.Contains(label, SoundType.Bgm))
            {
                Debug.LogError(base.ToErrorString(label + " is not contained in file setting"));
            }
            this.file        = base.AddLoadFile(dataManager.SoundSetting.LabelToFilePath(label, SoundType.Bgm), dataManager.SoundSetting.FindData(label));
            this.volume      = base.ParseCellOptional <float>(AdvColumnName.Arg3, 1f);
            this.fadeOutTime = base.ParseCellOptional <float>(AdvColumnName.Arg5, 0.2f);
            this.fadeInTime  = base.ParseCellOptional <float>(AdvColumnName.Arg6, 0f);
        }
Пример #28
0
        public AdvCommandSetPivot(StringGridRow row, AdvSettingDataManager dataManager)
            : base(row)
        {
            targetName = this.ParseCell <string>(AdvColumnName.Arg1);

            string strPivotX = ParseCell <string>(AdvColumnName.Arg2);

            switch (strPivotX)
            {
            case AdvCommandKeyword.Left:
                pivotX = 0.0f;
                break;

            case AdvCommandKeyword.Center:
                pivotX = 0.5f;
                break;

            case AdvCommandKeyword.Right:
                pivotX = 1.0f;
                break;

            default:
                pivotX = this.ParseCell <float>(AdvColumnName.Arg2);
                break;
            }

            string strPivotY = ParseCell <string>(AdvColumnName.Arg3);

            switch (strPivotY)
            {
            case AdvCommandKeyword.Bottom:
                pivotY = 0.0f;
                break;

            case AdvCommandKeyword.Center:
                pivotY = 0.5f;
                break;

            case AdvCommandKeyword.Top:
                pivotY = 1.0f;
                break;

            default:
                pivotY = this.ParseCell <float>(AdvColumnName.Arg3);
                break;
            }

            x         = this.ParseCellOptional <float>(AdvColumnName.Arg4, 0.0f);
            y         = this.ParseCellOptional <float>(AdvColumnName.Arg5, 0.0f);
            pivotType = this.ParseCellOptional(AdvColumnName.Arg6, AdvGraphicObjectPivotType.SpritePos);
        }
Пример #29
0
        //起動時の初期化
        public void BootInit(Func <string, string, string> FileNameToPath, AdvSettingDataManager dataManager)
        {
            File = AssetFileManager.GetFileCreateIfMissing(FileNameToPath(FileName, FileType), this);
            //アニメーションの設定
            string animationLabel = AdvParser.ParseCellOptional <string>(RowData, AdvColumnName.Animation, "");

            if (!string.IsNullOrEmpty(animationLabel))
            {
                this.AnimationData = dataManager.AnimationSetting.Find(animationLabel);
                if (this.AnimationData == null)
                {
                    Debug.LogError(this.RowData.ToErrorString("Animation [ " + animationLabel + " ] is not found"));
                }
            }

            //目パチの設定
            string eyeBlinkLabel = AdvParser.ParseCellOptional <string>(RowData, AdvColumnName.EyeBlink, "");

            if (!string.IsNullOrEmpty(eyeBlinkLabel))
            {
                AdvEyeBlinkData data;
                if (dataManager.EyeBlinkSetting.Dictionary.TryGetValue(eyeBlinkLabel, out data))
                {
                    this.EyeBlinkData = data;
                }
                else
                {
                    Debug.LogError(this.RowData.ToErrorString("EyeBlinkLabel [ " + eyeBlinkLabel + " ] is not found"));
                }
            }

            //口パクの設定
            string lipSynchLabel = AdvParser.ParseCellOptional <string>(RowData, AdvColumnName.LipSynch, "");

            if (!string.IsNullOrEmpty(lipSynchLabel))
            {
                AdvLipSynchData data;
                if (dataManager.LipSynchSetting.Dictionary.TryGetValue(lipSynchLabel, out data))
                {
                    this.LipSynchData = data;
                }
                else
                {
                    Debug.LogError(this.RowData.ToErrorString("LipSynchLabel [ " + lipSynchLabel + " ] is not found"));
                }
            }

            //アイコンの設定
            Icon.BootInit((fileName) => dataManager.BootSetting.CharacterDirInfo.FileNameToPath(fileName));
        }
Пример #30
0
        public AdvCommandVideo(StringGridRow row, AdvSettingDataManager dataManager) : base(row)
        {
            this.isEndPlay  = true;
            this.label      = base.ParseCell <string>(AdvColumnName.Arg1);
            this.cameraName = base.ParseCell <string>(AdvColumnName.Arg2);
            this.loop       = base.ParseCellOptional <bool>(AdvColumnName.Arg3, false);
            this.cancel     = base.ParseCellOptional <bool>(AdvColumnName.Arg4, true);
            string[] args = new string[] { dataManager.BootSetting.ResourceDir, "Video" };
            string   path = FilePathUtil.Combine(args);

            string[] textArray2 = new string[] { path, this.label };
            path      = FilePathUtil.Combine(textArray2);
            this.file = base.AddLoadFile(path, new AdvCommandSetting(this));
        }
Пример #31
0
        /// <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);
                }
            }
        }
Пример #32
0
        //カスタムコマンドの作成用コールバック
        public void CreateCustomCommand(string commandName, StringGridRow row, AdvSettingDataManager dataManager, ref AdvCommand command)
        {
            switch (commandName)
            {
            case "ItemPop":                             // アイテムポップ表示(小)
                command = new AdvCommandItemPop(row, dataManager);
                break;

            case "ItemPopClose":                        // アイテムポップ表示(小)閉じる
                command = new AdvCommandItemPopClose(row, dataManager);
                break;

            case "LargeItemPop":                        // アイテムポップ表示(大)
                command = new AdvCommandLargeItemPop(row, dataManager);
                break;

            case "LargeItemPopClose":        // アイテムポップ表示(大)閉じる
                command = new AdvCommandLargeItemPopClose(row, dataManager);
                break;

            case "Effect_Run":                          // 走る演出
                command = new AdvCommandRunShake(row, dataManager);
                break;

            case "Effect_Slash":                        // 斬撃
                command = new AdvCommandSlash(row, dataManager);
                break;

            case "Effect_Flash_Red":                        // 赤いフラッシュ
                command = new AdvCommandFlashRed(row, dataManager);
                break;

            case "Effect_IntensiveLine":                        // 集中線
                command = new AdvCommandIntensiveLine(row, dataManager);
                break;

            case "Effect_Magic":                        // 魔術
                command = new AdvCommandMagic(row, dataManager);
                break;

            case "Effect_Gun":      // 銃撃演出
                command = new AdvCommandGunEffect(row, dataManager);
                break;

            case "Effect_Claw":     // 爪撃演出
                command = new AdvCommandClaw(row, dataManager);
                break;
                // TODO : 適宜カスタムコマンドを使用したい場合は追記.
            }
        }
        //連続コマンドの終了コマンドを取得
        static public AdvCommand CreateContiunesEndCommand(AdvCommand last, AdvSettingDataManager dataManager)
        {
            AdvCommand command = null;

            ///独自のコマンド解析処理があるならそっちを先に
//			if (CallBackCreateCustomContiunesEndCommand != null) command = CallBackCreateCustomContiunesEndCommand(last, dataManager);
            ///基本のコマンド解析処理
            if (command == null)
            {
                command = CreateDefaultContiunesEndCommand(last, dataManager);
            }

            return(command);
        }
 public AdvCommandCharacter(StringGridRow row, AdvSettingDataManager dataManager) : base(row)
 {
     this.characterInfo = AdvCharacterInfo.Create(this, dataManager);
     if (this.characterInfo.Graphic != null)
     {
         base.AddLoadGraphic(this.characterInfo.Graphic);
     }
     this.layerName = base.ParseCellOptional <string>(AdvColumnName.Arg3, string.Empty);
     if (!string.IsNullOrEmpty(this.layerName) && !dataManager.LayerSetting.Contains(this.layerName, AdvLayerSettingData.LayerType.Character))
     {
         Debug.LogError(base.ToErrorString(this.layerName + " is not contained in layer setting"));
     }
     this.fadeTime = base.ParseCellOptional <float>(AdvColumnName.Arg6, 0.2f);
 }
Пример #35
0
        //カスタムコマンドの作成用コールバック
        public void CreateCustomCommand(string id, StringGridRow row, AdvSettingDataManager dataManager, ref AdvCommand command)
        {
            switch (id)
            {
            //既存のコマンドを改造コマンドに変えたい場合は、IDで判別
            //コメントアウトを解除すれば、テキスト表示がデバッグログ出力のみに変わる
//				case AdvCommandParser.IdText:
//					command = new SampleCustomAdvCommandText(row);
//					break;
            //新しい名前のコマンドも作れる
            case "DebugLog":
                command = new SampleAdvCommandDebugLog(row);
                break;
            }
        }
		public AdvCommandJump(StringGridRow row, AdvSettingDataManager dataManager)
			: base(row)
		{
			this.jumpLabel = AdvCommandParser.ParseScenarioLabel(row, AdvColumnName.Arg1);
			string expStr = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Arg2, "");
			if (string.IsNullOrEmpty(expStr))
			{
				this.exp = null;
			}
			else
			{
				this.exp = dataManager.DefaultParam.CreateExpressionBoolean(expStr);
				if (this.exp.ErrorMsg != null)
				{
					Debug.LogError(row.ToErrorString(this.exp.ErrorMsg));
				}
			}
		}
		public AdvCommandSprite(StringGridRow row, AdvSettingDataManager dataManager)
			: base(row)
		{
			this.spriteName = AdvParser.ParseCell<string>(row, AdvColumnName.Arg1);
			string fileName = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Arg2, spriteName);

			if (!dataManager.TextureSetting.ContainsLabel(fileName))
			{
				Debug.LogError(row.ToErrorString(fileName + " is not contained in file setting"));
			}

			this.graphic = dataManager.TextureSetting.LabelToGraphic(fileName);
			AddLoadGraphic(graphic);
			this.layerName = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Arg3, "");
			if (!string.IsNullOrEmpty(layerName) && !dataManager.LayerSetting.Contains(layerName, AdvLayerSettingData.LayerType.Sprite))
			{
				Debug.LogError(row.ToErrorString( layerName + " is not contained in layer setting"));
			}

			//グラフィック表示処理を作成
			this.graphicOperaitonArg =  new AdvGraphicOperaitonArg(row, graphic, AdvParser.ParseCellOptional<float>(row, AdvColumnName.Arg6, 0.2f) );
		}
		/// <summary>
		/// コマンド生成
		/// </summary>
		/// <param name="row">行データ</param>
		/// <param name="dataManager">データマネージャー</param>
		/// <returns>生成されたコマンド</returns>
		static public AdvCommand CreateCommand(StringGridRow row, AdvSettingDataManager dataManager)
		{
			if (IsComment(row))
			{
				//コメント
				return null;
			}
			AdvCommand command = null;
			///独自のコマンド解析処理があるならそっちを先に
//			if (CallBackCreateCustomCommnad != null) command = CallBackCreateCustomCommnad(row, dataManager);

			///基本のコマンド解析処理
			if (command == null) command = CreateCommandDefault(row, dataManager);


			if (command == null)
			{
				//記述ミス
				Debug.LogError(row.ToErrorString(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.CommnadParseNull)));
			}

			return command;
		}
		public AdvCommandText(StringGridRow row, AdvSettingDataManager dataManager)
			: base(row)
		{
			//ページコントローラー
			this.pageCtrlType = AdvParser.ParseCellOptional<AdvPageController.Type>(row, AdvColumnName.PageCtrl, AdvPageController.Type.None );
			dataManager.PageContoroller.Update(this.pageCtrlType);

			//メッセージウィンドウのタイプ
			this.windowType = AdvParser.ParseCellOptional<string>(row, AdvColumnName.WindowType, "");
			
			this.text = AdvParser.ParseCell<string>(row, AdvColumnName.Text);
			if (AdvCommand.IsEditorErrorCheck)
			{
				TextData textData = new TextData(text);
				if (!string.IsNullOrEmpty(textData.ErrorMsg))
				{
					Debug.LogError(row.ToErrorString(textData.ErrorMsg));
				}
			}
			
			//ページの末端かチェック
			//ページコントローラーでテキストを表示しつづける場合は、ページ末端じゃない
			this.isPageEnd = (text.Length > 0) && !dataManager.PageContoroller.IsKeepText;
		}
		//連続コマンドの終了コマンドを取得
		static public AdvCommand CreateContiunesEndCommand(AdvCommand last, AdvSettingDataManager dataManager)
		{
			AdvCommand command = null;
			///独自のコマンド解析処理があるならそっちを先に
//			if (CallBackCreateCustomContiunesEndCommand != null) command = CallBackCreateCustomContiunesEndCommand(last, dataManager);
			///基本のコマンド解析処理
			if (command == null) command = CreateDefaultContiunesEndCommand(last, dataManager);

			return command;
		}
		/// <summary>
		/// 基本のコマンド生成処理
		/// </summary>
		/// <param name="id">コマンドID</param>
		/// <param name="dataManager">データマネージャー</param>
		/// <returns>生成されたコマンド</returns>
		static public AdvCommand CreateCommandDefault(string id, StringGridRow row, AdvSettingDataManager dataManager)
		{
			switch (id)
			{
				case IdCharacter:
					return new AdvCommandCharacter(row,dataManager);
				case IdText:
					return new AdvCommandText(row, dataManager);
				case IdCharacterOff:
					return new AdvCommandCharacterOff(row);
				case IdBg:
					return new AdvCommandBg(row, dataManager);
				case IdBgOff:
					return new AdvCommandBgOff(row);
				case IdBgEvent:
					return new AdvCommandBgEvent(row, dataManager);
				case IdBgEventOff:
					return new AdvCommandBgEventOff(row);
				case IdSprite:
					return new AdvCommandSprite(row, dataManager);
				case IdSpriteOff:
					return new AdvCommandSpriteOff(row);
				case IdMovie:
					return new AdvCommandMovie(row, dataManager);

				case IdTween:
					return new AdvCommandTween(row, dataManager);
				case IdFadeIn:
					return new AdvCommandFadeIn(row);
				case IdFadeOut:
					return new AdvCommandFadeOut(row);
				case IdShake:
					return new AdvCommandShake(row, dataManager);


				case IdSe:
					return new AdvCommandSe(row, dataManager);
				case IdBgm:
					return new AdvCommandBgm(row, dataManager);
				case IdStopBgm:
					return new AdvCommandStopBgm(row);
				case IdAmbience:
					return new AdvCommandAmbience(row, dataManager);
				case IdStopAmbience:
					return new AdvCommandStopAmbience(row);
				case IdStopSound:
					return new AdvCommandStopSound(row);

				case IdWait:
					return new AdvCommandWait(row);

				case IdParam:
					return new AdvCommandParam(row, dataManager);
				case IdSelection:
					return new AdvCommandSelection(row, dataManager);
				case IdSelectionClick:
					return new AdvCommandSelectionClick(row, dataManager);
				case IdJump:
					return new AdvCommandJump(row, dataManager);
				case IdJumpRandom:
					return new AdvCommandJumpRandom(row, dataManager);
				case IdIf:
					return new AdvCommandIf(row, dataManager);
				case IdElseIf:
					return new AdvCommandElseIf(row, dataManager);
				case IdElse:
					return new AdvCommandElse(row);
				case IdEndIf:
					return new AdvCommandEndIf(row);

				case IdSendMessage:
					return new AdvCommandSendMessage(row);
				case IdEndScenario:
					return new AdvCommandEndScenario(row);
				case IdEndSceneGallery:
					return new AdvCommandEndSceneGallery(row);

				case IdPageControler:
					return new AdvCommandPageControler(row,dataManager);
				case IdScenarioLabel:
					return new AdvCommandScenarioLabel(row);
				default:
					return null;
			}
		}
		public const string IdPageControler = "PageControl";		//ページの制御


		/// <summary>
		/// 基本のコマンド生成処理
		/// </summary>
		/// <param name="row">行データ</param>
		/// <param name="dataManager">データマネージャー</param>
		/// <returns>生成されたコマンド</returns>
		static public AdvCommand CreateCommandDefault( StringGridRow row, AdvSettingDataManager dataManager)
		{
			string id = ParseCommandID(row);
			AdvCommand command = null;
			///独自のコマンド生成処理があるならそっちを先に
//			if (CallBackCreateCustomCommnadFromID != null) command = CallBackCreateCustomCommnadFromID(id, row, dataManager);

			///独自のコマンド解析処理があるならそっちを先に
			if (command == null && OnCreateCustomCommnadFromID != null ) OnCreateCustomCommnadFromID(id, row, dataManager, ref command);

			///基本のコマンド解析処理
			if (command == null) command = CreateCommandDefault(id, row, dataManager);
			return command;
		}
		public AdvCommandJumpRandomEnd(StringGridRow row, AdvSettingDataManager dataManager)
			: base(row)
		{
		}
		public AdvCommandPageControler(StringGridRow row, AdvSettingDataManager dataManager)
			: base(row)
		{
//			dataManager.PageContoroller.IsKeepText = true;
		}
		/// <summary>
		/// エラーチェックのために実際にデータを作成
		/// エクスポートするときに使用。
		/// </summary>
		/// <param name="sheetName">シート名</param>
		/// <param name="grid">チェックするシナリオを記述したStringGrid</param>
		/// <param name="settingDataManger">データ管理の大本</param>
		/// <returns>シナリオデータ</returns>
		public AdvScenarioData ErrorCheck(string sheetName, StringGrid grid, AdvSettingDataManager settingDataManger)
		{
			AdvScenarioData scenario = new AdvScenarioData();
			scenario.Init( sheetName, grid, settingDataManger);
			return scenario;
		}
		/// <summary>
		/// データを直接設定して初期化
		/// </summary>
		public void InitData(AdvSettingDataManager settingDataManager, AdvScenarioDataExported[] exportedScenarioDataTbl)
		{
			this.settingDataManager = settingDataManager;
			this.exportedScenarioDataTbl = exportedScenarioDataTbl;
		}
		//設定データをインポート
		void ImportSettingBook(StringGridDictionary book, string path)
		{
			//インポート後のスクリプタブルオブジェクトを作成
			string assetPath = Path.GetDirectoryName(path) + "/" + Path.GetFileNameWithoutExtension(path) + SettingAssetExt;
			foreach (var sheet in book.List )
			{
				StringGrid grid = sheet.Grid;
				//設定データか、シナリオデータかチェック
				if (AdvSettingDataManager.IsBootSheet(sheet.Name) || AdvSettingDataManager.IsSettingsSheet(sheet.Name))
				{
					//設定データのアセットを作成
					if (assetSetting == null)
					{
						assetSetting = UtageEditorToolKit.GetImportedAssetCreateIfMissing<AdvSettingDataManager>(assetPath);
						assetSetting.Clear();
					}
					assetSetting.hideFlags = HideFlags.NotEditable;
					assetSetting.ParseFromExcel(sheet.Name, grid);
				}
			}

			if (assetSetting != null)
			{
				assetSetting.EditorTestInit();
				Debug.Log( LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.Import,assetPath));
				//変更を反映
				EditorUtility.SetDirty(assetSetting);
			}
		}
		public AdvCommandCharacter(StringGridRow row, AdvSettingDataManager dataManager)
			: base(row)
		{
			//名前
			string name = AdvParser.ParseCell<string>(row, AdvColumnName.Arg1);
			//パターンラベル
			string patternLabel = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Arg2, "");
			//キャラの表示情報を取得
			this.characterInfo = dataManager.CharacterSetting.GetCharacterInfo(name, patternLabel);
			AddLoadGraphic(characterInfo.Graphic);
			//表示レイヤー
			this.layerName = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Arg3, "");
			if (!string.IsNullOrEmpty(layerName) && !dataManager.LayerSetting.Contains(layerName, AdvLayerSettingData.LayerType.Character))
			{
				//表示レイヤーが見つからない
				Debug.LogError(row.ToErrorString(layerName + " is not contained in layer setting"));
			}

			//グラフィック表示処理を作成
			this.graphicOperaitonArg 
				= new AdvGraphicOperaitonArg( 
					row, 
					characterInfo.Graphic, 
					AdvParser.ParseCellOptional<float>(row, AdvColumnName.Arg6, 0.2f), 
					characterInfo.IsNonePattern );

			//メッセージウィンドウのタイプ
			this.windowType = AdvParser.ParseCellOptional<string>(row, AdvColumnName.WindowType, "");

			//ページコントローラー
			this.pageCtrlType = AdvParser.ParseCellOptional<AdvPageController.Type>(row, AdvColumnName.PageCtrl, AdvPageController.Type.None);
			dataManager.PageContoroller.Update(this.pageCtrlType);

			//テキスト関連
			this.text = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Text, "");
			if (AdvCommand.IsEditorErrorCheck)
			{
				TextData textData = new TextData(text);
				if (!string.IsNullOrEmpty(textData.ErrorMsg))
				{
					Debug.LogError(row.ToErrorString(textData.ErrorMsg));
				}
			}
			//ボイス
			string voice = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Voice, "");
			int voiceVersion = AdvParser.ParseCellOptional<int>(row, AdvColumnName.VoiceVersion, 0);

			//サウンドファイル設定
			if (!string.IsNullOrEmpty(voice))
			{
				if (AdvCommand.IsEditorErrorCheck)
				{
				}
				else
				{
					voiceFile = AddLoadFile(dataManager.SettingData.VoiceDirInfo.FileNameToPath(voice));
					if (voiceFile != null) voiceFile.Version = voiceVersion;
					//ストリーミング再生にバグがある模様。途中で無音が混じると飛ばされる?
					//				voiceFile.LoadFlags = AssetFileLoadFlags.Streaming;
				}
			}

			//ページの末端かチェック
			//ページコントローラーでテキストを表示しつづける場合は、ページ末端じゃない
			this.isPageEnd = (text.Length > 0) && !dataManager.PageContoroller.IsKeepText;
		}
		public AdvCommandMovie(StringGridRow row, AdvSettingDataManager dataManager)
			: base(row)
		{
			this.label = AdvParser.ParseCell<string>(row, AdvColumnName.Arg1);
		}
		/// <summary>
		/// 初期化
		/// </summary>
		/// <param name="name">シナリオ名</param>
		/// <param name="grid">シナリオデータ</param>
		/// <param name="dataManager">各種設定データ</param>
		public void Init(string name, StringGrid grid, AdvSettingDataManager dataManager)
		{
			this.name = name;
			this.dataGridName = grid.Name;
			ParseFromStringGrid(grid, dataManager);
		}
Пример #51
0
		/// <summary>
		/// 設定されたエクスポートデータからゲームを開始
		/// </summary>
		/// <param name="rootDirResource">リソースディレクトリ</param>
		public void BootFromExportData(AdvSettingDataManager settingDataManager, AdvScenarioDataExported[] exportedScenarioDataTbl, string resourceDir )
		{
			StopAllCoroutines();
			Clear();
			isStarted = true;
			isWaitBootLoading = true;
			onPreInit.Invoke();
			DataManager.InitData( settingDataManager, exportedScenarioDataTbl);
			BootInit(resourceDir);
			isWaitBootLoading = false;
		}
		//連続コマンドの終了コマンドを取得
		static public AdvCommand CreateDefaultContiunesEndCommand(AdvCommand last, AdvSettingDataManager dataManager)
		{
			Type type = last.GetType();
			if( type == typeof(AdvCommandSelection) )
			{
				return new AdvCommandSelectionEnd(null, dataManager);
			}
			else if (type == typeof(AdvCommandSelectionClick))
			{
				return new AdvCommandSelectionClickEnd(null, dataManager);
			}
			else if (type == typeof(AdvCommandJumpRandom))
			{
				return new AdvCommandJumpRandomEnd(null, dataManager);
			}
			else
			{
				return null;
			}
		}
		//スクリプトから初期化
		public void InitOnCreate(AdvEngine engine, AdvSettingDataManager settingDataManager, AdvScenarioDataExported[] exportedScenarioDataTbl, string rootResourceDir)
		{
			this.engine = engine;
			this.settingDataManager = settingDataManager;
			this.exportedScenarioDataTbl = exportedScenarioDataTbl;
			this.rootResourceDir = rootResourceDir;
		}
		public AdvCommandSelectionEnd(StringGridRow row, AdvSettingDataManager dataManager)
			: base(row)
		{
			dataManager.PageContoroller.Clear();
		}
		public AdvCommandShake(StringGridRow row, AdvSettingDataManager dataManager)
			: base(row)
		{
			this.effectData = new AdvEffectDataShake(row);
		}
		/// <summary>
		/// 選択肢など連続するタイプのコマンドの場合は、連続が途切れたら終了コマンドを追加
		/// </summary>
		/// <param name="continuousCommand">連続しているコマンド</param>
		/// <param name="currentCommand">現在のコマンド</param>
		void TryAddContinusCommand(AdvCommand continuousCommand, AdvCommand currentCommand, List<AdvCommand> commandList, AdvSettingDataManager dataManager)
		{
			if (continuousCommand != null)
			{
				if ( currentCommand == null || !continuousCommand.CheckContinues(currentCommand))
				{
					AdvCommand command = AdvCommandParser.CreateContiunesEndCommand(continuousCommand, dataManager);
					if (null != command) commandList.Add(command);
				}
			}
		}
/*
		/// <summary>
		/// 指定インデックスのコマンドを取得
		/// </summary>
		/// <param name="index">インデックス</param>
		/// <returns>コマンド</returns>
		public AdvCommand GetCommand(int index)
		{
			return null;
		}
		
		/// <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 ParseFromStringGrid(StringGrid grid, AdvSettingDataManager dataManager)
		{
			isInit = false;
			List<AdvCommand> commandList = new List<AdvCommand>();
			AdvCommand continuousCommand = null;	//連続的なコマンド処理

			foreach (StringGridRow row in grid.Rows)
			{
				if (row.RowIndex < grid.DataTopRow ) continue;			//データの行じゃない
				if (row.IsEmpty) continue;								//データがない

				AdvCommand command = AdvCommandParser.CreateCommand( row, dataManager);
				if (null != command)
				{
					//連続するコマンドの場合は、連続が途切れたら終了コマンドを追加
					TryAddContinusCommand(continuousCommand, command, commandList, dataManager);
					//コマンド追加
					if (null != command) commandList.Add(command);
					//連続するコマンドの場合は、連続が途切れたら終了コマンドを追加
					continuousCommand = command.IsContinusCommand ? command : null; ;
				}
			}
			//連続するコマンドの場合は、連続が途切れたら終了コマンドを追加
			TryAddContinusCommand(continuousCommand, null, commandList, dataManager);

			MakeScanerioLabelData(commandList);
			isInit = true;
		}