Ejemplo n.º 1
0
        private bool CheckIfChapterIsQualified(TutorialChapterData tutorialChapterData)
        {
            if (tutorialChapterData == null)
            {
                TutorialView.Close();
                return(false);
            }
            if (!_initialized)
            {
                TutorialView.Close();
                return(false);
            }
            if (!TutorialProxy.instance.IsFirstStep())
            {
                return(false);
            }
            if (tutorialChapterData == null)
            {
                TutorialView.Close();
                return(false);
            }
            if (Game.Model.GameProxy.instance.PlayerInfo == null)
            {
                TutorialView.Close();
                return(false);
            }
            // check player level
            if (Game.Model.GameProxy.instance.PlayerInfo.level < tutorialChapterData.playerLevel)
            {
                TutorialView.Close();
                return(false);
            }
            // check pass dungeon
            if (tutorialChapterData.passDungeon > 0)
            {
                Dungeon.Model.DungeonInfo requiredPassDungeonInfo = Dungeon.Model.DungeonProxy.instance.GetDungeonInfo(tutorialChapterData.passDungeon);
                if (requiredPassDungeonInfo == null || requiredPassDungeonInfo.star <= 0)
                {
                    TutorialView.Close();
                    return(false);
                }
            }

            // check if task complete
            if (tutorialChapterData.taskID > 0 &&
                !Logic.UI.Task.Model.TaskProxy.instance.IsTaskComplete(tutorialChapterData.taskID))
            {
                TutorialView.Close();
                return(false);
            }
            // check dungeon total star count
            if (tutorialChapterData.dungeonTotalStarCount > 0 &&
                Logic.Dungeon.Model.DungeonProxy.instance.GetDungeonTotalStarCount() < tutorialChapterData.dungeonTotalStarCount)
            {
                TutorialView.Close();
                return(false);
            }
            // check active ui panel path
            if (tutorialChapterData.atUIViewPath != null &&
                UI.UIMgr.instance.LastOpenedUIPath != tutorialChapterData.atUIViewPath)
            {
                TutorialView.Close();
                return(false);
            }
            if (!FunctionOpen.Model.FunctionOpenProxy.instance.IsFunctionOpen((Enums.FunctionOpenType)tutorialChapterData.functionOpenID))
            {
                TutorialView.Close();
                return(false);
            }
            return(true);
        }
Ejemplo n.º 2
0
        private bool CheckIfShouldOpenCurrentChapter()
        {
            Debugger.Log("===== CheckIfShouldOpenCurrentChapter =====");

            int currentTutorialChapterID = TutorialProxy.instance.CurrentTutorialChapterData.id;
            TutorialChapterData currentTutorialChapterData = TutorialChapterData.GetTutorialChapterData(currentTutorialChapterID);

            TutorialProxy.instance.MoveToChapter(currentTutorialChapterData);

            // check if should ignore chapter
            TutorialChapterData tutorialChapterData            = currentTutorialChapterData;
            TutorialChapterData latestCanNotIgnoredChapterData = null;

            while (tutorialChapterData != null && tutorialChapterData.canIgnore)
            {
                tutorialChapterData = tutorialChapterData.GetNextTutorialChapterData();
                if (tutorialChapterData != null && !tutorialChapterData.canIgnore)
                {
                    latestCanNotIgnoredChapterData = tutorialChapterData;
                }
            }

            if (latestCanNotIgnoredChapterData != null && CheckIfChapterIsQualified(latestCanNotIgnoredChapterData))
            {
                TutorialProxy.instance.MoveToChapter(latestCanNotIgnoredChapterData);
                currentTutorialChapterData = TutorialProxy.instance.CurrentTutorialChapterData;
            }
            // check if should ignore chapter

            if (currentTutorialChapterData == null)
            {
                if (UIMgr.instance.IsOpening(TutorialView.PREFAB_PATH))
                {
                    TutorialView.Close();
                }
                return(false);
            }
            if (!_initialized)
            {
                if (UIMgr.instance.IsOpening(TutorialView.PREFAB_PATH))
                {
                    TutorialView.Close();
                }
                return(false);
            }
            if (!TutorialProxy.instance.IsFirstStep())
            {
                return(false);
            }
            if (currentTutorialChapterData == null)
            {
                if (UIMgr.instance.IsOpening(TutorialView.PREFAB_PATH))
                {
                    TutorialView.Close();
                }
                return(false);
            }
            if (Game.Model.GameProxy.instance.PlayerInfo == null)
            {
                if (UIMgr.instance.IsOpening(TutorialView.PREFAB_PATH))
                {
                    TutorialView.Close();
                }
                return(false);
            }
            // check player level
            if (Game.Model.GameProxy.instance.PlayerInfo.level < currentTutorialChapterData.playerLevel)
            {
                if (UIMgr.instance.IsOpening(TutorialView.PREFAB_PATH))
                {
                    TutorialView.Close();
                }
                return(false);
            }
            // check pass dungeon
            if (currentTutorialChapterData.passDungeon > 0)
            {
                Dungeon.Model.DungeonInfo requiredPassDungeonInfo = Dungeon.Model.DungeonProxy.instance.GetDungeonInfo(currentTutorialChapterData.passDungeon);
                if (requiredPassDungeonInfo == null || requiredPassDungeonInfo.star <= 0)
                {
                    if (UIMgr.instance.IsOpening(TutorialView.PREFAB_PATH))
                    {
                        TutorialView.Close();
                    }
                    return(false);
                }
            }
            // check if task complete
            if (currentTutorialChapterData.taskID > 0 &&
                !Logic.UI.Task.Model.TaskProxy.instance.IsTaskComplete(currentTutorialChapterData.taskID))
            {
                if (UIMgr.instance.IsOpening(TutorialView.PREFAB_PATH))
                {
                    TutorialView.Close();
                }
                return(false);
            }
            // check dungeon total star count
            if (currentTutorialChapterData.dungeonTotalStarCount > 0 &&
                Logic.Dungeon.Model.DungeonProxy.instance.GetDungeonTotalStarCount() < currentTutorialChapterData.dungeonTotalStarCount)
            {
                if (UIMgr.instance.IsOpening(TutorialView.PREFAB_PATH))
                {
                    TutorialView.Close();
                }
                return(false);
            }
            // check active ui panel path
            if (currentTutorialChapterData.atUIViewPath != null &&
                UI.UIMgr.instance.LastOpenedUIPath != currentTutorialChapterData.atUIViewPath)
            {
                if (UIMgr.instance.IsOpening(TutorialView.PREFAB_PATH))
                {
                    TutorialView.Close();
                }
                return(false);
            }
            if (!FunctionOpen.Model.FunctionOpenProxy.instance.IsFunctionOpen((Enums.FunctionOpenType)currentTutorialChapterData.functionOpenID))
            {
                if (UIMgr.instance.IsOpening(TutorialView.PREFAB_PATH))
                {
                    TutorialView.Close();
                }
                return(false);
            }
//			if (!UIMgr.instance.IsOpening(TutorialView.PREFAB_PATH))
            TutorialView.Open(TutorialProxy.instance.CurrentTutorialChapterData, TutorialProxy.instance.CurrentTutorialStepData);
            Debugger.Log("=====[Turotial]::[OpenChapter]::[" + (TutorialProxy.instance.CurrentTutorialChapterData.isBackup ? "Backup:" : "Main:") + TutorialProxy.instance.CurrentTutorialChapterData.id + "]");
            TutorialProxy.instance.IsCurrentTurorialChapterOpened = true;
            Debugger.Log("===== CheckIfShouldOpenCurrentChapter =====");
            return(true);
        }