示例#1
0
    /// <summary>
    /// Draws the current state of the game to the screen.
    /// </summary>
    /// <remarks>
    /// What is drawn depends upon the state of the game.
    /// </remarks>
    public static void DrawScreen(ThemeColor color)
    {
        if (MenuController.TColor == ThemeColor.Pink)
        {
            UtilityFunctions.DrawBackground(ThemeColor.Pink);
        }
        else if (MenuController.TColor == ThemeColor.Green)
        {
            UtilityFunctions.DrawBackground(ThemeColor.Green);
        }
        else
        {
            UtilityFunctions.DrawBackground(ThemeColor.Blue);
        }

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

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

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

        /*Add Theme draw*/
        case GameState.ThemeColors:
            MenuController.ThemeSettings();
            break;

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

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

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

        //case GameState.EndingGame:
        //	EndingGameController.DrawEndOfGame ();
        //	break;
        case GameState.ViewingHighScores:
            HighScoreController.DrawHighScores();
            break;
        }

        UtilityFunctions.DrawAnimations();

        SwinGame.RefreshScreen();
    }
    /// <summary>
    /// Draws the current state of the game to the screen.
    /// </summary>
    /// <remarks>
    /// What is drawn depends upon the state of the game.
    /// </remarks>
    public static void DrawScreen()
    {
        UtilityFunctions.DrawBackground();

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

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

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

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

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

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

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

        UtilityFunctions.DrawAnimations();

        SwinGame.RefreshScreen();
    }
示例#3
0
    /// <summary>
    /// Draws the current state of the game to the screen.
    /// </summary>
    /// <remarks>
    /// What is drawn depends upon the state of the game.
    /// </remarks>
    public static void DrawScreen()
    {
        UtilityFunctions.DrawBackground();

        switch (CurrentState)
        {
        case GameState.ViewingMainMenu:
            MenuController.DrawMainMenu();
            SwinGame.StopTimer(Timer);
            break;

        case GameState.ViewingGameMenu:
            MenuController.DrawGameMenu();
            SwinGame.StopTimer(Timer);
            break;

        case GameState.AlteringSettings:
            MenuController.DrawSettings();
            SwinGame.StopTimer(Timer);
            break;

        case GameState.Deploying:
            DeploymentController.DrawDeployment();
            SwinGame.ResetTimer(Timer);
            break;

        case GameState.Discovering:
            DiscoveryController.DrawDiscovery();
            if (SwinGame.TimerTicks(Timer) == 0)
            {
                SwinGame.StartTimer(Timer);
            }
            break;

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

        case GameState.ViewingHighScores:
            HighScoreController.DrawHighScores();
            SwinGame.StopTimer(Timer);
            break;

        case GameState.ViewInstruction:
            Instruction.WriteInstruction();
            break;
        }

        UtilityFunctions.DrawAnimations();

        SwinGame.RefreshScreen();
    }
示例#4
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.Deploying:
        {
            DeploymentController.HandleDeploymentInput();
            break;
        }

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

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

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

        UtilityFunctions.UpdateAnimations();
    }
    /// <summary>
    /// Draws the current state of the game to the screen.
    /// </summary>
    /// <remarks>
    /// What is drawn depends upon the state of the game.
    /// </remarks>
    public static void DrawScreen()
    {
        UtilityFunctions.DrawBackground();

        if (CurrentState == GameState.ViewingMainMenu)
        {
            SwinGame.StopTimer(GameTimer);
            MenuController.DrawMainMenu();
        }
        else if (CurrentState == GameState.ViewingGameMenu)
        {
            SwinGame.StopTimer(GameTimer);
            MenuController.DrawGameMenu();
        }
        else if (CurrentState == GameState.AlteringSettings)
        {
            SwinGame.StopTimer(GameTimer);
            MenuController.DrawSettings();
        }
        else if (CurrentState == GameState.AlterMusics)
        {
            SwinGame.StopTimer(GameTimer);
            MenuController.DrawMusicSettings();
        }
        else if (CurrentState == GameState.Deploying)
        {
            SwinGame.ResetTimer(GameTimer);
            DeploymentController.DrawDeployment();
        }
        else if (CurrentState == GameState.Discovering)
        {
            if (SwinGame.TimerTicks(GameTimer) == 0)
            {
                SwinGame.StartTimer(GameTimer);
            }
            DiscoveryController.DrawDiscovery();
        }
        else if (CurrentState == GameState.EndingGame)
        {
            EndingGameController.DrawEndOfGame();
        }
        else if (CurrentState == GameState.ViewingHighScores)
        {
            HighScoreController.DrawHighScores();
        }

        UtilityFunctions.DrawAnimations();

        SwinGame.RefreshScreen(120);
    }
示例#6
0
    /// <summary>
    /// Draws the current state of the game to the screen.
    /// </summary>
    /// <remarks>
    /// What is drawn depends upon the state of the game.
    /// </remarks>
    public static void DrawScreen()
    {
        UtilityFunctions.DrawBackground();

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

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

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

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

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

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

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

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

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

        UtilityFunctions.DrawAnimations();

        SwinGame.RefreshScreen();
    }
示例#7
0
    /// <summary>
    /// Draws the current state of the game to the screen.
    /// </summary>
    /// <remarks>
    /// What is drawn depends upon the state of the game.
    /// </remarks>
    public static void DrawScreen()
    {
        UtilityFunctions.DrawBackground();

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

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

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

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

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

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

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

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

        case GameState.ShowingHint:
            // ShowingHint state draws the Hints on top of the regular grid
            DiscoveryController.DrawDiscovery();
            DiscoveryController.DrawHint();
            break;
        }

        UtilityFunctions.DrawAnimations();

        SwinGame.RefreshScreen();
    }
示例#8
0
    /// <summary>
    /// Draws the current state of the game to the screen.
    /// </summary>
    /// <remarks>
    /// What is drawn depends upon the state of the game.
    /// </remarks>
    public static void DrawScreen()
    {
        if (SwinGame.KeyTyped(KeyCode.vk_m))
        {
            GameResources.Mute();
        }
        if (SwinGame.KeyTyped(KeyCode.vk_p))
        {
            GameResources.Play();
        }
        UtilityFunctions.DrawBackground();

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

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

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

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

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

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

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

        UtilityFunctions.DrawAnimations();

        SwinGame.RefreshScreen();
    }
    // '' <summary>
    // '' Read the user's name for their highsSwinGame.
    // '' </summary>
    // '' <param name="value">the player's sSwinGame.</param>
    // '' <remarks>
    // '' This verifies if the score is a highsSwinGame.
    // '' </remarks>
    public static void ReadHighScore(int value)
    {
        const int ENTRY_TOP = 500;

        if (_scores.Count == 0)
        {
            LoadScores();
        }

        // Is it a high score:
        if ((value > _scores[(_scores.Count - 1)].Value))
        {
            Score s = new Score();
            s.Value = value;

            GameController.AddNewState(GameState.ViewingHighScores);

            int x = (SCORES_LEFT + SwinGame.TextWidth(GameResources.GameFont("Courier"), "Name: "));
            SwinGame.StartReadingText(Color.White, NAME_WIDTH, GameResources.GameFont("Courier"), x, ENTRY_TOP);

            // Read the text from the user
            while (SwinGame.ReadingText())
            {
                SwinGame.ProcessEvents();
                UtilityFunctions.DrawBackground();
                HighScoreController.DrawHighScores();
                SwinGame.DrawText("Name: ", Color.White, GameResources.GameFont("Courier"), SCORES_LEFT, ENTRY_TOP);
                SwinGame.RefreshScreen();
            }

            // Set the name length to 3 characters
            s.Name = SwinGame.TextReadAsASCII();
            if ((s.Name.Length < NAME_WIDTH))
            {
                s.Name = (s.Name + new string(' ', NAME_WIDTH - s.Name.Length));
            }

            _scores.RemoveAt((_scores.Count - 1));
            _scores.Add(s);
            _scores.Sort();

            SaveScores();

            GameController.EndCurrentState();
        }
    }
示例#10
0
    /// <summary>
    /// Draws the current state of the game to the screen.
    /// </summary>
    /// <remarks>
    /// What is drawn depends upon the state of the game.
    /// </remarks>
    public static void DrawScreen()
    {
        UtilityFunctions.DrawBackground();

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

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

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

        case GameState.Deploying:
            DeploymentController.DrawDeployment();
            MenuController.DrawCommonMenu();                      // Aerisha Changes/Additions
            break;

        case GameState.Discovering:
            DiscoveryController.DrawDiscovery();
            MenuController.DrawCommonMenu();                      // Aerisha Changes/Additions
            break;

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

        case GameState.ViewingHighScores:
            HighScoreController.DrawHighScores();
            MenuController.DrawScoresPage();                            // Aerisha Changes/Additions
            break;

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

        UtilityFunctions.DrawAnimations();

        SwinGame.RefreshScreen();
    }
示例#11
0
    /// <summary>
    ///     ''' Draws the current state of the game to the screen.
    ///     ''' </summary>
    ///     ''' <remarks>
    ///     ''' What is drawn depends upon the state of the game.
    ///     ''' </remarks>
    public static void DrawScreen()
    {
        UtilityFunctions.DrawBackground();

        if (CurrentState == GameState.ViewingMainMenu)
        {
            MenuController.DrawMainMenu();
        }
        else if (CurrentState == GameState.ViewingGameMenu)
        {
            MenuController.DrawGameMenu();
        }
        else if (CurrentState == GameState.AlteringSettings)
        {
            MenuController.DrawSettings();
        }
        else if (CurrentState == GameState.ChangingMusic)          //Recently Added
        {
            MenuController.DrawMusicMenu();
        }
        else if (CurrentState == GameState.Deploying)
        {
            DeploymentController.DrawDeployment();
        }
        else if (CurrentState == GameState.AlteringOption)
        {
            MenuController.DrawOption();              //RECENTLY ADDED
        }
        else if (CurrentState == GameState.Discovering)
        {
            DiscoveryController.DrawDiscovery();
        }
        else if (CurrentState == GameState.EndingGame)
        {
            EndingGameController.DrawEndOfGame();
        }
        else if (CurrentState == GameState.ViewingHighScores)
        {
            HighScoreController.DrawHighScores();
        }

        UtilityFunctions.DrawAnimations();

        SwinGame.RefreshScreen();
    }
示例#12
0
    /// <summary>
    /// Draws the current state of the game to the screen.
    /// </summary>
    /// <remarks>
    /// What is drawn depends upon the state of the game.
    /// </remarks>
    public static void DrawScreen()
    {
        UtilityFunctions.DrawBackground();

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

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

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

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

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

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

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

        UtilityFunctions.DrawAnimations();

        //Lowered to 30 frames per second to see the splash and explosion animations

        SwinGame.RefreshScreen(60);
    }
示例#13
0
    // '' <summary>
    // '' Read the user's name for their highsSwinGame.
    // '' </summary>
    // '' <param name="value">the player's sSwinGame.</param>
    // '' <remarks>
    // '' This verifies if the score is a highsSwinGame.
    // '' </remarks>
    public static void ReadHighScore(int value)
    {
        const int ENTRY_TOP = 500;

        if ((_Scores.Count == 0))
        {
            HighScoreController.LoadScores();
        }

        // is it a high score
        if ((value > _Scores.Item[(_Scores.Count - 1)].Value))
        {
            Score s = new Score();
            s.Value = value;
            AddNewState(GameState.ViewingHighScores);
            int x;
            x = (SCORES_LEFT + SwinGame.TextWidth(GameFont("Courier"), "Name: "));
            SwinGame.StartReadingText(Color.White, NAME_WIDTH, GameFont("Courier"), x, ENTRY_TOP);
            // Read the text from the user
            while (SwinGame.ReadingText())
            {
                SwinGame.ProcessEvents();
                DrawBackground();
                HighScoreController.DrawHighScores();
                SwinGame.DrawText("Name: ", Color.White, GameFont("Courier"), SCORES_LEFT, ENTRY_TOP);
                SwinGame.RefreshScreen();
            }

            s.Name = SwinGame.TextReadAsASCII();
            if ((s.Name.Length < 3))
            {
                s.Name = (s.Name + new string(((char)(" ")), (3 - s.Name.Length)));
            }

            _Scores.RemoveAt((_Scores.Count - 1));
            _Scores.Add(s);
            _Scores.Sort();
            EndCurrentState();
        }
    }
    /// <summary>
    /// Draws the current state of the game to the screen.
    /// </summary>
    /// <remarks>
    /// What is drawn depends upon the state of the game.
    /// </remarks>
    public static void DrawScreen()
    {
        UtilityFunctions.DrawBackground();

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

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

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

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

        case GameState.Discovering:
            DiscoveryController.DrawDiscovery();
            SwinGame.DrawBitmap(GameResources.GameImage("HomeButton"), HOME_BUTTON_LEFT, TOP_BUTTONS_TOP);
            break;

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

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

        UtilityFunctions.DrawAnimations();

        SwinGame.RefreshScreen();
    }
示例#15
0
    /// <summary>
    /// Draws the current state of the game to the screen.
    /// </summary>
    /// <remarks>
    /// What is drawn depends upon the state of the game.
    /// </remarks>
    public void DrawScreen()
    {
        screenController.DrawBackground();

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

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

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

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

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

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

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

        screenController.DrawAnimations();

        SwinGame.RefreshScreen();
    }
示例#16
0
    /// <summary>
    /// Draws the current state of the game to the screen.
    /// </summary>
    /// <remarks>
    /// What is drawn depends upon the state of the game.
    /// </remarks>
    public static void DrawScreen()
    {
        UtilityFunctions.DrawBackground();

        switch (CurrentState)
        {
        case GameState.ViewingMainMenu:
            SwinGame.StopTimer(Timer);
            MenuController.DrawMainMenu();
            break;

        case GameState.ViewingInstruction:
            SwinGame.StopTimer(Timer);
            Rules.DrawInstruction();
            break;

        case GameState.ViewingGameMenu:
            SwinGame.StopTimer(Timer);
            MenuController.DrawGameMenu();
            break;

        case GameState.AlteringSettings:
            SwinGame.StopTimer(Timer);
            MenuController.DrawSettings();
            break;

        case GameState.Deploying:
            SwinGame.ResetTimer(Timer);
            DeploymentController.DrawDeployment();
            MenuController.DrawMenuBackButton();
            break;

        case GameState.Discovering:
            if (SwinGame.TimerTicks(Timer) == 0)
            {
                SwinGame.StartTimer(Timer);
            }
            DiscoveryController.DrawDiscovery();
            break;

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

        case GameState.ViewingHighScores:
            SwinGame.StopTimer(Timer);
            HighScoreController.DrawHighScores();
            break;

        case GameState.AlteringOption:
            SwinGame.StopTimer(Timer);
            MenuController.DrawOption();
            break;

        case GameState.ChangingMusic:
            SwinGame.StopTimer(Timer);
            MenuController.DrawMusicMenu();
            break;

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

        UtilityFunctions.DrawAnimations();

        SwinGame.RefreshScreen();
    }