Ejemplo n.º 1
0
        //---------------------------------------------------------------------------------------------------------
        // RetryLevel
        //---------------------------------------------------------------------------------------------------------
        // If the player didn't pass the level, let them play it over
        //---------------------------------------------------------------------------------------------------------
        void RetryLevel(object stuff = null)
        {
            var level            = ChallengeLevelLayer.CreateScene(Window, lastLevelPlayed, activePlayer);
            var transitionToGame = new CCTransitionFade(2.0f, level);

            Director.ReplaceScene(transitionToGame);
        }
Ejemplo n.º 2
0
        //---------------------------------------------------------------------------------------------------------
        // NextLevel
        //---------------------------------------------------------------------------------------------------------
        // Transitions to the next level if the player passed this level
        //---------------------------------------------------------------------------------------------------------
        void NextLevel(object stuff = null)
        {
            var nextLevelToPlay  = GetNextLevelToPlay();
            var nextLevel        = ChallengeLevelLayer.CreateScene(Window, nextLevelToPlay, activePlayer);
            var transitionToGame = new CCTransitionFade(2.0f, nextLevel);

            Director.ReplaceScene(transitionToGame);
        }
Ejemplo n.º 3
0
        //---------------------------------------------------------------------------------------------------------
        // SeqMenuCallBack
        //---------------------------------------------------------------------------------------------------------
        // Callback when sequence UI icon is touched
        //---------------------------------------------------------------------------------------------------------
        void ChallengeMenuCallback(object pSender)
        {
            var nextLevelToPlay     = new Level();
            var sentMenuItem        = (CCMenuItemImage)pSender;
            var challengeTypeString = sentMenuItem.UserData.ToString();
            int branchProgressionIndex;             // index of current branch progression

            switch (challengeTypeString)
            {
            case "Linear":
            {
                branchProgressionIndex     = 1;
                currentPlayer.ActiveBranch = BranchType.Linear;
                nextLevelToPlay            = GetNextLevelToPlay(branchProgressionIndex);
                currentPlayer.BranchProgression [branchProgressionIndex].BranchState = CompletionState.started;
                break;
            }

            case "Even":
            {
                branchProgressionIndex     = 2;
                currentPlayer.ActiveBranch = BranchType.Even;
                nextLevelToPlay            = GetNextLevelToPlay(branchProgressionIndex);
                currentPlayer.BranchProgression [branchProgressionIndex].BranchState = CompletionState.started;
                break;
            }

            case "Odd":
            {
                branchProgressionIndex     = 3;
                currentPlayer.ActiveBranch = BranchType.Odd;
                nextLevelToPlay            = GetNextLevelToPlay(branchProgressionIndex);
                currentPlayer.BranchProgression [branchProgressionIndex].BranchState = CompletionState.started;
                break;
            }

            case "Triangular":
            {
                branchProgressionIndex     = 4;
                currentPlayer.ActiveBranch = BranchType.Triangular;
                nextLevelToPlay            = GetNextLevelToPlay(branchProgressionIndex);
                currentPlayer.BranchProgression [branchProgressionIndex].BranchState = CompletionState.started;
                break;
            }

            case "Square":
            {
                branchProgressionIndex     = 5;
                currentPlayer.ActiveBranch = BranchType.Square;
                nextLevelToPlay            = GetNextLevelToPlay(branchProgressionIndex);
                currentPlayer.BranchProgression [branchProgressionIndex].BranchState = CompletionState.started;
                break;
            }

            case "Lazy":
            {
                branchProgressionIndex     = 6;
                currentPlayer.ActiveBranch = BranchType.Lazy;
                nextLevelToPlay            = GetNextLevelToPlay(branchProgressionIndex);
                currentPlayer.BranchProgression [branchProgressionIndex].BranchState = CompletionState.started;
                break;
            }

            case "Fibonacci":
            {
                branchProgressionIndex     = 7;
                currentPlayer.ActiveBranch = BranchType.Fibonacci;
                nextLevelToPlay            = GetNextLevelToPlay(branchProgressionIndex);
                currentPlayer.BranchProgression [branchProgressionIndex].BranchState = CompletionState.started;
                break;
            }

            case "Prime":
            {
                branchProgressionIndex     = 8;
                currentPlayer.ActiveBranch = BranchType.Prime;
                nextLevelToPlay            = GetNextLevelToPlay(branchProgressionIndex);
                currentPlayer.BranchProgression [branchProgressionIndex].BranchState = CompletionState.started;
                break;
            }

            case "Double":
            {
                branchProgressionIndex     = 9;
                currentPlayer.ActiveBranch = BranchType.Double;
                nextLevelToPlay            = GetNextLevelToPlay(branchProgressionIndex);
                currentPlayer.BranchProgression [branchProgressionIndex].BranchState = CompletionState.started;
                break;
            }

            case "Triple":
            {
                branchProgressionIndex     = 10;
                currentPlayer.ActiveBranch = BranchType.Triple;
                nextLevelToPlay            = GetNextLevelToPlay(branchProgressionIndex);
                currentPlayer.BranchProgression [branchProgressionIndex].BranchState = CompletionState.started;
                break;
            }

            case "Pi":
            {
                branchProgressionIndex     = 11;
                currentPlayer.ActiveBranch = BranchType.Pi;
                nextLevelToPlay            = GetNextLevelToPlay(branchProgressionIndex);
                currentPlayer.BranchProgression [branchProgressionIndex].BranchState = CompletionState.started;
                break;
            }

            case "Recaman":
            {
                branchProgressionIndex     = 12;
                currentPlayer.ActiveBranch = BranchType.Recaman;
                nextLevelToPlay            = GetNextLevelToPlay(branchProgressionIndex);
                currentPlayer.BranchProgression [branchProgressionIndex].BranchState = CompletionState.started;
                break;
            }
            }

            // TODO: because we set the branch progression after a challenge is selected, we should write to the player file

            var layer             = ChallengeLevelLayer.CreateScene(Window, nextLevelToPlay, currentPlayer);
            var transitionToLayer = new CCTransitionSlideInR(0.2f, layer);

            Director.ReplaceScene(transitionToLayer);
        }