コード例 #1
0
    public void StartNewGame()
    {
        if (!debug)
        {
            //only show intro text if it's not empty
            if (!string.IsNullOrEmpty(scenario.introBookData.pages[0]))
            {
                interactionManager.GetNewTextPanel().ShowOkContinue(scenario.introBookData.pages[0], ButtonIcon.Continue, () =>
                {
                    uiControl.interactable = true;

                    if (objectiveManager.Exists(scenario.objectiveName))
                    {
                        objectiveManager.TrySetFirstObjective(scenario.objectiveName, () =>
                        {
                            chapterManager.TryTriggerChapter("Start", true);
                        });
                    }
                    else
                    {
                        chapterManager.TryTriggerChapter("Start", true);
                    }

                    //fire any campaign triggers
                    if (Bootstrap.campaignState != null)
                    {
                        foreach (var t in Bootstrap.campaignState.campaignTriggerState)
                        {
                            triggerManager.FireTrigger(t);
                        }
                    }
                });
            }
            else
            {
                uiControl.interactable = true;

                if (objectiveManager.Exists(scenario.objectiveName))
                {
                    objectiveManager.TrySetFirstObjective(scenario.objectiveName, () =>
                    {
                        chapterManager.TryTriggerChapter("Start", true);
                    });
                }
                else
                {
                    chapterManager.TryTriggerChapter("Start", true);
                }

                //fire any campaign triggers
                if (Bootstrap.campaignState != null)
                {
                    foreach (var t in Bootstrap.campaignState.campaignTriggerState)
                    {
                        triggerManager.FireTrigger(t);
                    }
                }
            }
        }
        else
        {
            //debug quickstart a chapter:
            objectiveManager.DebugSetObjective(scenario.objectiveName);
            uiControl.interactable = true;
            chapterManager.TryTriggerChapter("Start", true);
        }
    }