Exemplo n.º 1
0
        public void LoadContent()
        {
            #region Load Rescources
            background = Main.GameContent.Load<Texture2D>("Menus/Background 2");
            font = Main.GameContent.Load<SpriteFont>("Font/Font1");
            title = Main.GameContent.Load<Texture2D>("Menus/Logo");
            highScoresUnPressed = Main.GameContent.Load<Texture2D>("Menus/High Scores");
            highScoresPressed = Main.GameContent.Load<Texture2D>("Menus/High Scores Pressed");
            optionsUnPressed = Main.GameContent.Load<Texture2D>("Menus/Options");
            optionsPressed = Main.GameContent.Load<Texture2D>("Menus/Options Pressed");
            menuUnPressed = Main.GameContent.Load<Texture2D>("Menus/Menu");
            menuPressed = Main.GameContent.Load<Texture2D>("Menus/Menu Pressed");
            creditsUnPressed = Main.GameContent.Load<Texture2D>("Menus/CreditsUnPressed");
            creditsPressed = Main.GameContent.Load<Texture2D>("Menus/CreditsPressed");
            soundUnPressed = Main.GameContent.Load<Texture2D>("Menus/Sound");
            soundPressed = Main.GameContent.Load<Texture2D>("Menus/SoundPressed");
            fullscreenUnPressed = Main.GameContent.Load<Texture2D>("Menus/FullScreen");
            fullscreenPressed = Main.GameContent.Load<Texture2D>("Menus/FullScreenPressed");
            inGameMenu = Main.GameContent.Load<Texture2D>("Menus/InGameMenu");
            exitUnHighLighted = Main.GameContent.Load<Texture2D>("Menus/Exit");
            exitHighLighted = Main.GameContent.Load<Texture2D>("Menus/ExitHighlight");
            resumeHighlighted = Main.GameContent.Load<Texture2D>("Menus/ResumeHighlight");
            resumeUnHighlighted = Main.GameContent.Load<Texture2D>("Menus/Resume");
            startUnPressed = Main.GameContent.Load<Texture2D>("Menus/Start");
            startPressed = Main.GameContent.Load<Texture2D>("Menus/Start Pressed");
            testKartUnPressed = Main.GameContent.Load<Texture2D>("Menus/TestKartUnPressed");
            testKartPressed = Main.GameContent.Load<Texture2D>("Menus/TestKartPressed");
            tifighterUnPressed = Main.GameContent.Load<Texture2D>("Menus/TiFighter");
            tifighterPressed = Main.GameContent.Load<Texture2D>("Menus/TiFighterPressed");
            shoppingCartUnPressed = Main.GameContent.Load<Texture2D>("Menus/ShoppingCart");
            shoppingCartPressed = Main.GameContent.Load<Texture2D>("Menus/ShoppingCartPressed");
            guminKartUnPressed = Main.GameContent.Load<Texture2D>("Menus/GuminKart");
            guminKartPressed = Main.GameContent.Load<Texture2D>("Menus/GuminKartPressed");
            Untitled = Main.GameContent.Load<Texture2D>("Menus/Untitled");
            pressed = Main.GameContent.Load<SoundEffect>("Music and Sounds/Button Press");
            pressedSound = pressed.Create();
            pressedSound.Volume = .25f;
            pressedSound.IsLooped = false;

            scores = new ScoreBoard("Scores", "Scores", 10);
            scores.retrieveScores();
            #endregion

            switch (type)
            {
                case MenuType.MainMenu:
                    kartSelect = new Button(new Vector2(310, 380), 173, 53, 1, Main.CurrentMouse, startUnPressed, startPressed, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);
                    highScores = new Button(new Vector2(9, 536), 324, 55, 2, Main.CurrentMouse, highScoresUnPressed, highScoresPressed, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);
                    options = new Button(new Vector2(280, 469), 233, 42, 3, Main.CurrentMouse, optionsUnPressed, optionsPressed, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);
                    credits = new Button(new Vector2(600, 545), 191, 47, 7, Main.CurrentMouse, creditsUnPressed, creditsPressed, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);
                    exit = new Button(new Vector2(720, 9), 71, 29, 9, Main.CurrentMouse, exitUnHighLighted, exitHighLighted, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);

                    credits.ButtonPressed += ButtonPressed;
                    kartSelect.ButtonPressed += ButtonPressed;
                    options.ButtonPressed += ButtonPressed;
                    highScores.ButtonPressed += ButtonPressed;
                    exit.ButtonPressed += ButtonPressed;
                    break;

                case MenuType.Options:
                    highScores = new Button(new Vector2(467, 536), 324, 55, 2, Main.CurrentMouse, highScoresUnPressed, highScoresPressed, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);
                    menu = new Button(new Vector2(9, 537), 168, 54, 4, Main.CurrentMouse, menuUnPressed, menuPressed, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);
                    sound = new Button(new Vector2(100, 100), 164, 53, 5, Main.CurrentMouse, soundUnPressed, soundPressed, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);
                    fullscreen = new Button(new Vector2(100, 200), 248, 45, 6, Main.CurrentMouse, fullscreenUnPressed, fullscreenPressed, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);

                    menu.ButtonPressed += ButtonPressed;
                    highScores.ButtonPressed += ButtonPressed;
                    sound.ButtonPressed += ButtonPressed;
                    fullscreen.ButtonPressed += ButtonPressed;
                    break;

                case MenuType.HighScores:
                    menu = new Button(new Vector2(9, 537), 168, 54, 4, Main.CurrentMouse, menuUnPressed, menuPressed, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);

                    menu.ButtonPressed += ButtonPressed;
                    break;

                case MenuType.Pause:
                    start = new Button(new Vector2(325, 200), 123, 38, 8, Main.CurrentMouse, resumeUnHighlighted, resumeHighlighted, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);
                    menu = new Button(new Vector2(350, 300), 79, 29, 4, Main.CurrentMouse, exitUnHighLighted, exitHighLighted, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);

                    start.ButtonPressed += ButtonPressed;
                    menu.ButtonPressed += ButtonPressed;
                    break;

                case MenuType.KartSelect:
                    start = new Button(new Vector2(500, 500), 173, 53, 8, Main.CurrentMouse, startUnPressed, startPressed, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);
                    testKart = new Button(new Vector2(100, 100), 165, 23, 10, Main.CurrentMouse, testKartUnPressed, testKartPressed, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);
                    tieFighter = new Button(new Vector2(100, 200), 173, 26, 11, Main.CurrentMouse, tifighterUnPressed, tifighterPressed, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);
                    shoppingCart = new Button(new Vector2(100, 300), 255, 32, 12, Main.CurrentMouse, shoppingCartUnPressed, shoppingCartPressed, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);
                    guminKart = new Button(new Vector2(100, 400), 205, 25, 13, Main.CurrentMouse, guminKartUnPressed, guminKartPressed, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);
                    menu = new Button(new Vector2(100, 500), 168, 54, 4, Main.CurrentMouse, menuUnPressed, menuPressed, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);

                    menu.ButtonPressed += ButtonPressed;
                    start.ButtonPressed += ButtonPressed;
                    testKart.ButtonPressed += ButtonPressed;
                    tieFighter.ButtonPressed += ButtonPressed;
                    shoppingCart.ButtonPressed += ButtonPressed;
                    guminKart.ButtonPressed += ButtonPressed;
                    break;

                case MenuType.Credits:
                    menu = new Button(new Vector2(9, 537), 168, 54, 4, Main.CurrentMouse, menuUnPressed, menuPressed, Main.Graphics.PreferredBackBufferWidth, Main.Graphics.PreferredBackBufferHeight);

                    menu.ButtonPressed += ButtonPressed;
                    break;

                case MenuType.Publisher:
                    timer = new Timer(4000);
                    timer.Elapsed += TimeElapsed;
                    timer.Start();
                    break;

                default:
                    break;
            }
        }