Esempio n. 1
0
        //ページ情報の初期化
        internal void InitPages()
        {
            if (CommnadList.Count <= 0)
            {
                return;
            }

            this.pageDataList.Clear();

            {
                AdvScenarioPageData page = new AdvScenarioPageData(this, this.PageDataList.Count);
                pageDataList.Add(page);
                for (int i = 0; i < CommnadList.Count; ++i)
                {
                    AdvCommand command = CommnadList[i];
                    page.AddCommand(command);
                    //ページデータの作成(ページ末端判定にも使うのでここで行う)
                    command.MakePageData(page);
                    //ページが最後かチェック
                    if (command.IsTypePageEnd() && i + 1 < CommnadList.Count)
                    {
                        page = new AdvScenarioPageData(this, this.PageDataList.Count);
                        pageDataList.Add(page);
                    }
                }
            }

            foreach (AdvScenarioPageData page in pageDataList)
            {
                page.Init();
            }
        }
 //コマンドの追加
 public void AddCommand(AdvCommand command)
 {
     cuurentPageData.AddCommand(command);
     if (command.IsTypePageEnd())
     {
         cuurentPageData = new AdvScenarioPageData();
         pageDataList.Add(cuurentPageData);
     }
 }
		//コマンドの追加
		public void AddCommand(AdvCommand command)
		{
			cuurentPageData.AddCommand(command);
			if (command.IsTypePageEnd())
			{
				cuurentPageData = new AdvScenarioPageData();
				pageDataList.Add(cuurentPageData);
			}
		}
Esempio n. 4
0
        /// <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;
            }
        }
Esempio n. 5
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();
        }
        //一ページ内のコマンド処理
        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);
            }
        }
Esempio n. 7
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);
            }
        }