Beispiel #1
0
        //コマンドデータの解析・初期化
        void ParseFromStringGrid(StringGrid grid, AdvSettingDataManager dataManager)
        {
            AddCommandBegin();
            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);
                    //コマンド追加
                    AddCommand(command);
                    //連続するコマンドの場合は、連続が途切れたら終了コマンドを追加
                    continuousCommand = GetNextContinusCommand(continuousCommand, command);
                }
            }
            //連続するコマンドの場合は、連続が途切れたら終了コマンドを追加
            TryAddContinusCommand(continuousCommand, null);

            AddCommandEnd();
        }
        public AdvCommandSelection(StringGridRow row, AdvSettingDataManager dataManager)
        {
            this.jumpLabel = AdvCommandParser.ParseScenarioLabel(row, AdvColumnName.Arg1);
            this.text      = AdvParser.ParseCell <string>(row, AdvColumnName.Text);
            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));
                }
            }
        }
        private void AddExtraCommand(List <AdvCommand> commandList, AdvSettingDataManager dataManager)
        {
            int index = 0;

            while (index < commandList.Count)
            {
                AdvCommand command = commandList[index];
                AdvCommand next    = ((index + 1) >= commandList.Count) ? null : commandList[index + 1];
                index++;
                string[] extraCommandIdArray = command.GetExtraCommandIdArray(next);
                if (extraCommandIdArray != null)
                {
                    foreach (string str in extraCommandIdArray)
                    {
                        AdvCommand item = AdvCommandParser.CreateCommand(str, command.RowData, dataManager);
                        if (command.IsEntityType)
                        {
                            item.EntityData = command.EntityData;
                        }
                        commandList.Insert(index, item);
                        index++;
                    }
                }
            }
        }
Beispiel #4
0
        public List <AdvCommand> CreateCommandList(AdvSettingDataManager dataManager)
        {
            List <AdvCommand> commandList = new List <AdvCommand>();

            foreach (StringGridRow row in Rows)
            {
                if (row.RowIndex < DataTopRow)
                {
                    continue;                                                      //データの行じゃない
                }
                if (row.IsEmptyOrCommantOut)
                {
                    continue;                                                      //データがない
                }
                Profiler.BeginSample("コマンド作成");

                AdvCommand command = AdvCommandParser.CreateCommand(row, dataManager);
                Profiler.EndSample();

                //エンティティ処理がある
                Profiler.BeginSample("GetEntityIndex");
                int entityIndex = GetEntityIndex(row.RowIndex);
                Profiler.EndSample();
                if (entityIndex >= 0)
                {
                    command.EntityData = entityDataList[entityIndex];
                }
                if (null != command)
                {
                    commandList.Add(command);
                }
            }
            return(commandList);
        }
Beispiel #5
0
		public bool TryParseMacro(StringGridRow row, AdvSettingDataManager dataManager, out List<AdvCommand> commnadList)
		{
			commnadList = null;
			string commandName = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Command,"");
			AdvMacroData data;
			if( macroDataTbl.TryGetValue(commandName, out data ) )
			{
				commnadList = new List<AdvCommand>();
				List<StringGridRow> macroRows = data.MakeMacroRows(row);
				foreach( StringGridRow macroRow in macroRows )
				{
					List<AdvCommand> list;
					if( TryParseMacro( macroRow, dataManager, out list ) )
					{
						commnadList.AddRange(list);
					}
					else
					{
						commnadList.Add(AdvCommandParser.CreateCommand(macroRow, dataManager));
					}
				}
				return true;
			}
			else
			{
				return false;
			}
		}
Beispiel #6
0
        /// <summary>
        /// 選択肢終了などの特別なコマンドを自動解析して追加
        /// </summary>
        /// <param name="continuousCommand">連続しているコマンド</param>
        /// <param name="currentCommand">現在のコマンド</param>
        void AddExtraCommand(List <AdvCommand> commandList, AdvSettingDataManager dataManager)
        {
            int index = 0;

            while (index < commandList.Count)
            {
                AdvCommand current = commandList[index];
                AdvCommand next    = index + 1 < commandList.Count ? commandList[index + 1] : null;
                ++index;
                string[] idArray = current.GetExtraCommandIdArray(next);
                if (idArray != null)
                {
                    foreach (string id in idArray)
                    {
                        AdvCommand extraCommand = AdvCommandParser.CreateCommand(id, current.RowData, dataManager);
                        if (current.IsEntityType)
                        {
                            extraCommand.EntityData = current.EntityData;
                        }
                        commandList.Insert(index, extraCommand);
                        ++index;
                    }
                }
            }
        }
Beispiel #7
0
		//シナリオラベルを解析・取得
		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;
		}
Beispiel #8
0
        /// <summary>
        /// StringGridの一行からデータ初期化
        /// </summary>
        /// <param name="row">初期化するためのデータ</param>
        /// <returns>成否</returns>
        public override bool InitFromStringGridRow(StringGridRow row)
        {
            string key = AdvCommandParser.ParseScenarioLabel(row, AdvColumnName.ScenarioLabel);

            InitKey(key);
            this.title            = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Title, "");
            this.thumbnailName    = AdvParser.ParseCell <string>(row, AdvColumnName.Thumbnail);
            this.thumbnailVersion = AdvParser.ParseCellOptional <int>(row, AdvColumnName.ThumbnailVersion, 0);
            return(true);
        }
Beispiel #9
0
 /// <summary>
 /// 選択肢など連続するタイプのコマンドの場合は、連続が途切れたら終了コマンドを追加
 /// </summary>
 /// <param name="continuousCommand">連続しているコマンド</param>
 /// <param name="currentCommand">現在のコマンド</param>
 void TryAddContinusCommand(AdvCommand continuousCommand, AdvCommand currentCommand)
 {
     if (continuousCommand != null)
     {
         if (currentCommand == null || !continuousCommand.CheckContinues(currentCommand))
         {
             AddCommand(AdvCommandParser.CreateContiunesEndCommand(continuousCommand));
         }
     }
 }
Beispiel #10
0
        public override bool InitFromStringGridRow(StringGridRow row)
        {
            string key = AdvCommandParser.ParseScenarioLabel(row, AdvColumnName.ScenarioLabel);

            base.InitKey(key);
            this.title            = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Title, string.Empty);
            this.thumbnailName    = AdvParser.ParseCell <string>(row, AdvColumnName.Thumbnail);
            this.thumbnailVersion = AdvParser.ParseCellOptional <int>(row, AdvColumnName.ThumbnailVersion, 0);
            this.category         = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Categolly, string.Empty);
            base.RowData          = row;
            return(true);
        }
Beispiel #11
0
 /// <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);
             }
         }
     }
 }
        public override bool InitFromStringGridRow(StringGridRow row)
        {
            int    num;
            string key = AdvCommandParser.ParseScenarioLabel(row, AdvColumnName.Label);

            base.InitKey(key);
            this.Type             = AdvParser.ParseCellOptional <LipSynchType>(row, AdvColumnName.Type, LipSynchType.TextAndVoice);
            this.Interval         = AdvParser.ParseCellOptional <float>(row, AdvColumnName.Interval, 0.2f);
            this.ScaleVoiceVolume = (float)AdvParser.ParseCellOptional <int>(row, AdvColumnName.ScaleVoiceVolume, 1);
            this.Tag = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Tag, "lip");
            if (row.Grid.TryGetColumnIndex(AdvColumnName.Name0.QuickToString(), out num))
            {
                this.animationData.TryParse(row, num);
            }
            return(true);
        }
Beispiel #13
0
        public override bool InitFromStringGridRow(StringGridRow row)
        {
            int    num;
            string key = AdvCommandParser.ParseScenarioLabel(row, AdvColumnName.Label);

            base.InitKey(key);
            this.IntervalMin          = AdvParser.ParseCellOptional <float>(row, AdvColumnName.IntervalMin, 2f);
            this.IntervalMax          = AdvParser.ParseCellOptional <float>(row, AdvColumnName.IntervalMax, 6f);
            this.RandomDoubleEyeBlink = AdvParser.ParseCellOptional <float>(row, AdvColumnName.RandomDouble, 0.2f);
            this.Tag = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Tag, "eye");
            if (row.Grid.TryGetColumnIndex(AdvColumnName.Name0.QuickToString(), out num))
            {
                this.animationData.TryParse(row, num);
            }
            return(true);
        }
Beispiel #14
0
        //今のコマンドから、エンティティ処理したコマンドを作成
        public static AdvCommand CreateEntityCommand(AdvCommand original, AdvEngine engine, AdvScenarioPageData pageData)
        {
            StringGridRow row = new StringGridRow(original.RowData.Grid, original.RowData.RowIndex);

            row.DebugIndex = original.RowData.DebugIndex;

            string[] strings = original.EntityData.CreateCommandStrings(engine.Param.GetParameter);
            row.InitFromStringArray(strings);
            AdvCommand entityCommand = AdvCommandParser.CreateCommand(original.Id, row, engine.DataManager.SettingDataManager);

            if (entityCommand is AdvCommandText)
            {
                AdvCommandText textCommand = entityCommand as AdvCommandText;
                textCommand.InitOnCreateEntity(original as AdvCommandText);
            }
            return(entityCommand);
        }
Beispiel #15
0
        //今のコマンドから、エンティティ処理したコマンドを作成
        public AdvCommand CreateEntityCommand(AdvEngine engine, AdvScenarioPageData pageData)
        {
            StringGridRow row;

            if (!TryParseRowDataEntity(this.OriginalRowData, engine.Param.GetParameter, out row))
            {
                return(this);
            }

            AdvCommand command = AdvCommandParser.CreateCommand(row, engine.DataManager.SettingDataManager);

            if (this.TextDataInPage != null)
            {
                command.InitTextDataInPage(this.TextDataInPage);
                this.TextDataInPage.Command = command;
            }
            return(command);
        }
        public AdvCommandJumpRandom(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));
                }
            }
            this.rate = AdvParser.ParseCellOptional <float>(row, AdvColumnName.Arg3, 1);
        }
Beispiel #17
0
        //シナリオデータとして解析
        public void Init(AdvSettingDataManager dataManager, AdvMacroManager macroManger)
        {
            isInit = false;
            List <AdvCommand> commandList = new List <AdvCommand>();

            foreach (StringGridRow row in DataGrid.Rows)
            {
                if (row.RowIndex < DataGrid.DataTopRow)
                {
                    continue;                                                                           //データの行じゃない
                }
                if (row.IsEmptyOrCommantOut)
                {
                    continue;                                                                                                   //データがない
                }
                List <AdvCommand> macroCommnadList;
                AdvCommand.StartCheckEntity(dataManager.DefaultParam.GetParameter);
                bool isMacro = macroManger.TryParseMacro(row, dataManager, out macroCommnadList);
                AdvCommand.EndCheckEntity();
                if (isMacro)
                {
                    //マクロの場合
                    commandList.AddRange(macroCommnadList);
                }
                else
                {
                    //通常コマンド
                    AdvCommand command = AdvCommandParser.CreateCommand(row, dataManager);
                    if (null != command)
                    {
                        commandList.Add(command);
                    }
                }
            }
            //選択肢終了などの特別なコマンドを自動解析して追加
            AddExtraCommand(commandList, dataManager);
            //シナリオラベルデータを作成
            MakeScanerioLabelData(commandList);
            isInit = true;
        }
Beispiel #18
0
        public List <AdvCommand> CreateCommandList(AdvSettingDataManager dataManager)
        {
            List <AdvCommand> list = new List <AdvCommand>();

            foreach (StringGridRow row in base.Rows)
            {
                if ((row.RowIndex >= base.DataTopRow) && !row.IsEmptyOrCommantOut)
                {
                    AdvCommand item        = AdvCommandParser.CreateCommand(row, dataManager);
                    int        entityIndex = this.GetEntityIndex(row.RowIndex);
                    if (entityIndex >= 0)
                    {
                        item.EntityData = this.entityDataList[entityIndex];
                    }
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
Beispiel #19
0
        /// <summary>
        /// StringGridの一行からデータ初期化
        /// </summary>
        /// <param name="row">初期化するためのデータ</param>
        /// <returns>成否</returns>
        public override bool InitFromStringGridRow(StringGridRow row, AdvBootSetting bootSetting)
        {
            string key = AdvCommandParser.ParseScenarioLabel(row, AdvColumnName.ScenarioLabel);

            InitKey(key);
            this.title            = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Title, "");
            this.thumbnailName    = AdvParser.ParseCell <string>(row, AdvColumnName.Thumbnail);
            this.thumbnailVersion = AdvParser.ParseCellOptional <int>(row, AdvColumnName.ThumbnailVersion, 0);
            this.category         = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Categolly, "");
            this.RowData          = row;

            this.thumbnailPath = bootSetting.ThumbnailDirInfo.FileNameToPath(thumbnailName);
            //ファイルマネージャーにバージョンの登録
            AssetFile file = AssetFileManager.GetFileCreateIfMissing(this.ThumbnailPath);

            if (file != null)
            {
                file.Version = this.ThumbnailVersion;
            }

            return(true);
        }
Beispiel #20
0
/*
 *              /// <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;
        }
 public AdvCommandScenarioLabel(StringGridRow row)
 {
     this.scenarioLabel = AdvCommandParser.ParseScenarioLabel(row, AdvColumnName.Command);
     this.title         = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Arg1, this.scenarioLabel);
 }
Beispiel #22
0
 bool TryParseMacoBegin(StringGridRow row, out string macroName)
 {
     return(AdvCommandParser.TryParseScenarioLabel(row, AdvColumnName.Command, out macroName));
 }