Exemple #1
0
    // <summary>
    // Handles the user SwinGame.
    // </summary>
    // <remarks>
    // Reads key and mouse input and converts these into
    // actions for the game to perform. The actions
    // performed depend upon the state of the game.
    // </remarks>
    public static void HandleUserInput()
    {
        // Read incoming input events
        SwinGame.ProcessEvents();

        switch (CurrentState)
        {
        case var @case when @case == GameState.ViewingMainMenu:
        {
            MenuController.HandleMainMenuInput();
            break;
        }

        case var case1 when case1 == GameState.ViewingGameMenu:
        {
            MenuController.HandleGameMenuInput();
            break;
        }

        case var case2 when case2 == GameState.AlteringSettings:
        {
            MenuController.HandleSetupMenuInput();
            break;
        }

        case var case3 when case3 == GameState.Deploying:
        {
            DeploymentController.HandleDeploymentInput();
            break;
        }

        case var case4 when case4 == GameState.Discovering:
        {
            DiscoveryController.HandleDiscoveryInput();
            break;
        }

        case var case5 when case5 == GameState.EndingGame:
        {
            EndingGameController.HandleEndOfGameInput();
            break;
        }

        case var case6 when case6 == GameState.ViewingHighScores:
        {
            HighScoreController.HandleHighScoreInput();
            break;
        }
        }

        UtilityFunctions.UpdateAnimations();
        if (SwinGame.KeyTyped(KeyCode.MKey))
        {
            SwinGame.PauseMusic();
        }
        if (SwinGame.KeyTyped(KeyCode.UKey))
        {
            SwinGame.ResumeMusic();
        }
    }
Exemple #2
0
    /// <summary>
    /// Handles the user SwinGame.
    /// </summary>
    /// <remarks>
    /// Reads key and mouse input and converts these into
    /// actions for the game to perform. The actions
    /// performed depend upon the state of the game.
    /// </remarks>
    public static void HandleUserInput()
    {
        //Read incoming input events
        SwinGame.ProcessEvents();

        if (SwinGame.KeyTyped(KeyCode.PageUpKey))
        {
            float max       = 1.0F;
            float increment = 0.1F;

            if (Audio.MusicVolume() != max)
            {
                Audio.SetMusicVolume(Audio.MusicVolume() + increment);
            }
        }

        if (SwinGame.KeyTyped(KeyCode.PageDownKey))
        {
            float min       = 0.0F;
            float decrement = 0.1F;

            if (Audio.MusicVolume() != min)
            {
                Audio.SetMusicVolume(Audio.MusicVolume() - decrement);
            }
        }

        switch (CurrentState)
        {
        case GameState.ViewingMainMenu:
            MenuController.HandleMainMenuInput();
            break;

        case GameState.ViewingGameMenu:
            MenuController.HandleGameMenuInput();
            break;

        case GameState.AlteringSettings:
            MenuController.HandleSetupMenuInput();
            break;

        case GameState.Deploying:
            DeploymentController.HandleDeploymentInput();
            break;

        case GameState.Discovering:
            DiscoveryController.HandleDiscoveryInput();
            break;

        case GameState.EndingGame:
            EndingGameController.HandleEndOfGameInput();
            break;

        case GameState.ViewingHighScores:
            HighScoreController.HandleHighScoreInput();
            break;
        }

        UtilityFunctions.UpdateAnimations();
    }
Exemple #3
0
    /// <summary>
    /// Handles the user SwinGame.
    /// </summary>
    /// <remarks>
    /// Reads key and mouse input and converts these into
    /// actions for the game to perform. The actions
    /// performed depend upon the state of the game.
    /// </remarks>
    public static void HandleUserInput()
    {
        //Read incoming input events
        SwinGame.ProcessEvents();

        //Mute background music
        if (SwinGame.KeyTyped(KeyCode.vk_m))
        {
            if (SwinGame.MusicPlaying())
            {
                SwinGame.StopMusic();
                _mute = true;
            }
            else
            {
                SwinGame.PlayMusic(GameResources.GameMusic("Background"));
                _mute = false;
            }
        }

        switch (CurrentState)
        {
        case GameState.ViewingMainMenu:
            MenuController.HandleMainMenuInput();
            break;

        case GameState.ViewingGameMenu:
            MenuController.HandleGameMenuInput();
            break;

        case GameState.AlteringSettings:
            MenuController.HandleSetupMenuInput();
            break;

        case GameState.Deploying:
            DeploymentController.HandleDeploymentInput();
            MenuController.HandleCommonMenuInput();                      //Aerisha Changes/Additions
            break;

        case GameState.Discovering:
            DiscoveryController.HandleDiscoveryInput();
            MenuController.HandleCommonMenuInput();                      //Aerisha Changes/Additions
            break;

        case GameState.EndingGame:
            EndingGameController.HandleEndOfGameInput();
            break;

        case GameState.ViewingHighScores:
            HighScoreController.HandleHighScoreInput();
            MenuController.HandleScoresPageInput();                             //Aerisha Changes/Additions
            break;

        case GameState.ViewingInstructMenu:
            Instructions.HandleInstructInput();
            break;
        }

        UtilityFunctions.UpdateAnimations();
    }
    /// <summary>
    ///     ''' Handles the user SwinGame.
    ///     ''' </summary>
    ///     ''' <remarks>
    ///     ''' Reads key and mouse input and converts these into
    ///     ''' actions for the game to perform. The actions
    ///     ''' performed depend upon the state of the game.
    ///     ''' </remarks>
    public static void HandleUserInput()
    {
        // Read incoming input events
        SwinGame.ProcessEvents();

        switch (CurrentState)
        {
        case GameState.ViewingMainMenu: {
            MenuController.HandleMainMenuInput();
            break;
        }

        case GameState.ViewingGameMenu: {
            MenuController.HandleGameMenuInput();
            break;
        }

        case GameState.AlteringSettings: {
            MenuController.HandleSetupMenuInput();
            break;
        }

        case GameState.Deploying: {
            DeploymentController.HandleDeploymentInput();
            break;
        }

        case GameState.Discovering: {
            DiscoveryController.HandleDiscoveryInput();
            break;
        }

        case GameState.EndingGame: {
            EndingGameController.HandleEndOfGameInput();
            break;
        }

        case GameState.ViewingHighScores: {
            HighScoreController.HandleHighScoreInput();
            break;
        }

        case GameState.ViewingInstruction: {
            InstructionController.HandleInstructInput();
            break;
        }

        case GameState.Reveal: {
            RevealController.HandleRevealInput();
            break;
        }

        case GameState.ViewingInstructionImg: {
            InstructionImgController.HandleImgInstructInput();
            break;
        }
            UtilityFunctions.UpdateAnimations();
        }
    }
Exemple #5
0
    /// <summary>
    /// Handles the user SwinGame.
    /// </summary>
    /// <remarks>
    /// Reads key and mouse input and converts these into
    /// actions for the game to perform. The actions
    /// performed depend upon the state of the game.
    /// </remarks>
    public static void HandleUserInput()
    {
        //Read incoming input events
        SwinGame.ProcessEvents();

        switch (CurrentState)
        {
        case GameState.ViewingMainMenu:
            MenuController.HandleMainMenuInput();
            break;

        case GameState.ViewingGameMenu:
            MenuController.HandleGameMenuInput();
            break;

        case GameState.AlteringSettings:
            MenuController.HandleSetupMenuInput();
            break;

        // Added Function: Change Music Function
        // Author: Ernest Soo
        case GameState.AlteringMusic:
            MenuController.HandleMusicMenuInput();
            break;

        // Added Function: Change Background Function
        // Author: Jacky
        case GameState.AlteringBackground:
            MenuController.HandleBackgroundMenuInput();
            break;

        // Added Function: Help Function
        // Author: Ernest Soo
        case GameState.ViewingHelp:
            MenuController.HandleHelpMenuInput();
            break;

        case GameState.Deploying:
            DeploymentController.HandleDeploymentInput();
            break;

        case GameState.Discovering:
            DiscoveryController.HandleDiscoveryInput();
            break;

        case GameState.EndingGame:
            EndingGameController.HandleEndOfGameInput();
            break;

        case GameState.ViewingHighScores:
            HighScoreController.HandleHighScoreInput();
            break;
        }

        UtilityFunctions.UpdateAnimations();
    }
    /// <summary>
    /// Handles the user SwinGame.
    /// </summary>
    /// <remarks>
    /// Reads key and mouse input and converts these into
    /// actions for the game to perform. The actions
    /// performed depend upon the state of the game.
    /// </remarks>
    public static void HandleUserInput()
    {
        //Read incoming input events
        SwinGame.ProcessEvents();

        switch (CurrentState)
        {
        case GameState.ViewingMainMenu:
            MenuController.HandleMainMenuInput();
            break;

        case GameState.ViewingInstruction:
            Rules.HandleInstruction();
            break;

        case GameState.ViewingGameMenu:
            MenuController.HandleGameMenuInput();
            break;

        case GameState.AlteringSettings:
            MenuController.HandleSetupMenuInput();
            break;

        case GameState.Deploying:
            DeploymentController.HandleDeploymentInput();
            break;

        case GameState.Discovering:
            DiscoveryController.HandleDiscoveryInput();
            break;

        case GameState.EndingGame:
            EndingGameController.HandleEndOfGameInput();

            break;

        case GameState.ViewingHighScores:
            HighScoreController.HandleHighScoreInput();
            break;

        case GameState.AlteringOption:
            MenuController.HandleOptionMenuInput();
            break;

        case GameState.ChangingMusic:
            MenuController.HandleMusicMenuInput();
            break;

            /*case GameState.changebg:
             *      MenuController.HandleBGMenuInput ();
             *      break;*/
        }

        UtilityFunctions.UpdateAnimations();
    }
    /// <summary>
    /// Handles the user SwinGame.
    /// </summary>
    /// <remarks>
    /// Reads key and mouse input and converts these into
    /// actions for the game to perform. The actions
    /// performed depend upon the state of the game.
    /// </remarks>
    public static void HandleUserInput()
    {
        //Read incoming input events
        SwinGame.ProcessEvents();


        if (SwinGame.KeyTyped(KeyCode.vk_F1))
        {
            SwinGame.ToggleFullScreen();
        }

        if (SwinGame.KeyTyped(KeyCode.vk_F2))
        {
            SwinGame.TakeScreenshot("screenshot");
        }

        switch (CurrentState)
        {
        case GameState.ViewingMainMenu:
            MenuController.HandleMainMenuInput();
            break;

        case GameState.ViewingGameMenu:
            MenuController.HandleGameMenuInput();
            break;

        case GameState.AlteringSettings:
            MenuController.HandleSetupMenuInput();
            break;

        case GameState.BGMSettings:
            MenuController.HandleBGMMenuInput();
            break;

        case GameState.Deploying:
            DeploymentController.HandleDeploymentInput();
            break;

        case GameState.Discovering:
            DiscoveryController.HandleDiscoveryInput();
            break;

        case GameState.EndingGame:
            EndingGameController.HandleEndOfGameInput();
            break;

        case GameState.ViewingHighScores:
            HighScoreController.HandleHighScoreInput();
            break;
        }

        UtilityFunctions.UpdateAnimations();
    }
Exemple #8
0
    /// <summary>
    /// Handles the user SwinGame.
    /// </summary>
    /// <remarks>
    /// Reads key and mouse input and converts these into
    /// actions for the game to perform. The actions
    /// performed depend upon the state of the game.
    /// </remarks>
    public static void HandleUserInput()
    {
        //Read incoming input events
        SwinGame.ProcessEvents();

        switch (CurrentState)
        {
        case GameState.ViewingMainMenu:
            MenuController.HandleMainMenuInput();
            break;

        case GameState.ViewingGameMenu:
            MenuController.HandleGameMenuInput();
            break;

        case GameState.AlteringSettings:
            MenuController.HandleSetupMenuInput();
            break;

        case GameState.ChangingMusic:
            MenuController.HandleMusicMenuInput();
            break;

        case GameState.Deploying:
            DeploymentController.HandleDeploymentInput();
            break;

        case GameState.Discovering:
            DiscoveryController.HandleDiscoveryInput();
            break;

        case GameState.EndingGame:
            EndingGameController.HandleEndOfGameInput();
            break;

        case GameState.ViewingHighScores:
            HighScoreController.HandleHighScoreInput();
            break;

        case GameState.ShowingHint:
            // ShowingHint state must use same input handler as Discovery state
            // since it works on top of the same state
            DiscoveryController.HandleDiscoveryInput();
            break;
        }

        UtilityFunctions.UpdateAnimations();
    }
Exemple #9
0
    /// <summary>
    /// Handles the user SwinGame.
    /// </summary>
    /// <remarks>
    /// Reads key and mouse input and converts these into
    /// actions for the game to perform. The actions
    /// performed depend upon the state of the game.
    /// </remarks>
    public static void HandleUserInput()
    {
        //Read incoming input events
        SwinGame.ProcessEvents();

        switch (CurrentState)
        {
        case GameState.ViewingMainMenu:
            MenuController.HandleMainMenuInput();
            break;

        case GameState.ViewingGameMenu:
            MenuController.HandleGameMenuInput();
            break;

        case GameState.AlteringSettings:
            MenuController.HandleSetupMenuInput();
            break;

        /*Added MusicSettings*/
        case GameState.MusicSettings:
            MenuController.HandleMusicMenuInput();
            break;

        /*Add themesetting*/
        case GameState.ThemeColors:
            MenuController.HandleThemeMenuInput();
            break;

        case GameState.Deploying:
            DeploymentController.HandleDeploymentInput();
            break;

        case GameState.Discovering:
            DiscoveryController.HandleDiscoveryInput();
            break;

        case GameState.EndingGame:
            EndingGameController.HandleEndOfGameInput();
            break;

        case GameState.ViewingHighScores:
            HighScoreController.HandleHighScoreInput();
            break;
        }

        UtilityFunctions.UpdateAnimations();
    }
    /// <summary>
    /// Handles the user SwinGame.
    /// </summary>
    /// <remarks>
    /// Reads key and mouse input and converts these into
    /// actions for the game to perform. The actions
    /// performed depend upon the state of the game.
    /// </remarks>
    public static void HandleUserInput()
    {
        //Read incoming input events
        SwinGame.ProcessEvents();

        if (_muteCheck)
        {
            SwinGame.PauseMusic();
        }
        else
        {
            SwinGame.ResumeMusic();
        }

        if (CurrentState == GameState.ViewingMainMenu)
        {
            MenuController.HandleMainMenuInput();
        }
        else if (CurrentState == GameState.ViewingGameMenu)
        {
            MenuController.HandleGameMenuInput();
        }
        else if (CurrentState == GameState.AlteringSettings)
        {
            MenuController.HandleSetupMenuInput();
        }
        else if (CurrentState == GameState.Deploying)
        {
            DeploymentController.HandleDeploymentInput();
        }
        else if (CurrentState == GameState.Discovering)
        {
            DiscoveryController.HandleDiscoveryInput();
        }
        else if (CurrentState == GameState.EndingGame)
        {
            EndingGameController.HandleEndOfGameInput();
        }
        else if (CurrentState == GameState.ViewingHighScores)
        {
            HighScoreController.HandleHighScoreInput();
        }

        UtilityFunctions.UpdateAnimations();
    }
Exemple #11
0
    /// <summary>
    ///     ''' Handles the user SwinGame.
    ///     ''' </summary>
    ///     ''' <remarks>
    ///     ''' Reads key and mouse input and converts these into
    ///     ''' actions for the game to perform. The actions
    ///     ''' performed depend upon the state of the game.
    ///     ''' </remarks>
    public static void HandleUserInput()
    {
        // Read incoming input events
        SwinGame.ProcessEvents();

        if (CurrentState == GameState.ViewingMainMenu)
        {
            MenuController.HandleMainMenuInput();
        }
        else if (CurrentState == GameState.ViewingGameMenu)
        {
            MenuController.HandleGameMenuInput();
        }
        else if (CurrentState == GameState.AlteringSettings)
        {
            MenuController.HandleSetupMenuInput();
        }
        else if (CurrentState == GameState.ChangingMusic)         //Recently Added
        {
            MenuController.HandleMusicMenuInput();
        }
        else if (CurrentState == GameState.Deploying)
        {
            DeploymentController.HandleDeploymentInput();
        }
        else if (CurrentState == GameState.Discovering)
        {
            DiscoveryController.HandleDiscoveryInput();
        }
        else if (CurrentState == GameState.AlteringOption)         //RECENTLY ADDED
        {
            MenuController.HandleOptionMenuInput();
        }
        else if (CurrentState == GameState.EndingGame)
        {
            EndingGameController.HandleEndOfGameInput();
        }
        else if (CurrentState == GameState.ViewingHighScores)
        {
            HighScoreController.HandleHighScoreInput();
        }

        UtilityFunctions.UpdateAnimations();
    }
    /// <summary>
    /// Handles the user SwinGame.
    /// </summary>
    /// <remarks>
    /// Reads key and mouse input and converts these into
    /// actions for the game to perform. The actions
    /// performed depend upon the state of the game.
    /// </remarks>
    public static void HandleUserInput()
    {
        //Read incoming input events
        SwinGame.ProcessEvents();

        switch (CurrentState)
        {
        case GameState.ViewingMainMenu:
            MenuController.HandleMainMenuInput();
            break;

        case GameState.ViewingGameMenu:
            MenuController.HandleGameMenuInput();
            break;

        case GameState.AlteringSettings:
            MenuController.HandleSetupMenuInput();
            break;

        case GameState.Deploying:
            DeploymentController.HandleDeploymentInput();
            break;

        case GameState.Discovering:
            DiscoveryController.HandleDiscoveryInput();
            break;

        case GameState.EndingGame:
            EndingGameController.HandleEndOfGameInput();
            break;

        case GameState.ViewingHighScores:
            HighScoreController.HandleHighScoreInput();
            break;
        }
        if (SwinGame.MouseClicked(MouseButton.LeftButton))
        {
            if (UtilityFunctions.IsMouseInRectangle(HOME_BUTTON_LEFT, TOP_BUTTONS_TOP, HOME_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT))
            {
                GameController.AddNewState(GameState.ViewingGameMenu);
            }
        }
        UtilityFunctions.UpdateAnimations();
    }
    /// <summary>
    /// Handles the user SwinGame.
    /// </summary>
    /// <remarks>
    /// Reads key and mouse input and converts these into
    /// actions for the game to perform. The actions
    /// performed depend upon the state of the game.
    /// </remarks>
    public static void HandleUserInput()
    {
        //Read incoming input events
        SwinGame.ProcessEvents();

        switch (CurrentState)
        {
        case GameState.ViewingMainMenu:
            MenuController.HandleMainMenuInput();
            break;

        case GameState.ViewingGameMenu:
            MenuController.HandleGameMenuInput();
            break;

        case GameState.AlteringSettings:
            MenuController.HandleSetupMenuInput();
            break;

        case GameState.Deploying:
            DeploymentController.HandleDeploymentInput();
            break;

        case GameState.Discovering:
            DiscoveryController.HandleDiscoveryInput();
            break;

        case GameState.EndingGame:
            EndingGameController.HandleEndOfGameInput();
            break;

        case GameState.ViewingHighScores:
            HighScoreController.HandleHighScoreInput();
            break;

        case GameState.changebg:
            MenuController.HandleBGMenuInput();
            break;

                << << << < HEAD
                case GameState.ViewHowToPlay:
                MenuController.HandleHowToPlayMenuInput();
            break;
    // <summary>
    // Handles the user SwinGame.
    // </summary>
    // <remarks>
    // Reads key and mouse input and converts these into
    // actions for the game to perform. The actions
    // performed depend upon the state of the game.
    // </remarks>
    public static void HandleUserInput()
    {
        // Read incoming input events
        SwinGame.ProcessEvents();
        switch (CurrentState)   // read state
        {
        case GameState.ViewingMainMenu:
            MenuController.HandleMainMenuInput();
            break;

        case GameState.ViewingGameMenu:
            MenuController.HandleGameMenuInput();
            break;

        case GameState.AlteringSettings:
            MenuController.HandleSetupMenuInput();
            break;

        case GameState.Deploying:
            DeploymentController.HandleDeploymentInput();
            break;

        case GameState.Discovering:
            DiscoveryController.HandleDiscoveryInput();
            break;

        case GameState.EndingGame:
            EndingGameController.HandleEndOfGameInput();
            break;

        case GameState.ViewingHighScores:
            HighScoreController.HandleHighScoreInput();
            break;

        case GameState.ViewingHowTo:
            HowToController.HandleHowToInput();
            break;
        }
        UtilityFunctions.UpdateAnimations(); // animate the state
    }
Exemple #15
0
    /// <summary>
    /// Handles the user SwinGame.
    /// </summary>
    /// <remarks>
    /// Reads key and mouse input and converts these into
    /// actions for the game to perform. The actions
    /// performed depend upon the state of the game.
    /// </remarks>
    public void HandleUserInput()
    {
        //Read incoming input events
        SwinGame.ProcessEvents();

        switch (CurrentState)
        {
        case GameState.ViewingMainMenu:
            _menuController.HandleMainMenuInput();
            break;

        case GameState.ViewingGameMenu:
            _menuController.HandleGameMenuInput();
            break;

        case GameState.AlteringSettings:
            _menuController.HandleSetupMenuInput();
            break;

        case GameState.Deploying:
            _deploymentController.HandleDeploymentInput();
            break;

        case GameState.Discovering:
            _discoveryController.HandleDiscoveryInput();
            break;

        case GameState.EndingGame:
            _endingGameController.HandleEndOfGameInput();
            break;

        case GameState.ViewingHighScores:
            highScoreController.HandleHighScoreInput();
            break;
        }

        screenController.UpdateAnimations();
    }