コード例 #1
0
        public void OpenOrRestart(IDataContext context, TutorialId id)
        {
            var globalOptions = context.GetComponent <GlobalSettings>();
            var titleString   = TutorialXmlReader.ReadIntro(globalOptions.GetPath(id, PathType.WorkCopyContentFile));
            var step          = TutorialXmlReader.ReadCurrentStep(globalOptions.GetPath(id, PathType.WorkCopyContentFile));
            var firstTime     = step == 1;

            var titleWnd = new TitleWindow(titleString, firstTime);

            if (titleWnd.ShowDialog() != true)
            {
                return;
            }
            if (titleWnd.Restart)
            {
                SolutionCopyHelper.CopySolution(globalOptions.GetPath(id, PathType.BaseSolutionFolder),
                                                globalOptions.GetPath(id, PathType.WorkCopySolutionFolder));

                GC.Collect();
                TutorialXmlReader.WriteCurrentStep(globalOptions.GetPath(id, PathType.WorkCopyContentFile), "1");

                VsCommunication.OpenVsSolution(globalOptions.GetPath(id, PathType.WorkCopySolutionFile));
            }
            else
            {
                VsCommunication.OpenVsSolution(globalOptions.GetPath(id, PathType.WorkCopySolutionFile));
            }
        }
コード例 #2
0
 private TutorialSavegameData CreateTutorialSavegameData(TutorialId id)
 {
     return(new TutorialSavegameData
     {
         Id = id,
         State = TutorialState.None
     });
 }
コード例 #3
0
        public string GetPath(TutorialId tutorialId, PathType pType)
        {
            switch (tutorialId)
            {
            case TutorialId.None:
                break;

            case TutorialId.Tutorial1:
                switch (pType)
                {
                case PathType.BaseSolutionFolder:
                    return(_commonTutorialPath + "\\Tutorial1_EssentialShortcuts");

                case PathType.BaseContentFolder:
                    return(_commonTutorialPath + "\\Content\\Tutorial1");

                case PathType.BaseSolutionFile:
                    return(_commonTutorialPath + "\\Tutorial1_EssentialShortcuts\\Tutorial1_EssentialShortcuts.sln");

                case PathType.BaseContentFile:
                    return(_commonTutorialPath + "\\Content\\Tutorial1\\Tutorial1Content.xml");

                case PathType.WorkCopySolutionFolder:
                    return(_commonWorkCopyPath + "\\Tutorial1_EssentialShortcuts");

                case PathType.WorkCopyContentFolder:
                    return(_commonWorkCopyPath + "\\Content\\Tutorial1");

                case PathType.WorkCopySolutionFile:
                    return(_commonWorkCopyPath + "\\Tutorial1_EssentialShortcuts\\Tutorial1_EssentialShortcuts.sln");

                case PathType.WorkCopyContentFile:
                    return(_commonWorkCopyPath + "\\Content\\Tutorial1\\Tutorial1Content.xml");

                default:
                    throw new ArgumentOutOfRangeException(nameof(pType), pType, null);
                }

            case TutorialId.Tutorial2:
                break;

            case TutorialId.Tutorial3:
                break;

            case TutorialId.Tutorial4:
                break;

            case TutorialId.Tutorial5:
                break;
            }
            return(null);
        }
コード例 #4
0
    //---------------------------------------------------------------------------------------------------------------
    private PopupId GetPopID(TutorialId stage)
    {
        string PopIdString = stage.GetDesc();

        for (int i = (int)PopupId.first; i < (int)PopupId.lastPlusOne; i++)
        {
            PopupId check = (PopupId)i;
            if (check.ToString() == PopIdString)
            {
                return(check);
            }
        }

        return(PopupId.NoPopUp);
    }
コード例 #5
0
        public static string TutorialDescription(TutorialId id)
        {
            switch (id)
            {
            case TutorialId.Controls:
                return(HowToControls());

            case TutorialId.Life:
                return(TextData.GetText(TextKey.TutorialLife)
                       .ReplaceTags());

            case TutorialId.Novatars:
                return(TextData.GetText(TextKey.TutorialNovatars)
                       .ReplaceTags());

            default:
                throw new ArgumentOutOfRangeException(nameof(id), id, null);
            }
        }
コード例 #6
0
    //---------------------------------------------------------------------------------------------------------------
    /// <summary>
    ///  Returns true if tutorial popup associatered with stage was shown.
    /// </summary>
    /// <param name="stage"></param>
    /// <param name="stageType">independent stages doesn't change LastStage variable in Manager</param>
    /// <returns></returns>
    public bool ShowStage(TutorialId stage, TutorialStage stageType = TutorialStage.standard)
    {
        if (!this.IsActive)
        {
            return(false);
        }

        if (this.WasStageShown(stage))
        {
            // its okay not to show debug MSG, so these calxulations are made on manager side, not ingame code.
            // Debug.LogError("Tutorial Stage " + stage + " was requested, but this stage was shown already.");
            return(false);
        }

        if (stageType == TutorialStage.standard)
        {
            if ((int)stage < this.GetLastStage)
            {
                // its okay not to show debug MSG, so these calxulations are made on manager side, not ingame code.
                Debug.LogError(" Standard stage will index less to last stage was called. Check integrity of Tutorial.");
                return(false);
            }

            this.SetLastLoadedStage(stage);
        }

        Debug.Log("Tutorial stage " + stage + ".");
        this.MarkStageDone(stage);

        PopupId tutorialPopupID = this.GetPopID(stage);

        if (tutorialPopupID == PopupId.NoPopUp)
        {
            Debug.LogError("Can't find PopUp with id " + stage.GetDesc() + " for stage " + stage + " in PopUp ID enum.");
            return(false);
        }

        Game.UiManager.Open(tutorialPopupID);
        return(true);
    }
コード例 #7
0
    //---------------------------------------------------------------------------------------------------------------
    public void ResetFromStage(TutorialId stage)
    {
        this.stagesDone = new bool[this.GetStagesArraySize()];
        this.SaveArray();

        return;

        this.LoadArray();
        Debug.Log("ResetFromStage " + stage);
        Game.Settings.TutorialStage = (int)stage - 1;
        Debug.Log("==1111==");
        int enumSize = Enum.GetNames(typeof(TutorialId)).Length;

        Debug.Log(" enumSize " + enumSize);
        for (int i = (int)stage; i < enumSize; i++)
        {
            Debug.Log("for i " + i + " " + this.stagesDone.Length);
            this.stagesDone[(int)i] = false;
        }
        Debug.Log("==222==");
        this.SaveArray();
    }
コード例 #8
0
 //---------------------------------------------------------------------------------------------------------------
 public bool WasStageShown(TutorialId stage)
 {
     return(this.stagesDone[(int)stage]);
 }
コード例 #9
0
 //---------------------------------------------------------------------------------------------------------------
 public void MarkStageDone(TutorialId stage)
 {
     this.stagesDone[(int)stage] = true;
     this.SaveArray();
 }
コード例 #10
0
 //---------------------------------------------------------------------------------------------------------------
 private void SetLastLoadedStage(TutorialId stage)
 {
     Game.Settings.TutorialStage = (int)stage;
 }
コード例 #11
0
 public ITutorialModel this[TutorialId id] => _models[id];