Exemple #1
0
        public void menuControlls()
        {
            #region Texture Lists
            List <Texture2D> activeButtonsList  = new List <Texture2D>();
            List <Texture2D> passiveButtonsList = new List <Texture2D>();
            activeButtonsList.Add(CommonFunctions.ActiveButtonContinue);
            activeButtonsList.Add(CommonFunctions.ActiveButonBackToMenu);
            passiveButtonsList.Add(CommonFunctions.PassiveButtonContinue);
            passiveButtonsList.Add(CommonFunctions.PassiveButtonBackToMenu);
            #endregion

            switch (meContr.MenuControll(2, activeButtonsList, passiveButtonsList))
            {
            case 0:
                paused = false;
                CommonFunctions.generalGameSpeed = generalSpeedSaver;
                CommonFunctions.generalColour    = Microsoft.Xna.Framework.Color.White;
                break;

            case 1:
                Destroy(this);
                spaceshipList.Remove(this);
                CommonFunctions.currentGameStartController.gameStarted = false;
                CommonFunctions.currentGameStartController.menuPage    = 0;
                meContr.pauseMenuNavigator    = 0;
                CommonFunctions.generalColour = Microsoft.Xna.Framework.Color.White;
                break;

            default:
                break;
            }
        }
        public void Update()
        {
            if (Properties.Settings.Default.Name == "")
            {
                CommonFunctions.currentTextInputController.Update("Please enter your name:");
            }
            else
            {
                List <Texture2D> textureListActive  = new List <Texture2D>();
                List <Texture2D> textureListPassive = new List <Texture2D>();
                textureListActive.Clear();
                textureListPassive.Clear();

                switch (menuPage)
                {
                case 0:
                    textureListActive.Add(CommonFunctions.ActiveButtonStart);
                    textureListActive.Add(CommonFunctions.ActiveButtonHighscores);
                    textureListActive.Add(CommonFunctions.ActiveButtonOptions);
                    textureListActive.Add(CommonFunctions.ActiveButtonTutorial);
                    textureListActive.Add(CommonFunctions.ActiveButtonQuitGame);
                    textureListPassive.Add(CommonFunctions.PassiveButtonStart);
                    textureListPassive.Add(CommonFunctions.PassiveButtonHighscores);
                    textureListPassive.Add(CommonFunctions.PassiveButtonOptions);
                    textureListPassive.Add(CommonFunctions.PassiveButtonTutorial);
                    textureListPassive.Add(CommonFunctions.PassiveButtonQuitGame);

                    switch (meContr.MenuControll(5, textureListActive, textureListPassive))
                    {
                    case 0:
                        menuPage = 1;
                        break;

                    case 1:
                        mySQLContr.formatHighscores();
                        highscoresToString();
                        menuPage = 6;
                        break;

                    case 2:
                        menuPage = 4;
                        break;

                    case 3:
                        menuPage = 3;
                        break;

                    case 4:
                        game.Quit();
                        break;

                    default:
                        break;
                    }
                    break;

                case 1:
                    textureListActive.Add(CommonFunctions.ActiveButtonNormal);
                    textureListActive.Add(CommonFunctions.ActiveButtonTitan);
                    textureListActive.Add(CommonFunctions.ActiveButtonBack);
                    textureListPassive.Add(CommonFunctions.PassiveButtonNormal);
                    textureListPassive.Add(CommonFunctions.PassiveButtonTitan);
                    textureListPassive.Add(CommonFunctions.PassiveButtonBack);

                    switch (meContr.MenuControll(3, textureListActive, textureListPassive))
                    {
                    case 0:
                        shipChoiceSaver = 0;
                        menuPage        = 2;
                        break;

                    case 1:
                        shipChoiceSaver = 1;
                        menuPage        = 2;
                        break;

                    case 2:
                        menuPage = 0;
                        break;

                    default:
                        break;
                    }

                    break;

                case 2:
                    textureListActive.Add(CommonFunctions.ActiveButtonNormal);
                    textureListActive.Add(CommonFunctions.ActiveButtonRisky);
                    textureListActive.Add(CommonFunctions.ActiveButtonBack);
                    textureListPassive.Add(CommonFunctions.PassiveButtonNormal);
                    textureListPassive.Add(CommonFunctions.PassiveButtonRisky);
                    textureListPassive.Add(CommonFunctions.PassiveButtonBack);

                    switch (meContr.MenuControll(3, textureListActive, textureListPassive))
                    {
                    case 0:
                        if (shipChoiceSaver == 0)
                        {
                            SpaceshipController.SpawnShip(0);
                        }
                        else if (shipChoiceSaver == 1)
                        {
                            SpaceshipController.SpawnShip(2);
                        }

                        gameStarted = true;

                        break;

                    case 1:
                        if (shipChoiceSaver == 0)
                        {
                            SpaceshipController.SpawnShip(1);
                        }
                        else if (shipChoiceSaver == 1)
                        {
                            SpaceshipController.SpawnShip(3);
                        }

                        gameStarted = true;

                        break;

                    case 2:
                        menuPage = 1;
                        break;

                    default:
                        break;
                    }

                    break;

                case 3:
                    textureListActive.Add(CommonFunctions.ActiveButtonBack);
                    textureListPassive.Add(CommonFunctions.PassiveButtonBack);

                    if (meContr.MenuControll(1, textureListActive, textureListPassive) == 0)
                    {
                        menuPage = 0;
                    }

                    break;

                case 4:
                    textureListActive.Add(CommonFunctions.ActiveButtonResetScore);
                    textureListActive.Add(CommonFunctions.ActiveButtonSubmitScore);
                    textureListActive.Add(CommonFunctions.ActiveButtonChangeName);
                    //textureListActive.Add(CommonFunctions.ActiveButtonResolution);
                    textureListActive.Add(CommonFunctions.ActiveButtonBack);
                    textureListPassive.Add(CommonFunctions.PassiveButtonResetScore);
                    textureListPassive.Add(CommonFunctions.PassiveButtonSubmitScore);
                    textureListPassive.Add(CommonFunctions.PassiveButtonChangeName);
                    //textureListPassive.Add(CommonFunctions.PassiveButtonResolution);
                    textureListPassive.Add(CommonFunctions.PassiveButtonBack);

                    switch (meContr.MenuControll(4, textureListActive, textureListPassive))
                    {
                    case 0:
                        Properties.Settings.Default.Highscore = 0;
                        Properties.Settings.Default.Save();
                        break;

                    case 1:
                        if (scoreSubmittingAllowed)
                        {
                            if (mySQLContr.isScoreHigher(Properties.Settings.Default.Name))
                            {
                                mySQLContr.deleteHighscore(Properties.Settings.Default.Name);
                                mySQLContr.insertHighscore(Properties.Settings.Default.Name, Properties.Settings.Default.Highscore);
                                scoreSubmitted = true;
                            }
                            scoreSubmittingAllowed = false;
                        }
                        break;

                    case 2:
                        Properties.Settings.Default.Name = "";
                        Properties.Settings.Default.Save();
                        break;

                    case 3:
                        menuPage       = 0;
                        scoreSubmitted = false;
                        break;

                    /*
                     * case 2:
                     * menuPage = 5;
                     * break;
                     */
                    default:
                        break;
                    }

                    break;

                case 5:

                    textureListActive.Add(CommonFunctions.ActiveButton500x500);
                    textureListActive.Add(CommonFunctions.ActiveButton650x650);
                    textureListActive.Add(CommonFunctions.ActiveButton800x800);
                    textureListActive.Add(CommonFunctions.ActiveButton950x950);
                    textureListActive.Add(CommonFunctions.ActiveButtonBack);
                    textureListPassive.Add(CommonFunctions.PassiveButton500x500);
                    textureListPassive.Add(CommonFunctions.PassiveButton650x650);
                    textureListPassive.Add(CommonFunctions.PassiveButton800x800);
                    textureListPassive.Add(CommonFunctions.PassiveButton950x950);
                    textureListPassive.Add(CommonFunctions.PassiveButtonBack);

                    switch (meContr.MenuControll(5, textureListActive, textureListPassive))
                    {
                    case 0:
                        game.setResolution(500, 500);         //TODO: reload window
                        break;                                //dann wieder in optionen einbauen

                    case 1:
                        game.setResolution(650, 650);
                        break;

                    case 2:
                        game.setResolution(800, 800);
                        break;

                    case 3:
                        game.setResolution(950, 950);
                        break;

                    case 4:
                        menuPage = 0;
                        break;

                    default:
                        break;
                    }
                    break;

                case 6:
                    textureListActive.Add(CommonFunctions.ActiveButtonBack);
                    textureListPassive.Add(CommonFunctions.PassiveButtonBack);

                    if (meContr.MenuControll(1, textureListActive, textureListPassive) == 0)
                    {
                        menuPage = 0;
                    }

                    break;

                default:
                    break;
                }

                if (!gameStarted)
                {
                    //spawnMode: 0=normal, 1=risky, 2=Titan, 3=risky Titan
                    if (CommonFunctions.Input.IsKeyDown(Keys.N))
                    {
                        SpaceshipController.SpawnShip(0);
                        gameStarted = true;
                    }
                    if (CommonFunctions.Input.IsKeyDown(Keys.R))
                    {
                        SpaceshipController.SpawnShip(1);
                        gameStarted = true;
                    }
                    if (CommonFunctions.Input.IsKeyDown(Keys.T))
                    {
                        SpaceshipController.SpawnShip(2);
                        gameStarted = true;
                    }
                    if (CommonFunctions.Input.IsKeyDown(Keys.I))
                    {
                        SpaceshipController.SpawnShip(3);
                        gameStarted = true;
                    }
                }
            }
        }