//コマンドの追加
		public void AddCommand(AdvCommand command)
		{
			cuurentPageData.AddCommand(command);
			if (command.IsTypePageEnd())
			{
				cuurentPageData = new AdvScenarioPageData();
				pageDataList.Add(cuurentPageData);
			}
		}
		//次のコマンドと連続コマンドかチェック
		public bool CheckContinues(AdvCommand nextCommand)
		{
			return (nextCommand.GetType() == this.GetType() );
		}
		//コマンドの追加
		public void AddCommand(AdvCommand command)
		{
			commnadList.Add(command);
		}
		/// <summary>
		/// 分岐によるスキップをする(条件判定がfalseなため処理をしない)か
		/// </summary>
		/// <param name="command">コマンドデータ</param>
		/// <returns>スキップする場合はtrue。しない場合はfalse</returns>
		public bool CheckSkip(AdvCommand command)
		{
			if (command == null) return false;

			if (null == current)
			{
				return false;
			}
			else
			{
				if (current.IsSkpping)
				{
					return !command.IsIfCommand;
				}
				else
				{
					return false;
				}
			}
		}
		/// <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);
				}
			}
		}
Exemple #6
0
 // 選択肢終了などの特別なコマンドを自動生成する場合、そのIDを返す
 public virtual string[] GetExtraCommandIdArray(AdvCommand next)
 {
     return(null);
 }
        //一ページ内のコマンド処理
        IEnumerator CoStartPage(AdvScenarioLabelData labelData, AdvScenarioPageData pageData, AdvCommand returnToCommand)
        {
            int        index   = 0;
            AdvCommand command = pageData.GetCommand(index);

            if (returnToCommand != null)
            {
                while (command != returnToCommand)
                {
                    command = pageData.GetCommand(++index);
                }
            }

            //復帰直後はIf内分岐は無効
            if (IfManager.IsLoadInit)
            {
                index   = pageData.GetIfSkipCommandIndex(index);
                command = pageData.GetCommand(index);
            }

            while (command != null)
            {
                if (command.IsEntityType)
                {
                    command = command.CreateEntityCommand(Engine, pageData);
                }

                //古いセーブデータのロード中はページ末までスキップ
                if (IsOldVersion && !command.IsTypePageEnd())
                {
                    command = pageData.GetCommand(++index);
                    continue;
                }

                //ifスキップチェック
                if (IfManager.CheckSkip(command))
                {
                    if ((debugOutPut & DebugOutPut.Log) == DebugOutPut.Log)
                    {
                        Debug.Log("Command If Skip: " + command.GetType() + " " + labelData.ScenaioLabel + ":" + pageData.PageNo);
                    }
                    command = pageData.GetCommand(++index);
                    continue;
                }

                currentCommand = command;
                //ロード
                command.Load();

                //ロード待ち
                while (!command.IsLoadEnd())
                {
                    isWaitLoading = true;
                    yield return(0);
                }
                isWaitLoading = false;

                //コマンド実行
                if ((debugOutPut & DebugOutPut.Log) == DebugOutPut.Log)
                {
                    Debug.Log("Command : " + command.GetType() + " " + labelData.ScenaioLabel + ":" + pageData.PageNo);
                }
                this.OnBeginCommand.Invoke(command);
                command.DoCommand(engine);
                ///ページ末端・オートセーブデータを更新
//				if (command.IsTypePageEnd())
//				{
//					///ページ開始処理
//					engine.Page.BeginPage(currentScenarioLabel, currentPage);
//					engine.SaveManager.UpdateAutoSaveData(engine);
//				}

                //コマンド実行後にファイルをアンロード
                command.Unload();

                while (IsPausing)
                {
                    yield return(0);
                }
                //コマンドの処理待ち
                while (true)
                {
                    this.OnUpdatePreWaitingCommand.Invoke(command);
                    if (!command.Wait(engine))
                    {
                        break;
                    }
                    if ((debugOutPut & DebugOutPut.Waiting) == DebugOutPut.Waiting)
                    {
                        Debug.Log("Wait..." + command.GetType());
                    }
                    this.OnUpdateWaitingCommand.Invoke(command);
                    yield return(0);
                }
                if ((debugOutPut & DebugOutPut.CommandEnd) == DebugOutPut.CommandEnd)
                {
                    Debug.Log("End :" + command.GetType() + " " + labelData.ScenaioLabel + ":" + pageData.PageNo);
                }
                this.OnEndCommand.Invoke(command);

                Engine.UiManager.IsInputTrig       = false;
                Engine.UiManager.IsInputTrigCustom = false;

                if (IsBreakCommand)
                {
                    yield break;
                }
                command = pageData.GetCommand(++index);
            }
        }
 //次のコマンドと連続コマンドかチェック
 public bool CheckContinues(AdvCommand nextCommand)
 {
     return(nextCommand.GetType() == this.GetType());
 }
Exemple #9
0
        public static AdvCharacterInfo Create(AdvCommand command, AdvSettingDataManager dataManager)
        {
            if (command.IsEmptyCell(AdvColumnName.Arg1))
            {
                return(null);
            }

            //名前
            string nameText       = command.ParseCell <string>(AdvColumnName.Arg1);
            string characterLabel = nameText;
            //第二引数を解析
            //基本的にはパターン名だが
            //キャラクターラベルの指定タグがあったり、非表示タグする
            bool   isHide  = false;
            string erroMsg = "";
            string pattern = ParserUtil.ParseTagTextToString(
                command.ParseCellOptional <string>(AdvColumnName.Arg2, ""),
                (tagName, arg) =>
            {
                bool failed = false;
                switch (tagName)
                {
                case "Off":
                    //非表示タグ
                    isHide = true;
                    break;

                case "Character":
                    //キャラクターラベルの指定タグ
                    characterLabel = arg;
                    break;

                default:
                    erroMsg = "Unkownn Tag <" + tagName + ">";
                    failed  = true;
                    break;
                }
                return(!failed);
            });

            if (!string.IsNullOrEmpty(erroMsg))
            {
                Debug.LogError(erroMsg);
                return(null);
            }

            if (!dataManager.CharacterSetting.Contains(characterLabel))
            {
                //そもそもキャラ表示がない場合、名前表示のみになる
                return(new AdvCharacterInfo(characterLabel, nameText, pattern, isHide, null));
            }

            AdvCharacterSettingData data = dataManager.CharacterSetting.GetCharacterData(characterLabel, pattern);

            //キャラの表示情報の記述エラー
            if (data == null)
            {
                Debug.LogError(command.ToErrorString(characterLabel + ", " + pattern + " is not contained in Chactecter Sheet"));
                return(null);
            }
            //名前テキストをキャラクターシートの定義に変更
            if (!string.IsNullOrEmpty(data.NameText) && nameText == characterLabel)
            {
                nameText = data.NameText;
            }
            return(new AdvCharacterInfo(characterLabel, nameText, pattern, isHide, data.Graphic));
        }
Exemple #10
0
        //一ページ内のコマンド処理
        IEnumerator CoStartPage(AdvScenarioLabelData labelData, AdvScenarioPageData pageData, AdvCommand returnToCommand, bool skipPageHeaer)
        {
            int        index   = skipPageHeaer ? pageData.IndexTextTopCommand : 0;
            AdvCommand command = pageData.GetCommand(index);

            if (returnToCommand != null)
            {
                while (command != returnToCommand)
                {
                    command = pageData.GetCommand(++index);
                }
            }

            //復帰直後はIf内分岐は無効
            if (IfManager.IsLoadInit)
            {
                index   = pageData.GetIfSkipCommandIndex(index);
                command = pageData.GetCommand(index);
            }

            //ページ冒頭の状態をセーブデータとして記憶
            if (EnableSaveOnPageTop() && pageData.EnableSave)
            {
                SkipPageHeaerOnSave = false;
                Engine.SaveManager.UpdateAutoSaveData(Engine);
            }
            //システムパラメーターの変更があった場合にシステムセーブデータとして記憶
            CheckSystemDataWriteIfChanged();

            while (command != null)
            {
                if (command.IsEntityType)
                {
                    //エンティティコマンドの場合は、コマンドを作り直して差し替え
                    command = AdvEntityData.CreateEntityCommand(command, Engine, pageData);
                }

                //ifスキップチェック
                if (IfManager.CheckSkip(command))
                {
                    if (ScenarioPlayer.DebugOutputLog)
                    {
                        Debug.Log("Command If Skip: " + command.GetType() + " " + labelData.ScenarioLabel + ":" + pageData.PageNo);
                    }
                    command = pageData.GetCommand(++index);
                    continue;
                }

                currentCommand = command;
                //ロード
                command.Load();

                //テキスト表示開始時におけるオートセーブ
                if (EnableSaveTextTop() && pageData.EnableSaveTextTop(command))
                {
                    SkipPageHeaerOnSave = true;
                    //オートセーブデータ作成
                    Engine.SaveManager.UpdateAutoSaveData(Engine);
                    //システムパラメーターの変更があった場合にシステムセーブデータとして記憶
                    CheckSystemDataWriteIfChanged();
                }

                //ロード待ち
                while (!command.IsLoadEnd())
                {
                    IsLoading = true;
                    yield return(null);
                }
                IsLoading = false;

                //コマンド実行
                command.CurrentTread = this;
                if (ScenarioPlayer.DebugOutputLog)
                {
                    Debug.Log("Command : " + command.GetType() + " " + labelData.ScenarioLabel + ":" + pageData.PageNo);
                }
                ScenarioPlayer.OnBeginCommand.Invoke(command);
                command.DoCommand(Engine);

                //コマンド実行後にファイルをアンロード
                command.Unload();
                command.CurrentTread = null;

                while (ScenarioPlayer.IsPausing)
                {
                    yield return(null);
                }
                //コマンドの処理待ち
                while (true)
                {
                    command.CurrentTread = this;
                    ScenarioPlayer.OnUpdatePreWaitingCommand.Invoke(command);
                    if (!command.Wait(Engine))
                    {
                        break;
                    }
                    if (ScenarioPlayer.DebugOutputWaiting)
                    {
                        Debug.Log("Wait..." + command.GetType());
                    }
                    ScenarioPlayer.OnUpdateWaitingCommand.Invoke(command);
                    command.CurrentTread = null;
                    yield return(null);
                }
                command.CurrentTread = this;
                if (ScenarioPlayer.DebugOutputCommandEnd)
                {
                    Debug.Log("End :" + command.GetType() + " " + labelData.ScenarioLabel + ":" + pageData.PageNo);
                }
                ScenarioPlayer.OnEndCommand.Invoke(command);
                command.CurrentTread = null;

                Engine.UiManager.IsInputTrig       = false;
                Engine.UiManager.IsInputTrigCustom = false;

                if (IsBreakCommand)
                {
                    yield break;
                }
                command = pageData.GetCommand(++index);
            }
        }
Exemple #11
0
 //現在のコマンドか判別
 public bool IsCurrentCommand(AdvCommand command)
 {
     return((command != null) && (currentCommand == command));
 }
Exemple #12
0
        //指定のシナリオを再生
        IEnumerator CoStartScenario(string label, int page, AdvCommand returnToCommand, bool skipPageHeaer)
        {
            IsPlaying           = true;
            SkipPageHeaerOnSave = false;
            //ジャンプ先のシナリオラベルのログを出力
            if (ScenarioPlayer.DebugOutputLog)
            {
                Debug.Log("Jump : " + label + " :" + page);
            }

            //起動時のロード待ち
            while (Engine.IsLoading)
            {
                yield return(null);
            }


            //シナリオロード待ち
            IsLoading = true;
            while (!Engine.DataManager.IsLoadEndScenarioLabel(label))
            {
                yield return(null);
            }
            IsLoading = false;

            //各データをリセット
            ResetOnJump();

            if (page < 0)
            {
                page = 0;
            }
            //ページ指定がある場合はif分岐の設定をしておく
            if (page != 0)
            {
                ifManager.IsLoadInit = true;
            }

            //ジャンプ先のシナリオデータを取得
            AdvScenarioLabelData currentLabelData = Engine.DataManager.FindScenarioLabelData(label);

            while (currentLabelData != null)
            {
                ScenarioPlayer.UpdateSceneGallery(currentLabelData.ScenarioLabel, Engine);
                AdvScenarioPageData currentPageData = currentLabelData.GetPageData(page);
                //ページデータを取得
                while (currentPageData != null)
                {
                    //プリロードを更新
                    UpdatePreLoadFiles(currentLabelData.ScenarioLabel, page);

                    ///ページ開始処理
                    if (IsMainThread)
                    {
                        Engine.Page.BeginPage(currentPageData);
                    }

                    //0フレーム即コルーチンが終わる場合を考えてこう書く
                    var pageCoroutine = StartCoroutine(CoStartPage(currentLabelData, currentPageData, returnToCommand, skipPageHeaer));
                    if (pageCoroutine != null)
                    {
                        yield return(pageCoroutine);
                    }
                    currentCommand  = null;
                    returnToCommand = null;
                    skipPageHeaer   = false;
                    //ページ終了処理
                    if (IsMainThread)
                    {
                        Engine.Page.EndPage();
                    }
                    if (IsBreakCommand)
                    {
                        if (IsMainThread && ScenarioPlayer.IsReservedEndScenario)
                        {
                            ScenarioPlayer.EndScenario();
                            yield break;
                        }
                        else
                        {
                            if (JumpManager.IsReserved)
                            {
                                JumpToReserved();
                                yield break;
                            }
                            else
                            {
                                OnEndThread();
                                yield break;
                            }
                        }
                    }
                    currentPageData = currentLabelData.GetPageData(++page);
                }
                //ロード直後処理終了
                IfManager.IsLoadInit = false;
                currentLabelData     = Engine.DataManager.NextScenarioLabelData(currentLabelData.ScenarioLabel);
                page = 0;
            }
            OnEndThread();
        }
Exemple #13
0
 //ランダムジャンプのラベルを登録
 internal void AddRandom(AdvCommand command, float rate)
 {
     randomInfoList.Add(new RandomInfo(command, rate));
 }
Exemple #14
0
 public RandomInfo(AdvCommand command, float rate)
 {
     this.command = command;
     this.rate    = rate;
 }
		//連続コマンドの終了コマンドを取得
		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;
		}
Exemple #16
0
        //指定のシナリオを再生
        IEnumerator CoStartScenario(string label, int page, AdvCommand returnToCommand)
        {
            IsPlayingScenario = true;
            //ジャンプ先のシナリオラベルのログを出力
            if ((debugOutPut & DebugOutPut.Log) == DebugOutPut.Log)
            {
                Debug.Log("Jump : " + label + " :" + page);
            }

            //起動時のロード待ち
            while (Engine.IsLoading)
            {
                yield return(0);
            }


            //シナリオロード待ち
            isWaitLoading = true;
            while (!Engine.DataManager.IsLoadEndScenarioLabel(label))
            {
                yield return(0);
            }
            isWaitLoading = false;

            //各データをリセット
            ResetOnJump();

            if (page < 0)
            {
                page = 0;
            }
            //ページ指定がある場合はif分岐の設定をしておく
            if (page != 0)
            {
                ifManager.IsLoadInit = true;
            }

            //ジャンプ先のシナリオデータを取得
            AdvScenarioLabelData currentLabelData = Engine.DataManager.FindScenarioLabelData(label);

            while (currentLabelData != null)
            {
                UpdateSceneGallery(currentLabelData.ScenaioLabel, engine);
                AdvScenarioPageData cuurentPageData = currentLabelData.GetPageData(page);
                //ページデータを取得
                while (cuurentPageData != null)
                {
                    //プリロードを更新
                    UpdatePreLoadFiles(currentLabelData.ScenaioLabel, page);

                    ///ページ開始処理
                    Engine.Page.BeginPage(cuurentPageData);

                    //0フレーム即コルーチンが終わる場合を考えてこう書く
                    var pageCoroutine = StartCoroutine(CoStartPage(currentLabelData, cuurentPageData, returnToCommand));
                    if (pageCoroutine != null)
                    {
                        yield return(pageCoroutine);
                    }
                    currentCommand  = null;
                    returnToCommand = null;
                    while (Engine.EffectManager.IsPageWaiting)
                    {
                        yield return(0);
                    }

                    //古いバージョンのロード処理は終了
                    IsOldVersion = false;

                    ///改ページ処理
                    Engine.Page.EndPage();
                    if (IsBreakCommand)
                    {
                        if (IsReservedEndScenario)
                        {
                            break;
                        }
                        if (JumpManager.IsReserved)
                        {
                            JumpToReserved();
                        }
                        yield break;
                    }

                    cuurentPageData = currentLabelData.GetPageData(++page);
                }
                if (IsReservedEndScenario)
                {
                    break;
                }
                //ロード直後処理終了
                IfManager.IsLoadInit = false;
                currentLabelData     = Engine.DataManager.NextScenarioLabelData(currentLabelData.ScenaioLabel);
                page = 0;
            }
            EndScenario();
        }
		//連続コマンドの終了コマンドを取得
		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;
			}
		}
Exemple #18
0
 //選択肢待ち開始
 void OnBeginCommand(AdvCommand command)
 {
     time = -Time.deltaTime;
 }