//Select Player Mode from the Start Screen
        #region Start Screen

        void btn2Player_ButtonPressed(Object sender)
        {
            winPlayer2       = new Player2Window();
            Glide.MainWindow = winPlayer2.getPlayer2Win();
            isPlayer2Win     = true;
            isGameScreen     = false;
            multicolorLED.TurnRed();
        }
Example #2
0
 void btn2Player_ButtonPressed(Object sender)
 {
     winPlayer2 = new Player2Window();
     Glide.MainWindow = winPlayer2.getPlayer2Win();
     isPlayer2Win = true;
     isGameScreen = false;
     multicolorLED.TurnRed();
 }
        //Events to handle center clicks on the joystick
        void joystick_JoystickPressed(Joystick sender, Joystick.ButtonState state)
        {
            //when the user is on the game screen
            if (isGameScreen)
            {
                isGameOver = winMasterMind.submitResult();

                //user win or lose the game
                if (isGameOver && winMasterMind.getFullyCorrect() == 4)
                {
                    multicolorLED.TurnGreen();
                }
                else
                {
                    multicolorLED.TurnRed();
                }
            }
            // When the user is on the 2 Players screen
            else if (isPlayer2Win)
            {
                //get colors from user 1
                solution = winPlayer2.submitResult();

                isPlayer2Win = false;
                winPlayer2.getPlayer2Win().Dispose();

                //start game for user 1
                startGame(solution);
            }
            else
            {
                if (isPlayer1Selected)
                {
                    btn1Player_ButtonPressed(new Object());
                }
                else
                {
                    btn2Player_ButtonPressed(new Object());
                }
            }
        }