Ejemplo n.º 1
0
        //サブルーチンの帰り先を見つけて情報を設定
        internal bool TrySetSubroutineRetunInfo(int subroutineCommandIndex, SubRoutineInfo info)
        {
            info.ReturnLabel = ScenarioLabel;

            AdvCommand calledCommand = null;
            int        index         = 0;

            foreach (AdvScenarioPageData page in PageDataList)
            {
                foreach (AdvCommand cmd in page.CommandList)
                {
                    //呼び出し元のコマンドを探す
                    System.Type type = cmd.GetType();
                    if (calledCommand == null)
                    {
                        if (type == typeof(AdvCommandJumpSubroutine) || type == typeof(AdvCommandJumpSubroutineRandom))
                        {
                            if (index == subroutineCommandIndex)
                            {
                                calledCommand = cmd;
                            }
                            else
                            {
                                ++index;
                            }
                        }
                    }
                    else
                    {
                        //呼び出しもとは見つかってるので、飛び先のコマンドを見つける
                        if (calledCommand.GetType() == typeof(AdvCommandJumpSubroutine))
                        {
                            //呼び出し元のコマンドの次のコマンド
                            info.ReturnPageNo  = page.PageNo;
                            info.ReturnCommand = cmd;
                            return(true);
                        }
                        if (calledCommand.GetType() == typeof(AdvCommandJumpSubroutineRandom))
                        {
                            if (type != typeof(AdvCommandJumpSubroutineRandom) && type != typeof(AdvCommandJumpSubroutineRandom))
                            {
                                //ランダムサブルーチンが終わったところ
                                info.ReturnPageNo  = page.PageNo;
                                info.ReturnCommand = cmd;
                                return(true);
                            }
                        }
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 2
0
 //ロード直後のときなどのために、Ifスキップ
 internal int GetIfSkipCommandIndex(int index)
 {
     for (int i = index; i < CommandList.Count; ++i)
     {
         AdvCommand command = CommandList[i];
         //AdvCommandIfで始まっていない場合は、AdvCommandEndIfまでスキップする
         if (command.IsIfCommand)
         {
             if (command.GetType() == typeof(AdvCommandIf))
             {
                 return(index);
             }
             else
             {
                 for (int j = index + 1; j < CommandList.Count; ++j)
                 {
                     if (CommandList[j].GetType() == typeof(AdvCommandEndIf))
                     {
                         return(j);
                     }
                 }
             }
         }
     }
     return(index);
 }
Ejemplo n.º 3
0
 //次のコマンドと連続コマンドかチェック
 public bool CheckContinues(AdvCommand nextCommand)
 {
     if (nextCommand.IsIfCommand)
     {
         return(true);
     }
     else
     {
         return(nextCommand.GetType() == this.GetType());
     }
 }
Ejemplo n.º 4
0
        //連続コマンドの終了コマンドを取得
        static public AdvCommand CreateDefaultContiunesEndCommand(AdvCommand last)
        {
            Type type = last.GetType();

            if (type == typeof(AdvCommandSelection))
            {
                return(new AdvCommandSelectionEnd());
            }
            else
            {
                return(null);
            }
        }
        //連続コマンドの終了コマンドを取得
        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);
            }
        }
Ejemplo n.º 6
0
        IEnumerator CoStartScenario(AdvEngine engine, string label, int page, string gallerySceneLabel)
        {
            if ((debugOutPut & DebugOutPut.Log) == DebugOutPut.Log)
            {
                Debug.Log("Jump : " + label + " :" + page);
            }
            if (!engine.DataManager.IsReadySettingData)
            {
                Debug.LogError("Not ready SettingData");
            }

            isWaitLoading = true;
            while (!engine.DataManager.IsLoadEndScenarioLabel(label))
            {
                yield return(0);
            }
            scearioData = engine.DataManager.FindScenarioData(label);

            Reset();
            //指定のページまでジャンプ
            currentIndex             = scearioData.SeekPageIndex(label, page);
            currentScenarioLabel     = label;
            currentPage              = (page < 0) ?  page : page - 1;
            currentGallerySceneLabel = gallerySceneLabel;
            engine.Page.BeginPage(currentScenarioLabel, currentPage);
            UpdateSceneGallery(currentScenarioLabel, engine);

            isWaitLoading = false;
            if (preloadFileSet.Count > 0)
            {
                Debug.LogError("Error Preload Clear");
            }

            AdvCommand command = scearioData.GetCommand(currentIndex);

            while (null != command)
            {
                //ロード
                command.Load();

                //プリロードを更新
                if (command.IsExistLoadFile())
                {
                    UpdatePreLoadFiles(currentIndex, MAX_PRELOAD_FILES);
                }

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

                ///シナリオラベルの更新
                if (!string.IsNullOrEmpty(command.GetScenarioLabel()))
                {
                    currentScenarioLabel = command.GetScenarioLabel();
                    currentPage          = -1;
                    ///ページ開始処理
                    engine.Page.BeginPage(currentScenarioLabel, currentPage);
                    UpdateSceneGallery(currentScenarioLabel, engine);
                }

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

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

                //コマンドの処理待ち
                while (command.Wait(engine))
                {
                    if ((debugOutPut & DebugOutPut.Waiting) == DebugOutPut.Waiting)
                    {
                        Debug.Log("Wait..." + command.GetType());
                    }
                    yield return(0);
                }

                if ((debugOutPut & DebugOutPut.CommandEnd) == DebugOutPut.CommandEnd)
                {
                    Debug.Log("End :" + command.GetType() + " " + label + ":" + page);
                }

                ///改ページ処理
                if (command.IsTypePageEnd())
                {
                    engine.SystemSaveData.ReadData.AddReadPage(engine.Page.ScenarioLabel, engine.Page.PageNo);
                    engine.Page.EndPage();
                }

                //次のコマンドへ
                do
                {
                    ++currentIndex;
                    command = scearioData.GetCommand(currentIndex);

                    //ifスキップチェック
                    if (!ifManager.CheckSkip(command))
                    {
                        break;
                    }
                    else
                    {
                        ///ページ末端
                        if (command.IsTypePageEnd())
                        {
                            ++currentPage;
                        }
                    }
                } while (true);
            }

            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;
			}
		}
Ejemplo n.º 8
0
		//次のコマンドと連続コマンドかチェック
		public bool CheckContinues(AdvCommand nextCommand)
		{
			return (nextCommand.GetType() == this.GetType() );
		}
        //一ページ内のコマンド処理
        IEnumerator CoStartPage(AdvScenarioLabelData labelData, AdvScenarioPageData pageData, int page)
        {
            int        index   = 0;
            AdvCommand command = pageData.GetCommand(index);

            while (command != null)
            {
                //古いセーブデータのロード中はページ末までスキップ
                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 + ":" + page);
                    }
                    command = pageData.GetCommand(++index);
                    continue;
                }

                //ロード
                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 + ":" + page);
                }
                command.DoCommand(engine);
                ///ページ末端・オートセーブデータを更新
//				if (command.IsTypePageEnd())
//				{
//					///ページ開始処理
//					engine.Page.BeginPage(currentScenarioLabel, currentPage);
//					engine.SaveManager.UpdateAutoSaveData(engine);
//				}

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

                //コマンドの処理待ち
                while (command.Wait(engine))
                {
                    if ((debugOutPut & DebugOutPut.Waiting) == DebugOutPut.Waiting)
                    {
                        Debug.Log("Wait..." + command.GetType());
                    }
                    yield return(0);
                }

                if ((debugOutPut & DebugOutPut.CommandEnd) == DebugOutPut.CommandEnd)
                {
                    Debug.Log("End :" + command.GetType() + " " + labelData.ScenaioLabel + ":" + page);
                }

                if (IsBreakCommand)
                {
                    yield break;
                }
                command = pageData.GetCommand(++index);
            }
        }
Ejemplo n.º 10
0
        //一ページ内のコマンド処理
        IEnumerator CoStartPage(AdvScenarioLabelData labelData, AdvScenarioPageData pageData, AdvCommand returnToCommand, bool skipPageHeaer)
        {
            if (pageData.CheckSkipByLocalize())
            {
                yield break;
            }

            int        index   = skipPageHeaer ? pageData.IndexTextTopCommand : 0;
            AdvCommand command = pageData.GetCommand(index);

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

            //復帰直後はIf内分岐は無効
            if (IfManager.OldSaveDataStart)
            {
                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);
            }
        }
Ejemplo n.º 11
0
        //一ページ内のコマンド処理
        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);
            }
        }
Ejemplo n.º 12
0
 //次のコマンドと連続コマンドかチェック
 public bool CheckContinues(AdvCommand nextCommand)
 {
     return(nextCommand.GetType() == this.GetType());
 }