Ejemplo n.º 1
0
 /// <summary>
 /// Unloads all components needed for settings view.
 /// </summary>
 private void UnloadSettings()
 {
     soundYes = null;
     soundNo = null;
     reset = null;
     inst = null;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Unloads all components of the main menu.
 /// </summary>
 private void UnloadMainMenu()
 {
     playButton = null;
     levelSelectButton = null;
     settingsButton = null;
     exitButton = null;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Loads all components needed for the settings view.
        /// </summary>
        private void LoadSettings()
        {
            // Load textures
            Texture2D yellowButton = game.Content.Load<Texture2D>("Buttons\\YellowButton");
            Texture2D blueButton = game.Content.Load<Texture2D>("Buttons\\BlueButton");
            Texture2D redButton = game.Content.Load<Texture2D>("Buttons\\RedButton");

            // Load fonts
            SpriteFont menuFontBig = game.Content.Load<SpriteFont>("Fonts\\Pericles36");
            SpriteFont menuFontSmall = game.Content.Load<SpriteFont>("Fonts\\Pericles28");

            // Create sound label
            sound = new Label(game, spriteBatch, new Rectangle(103, 275, 275, 70), menuFontSmall, "Play with sound?");

            // Create buttons
            soundYes = new Button(game, spriteBatch, new Rectangle(103, 375, 122, 70), yellowButton, menuFontBig, "Yes");
            soundNo = new Button(game, spriteBatch, new Rectangle(255, 375, 122, 70), blueButton, menuFontBig, "No");
            reset = new Button(game, spriteBatch, new Rectangle(103, 575, 275, 70), redButton, menuFontSmall, "Reset Levels");
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Loads all components needed to display the main menu
        /// </summary>
        private void LoadMainMenu()
        {
            // Load textures needed
            Texture2D yellowButton = game.Content.Load<Texture2D>("Buttons\\YellowButton");
            Texture2D blueButton = game.Content.Load<Texture2D>("Buttons\\BlueButton");
            Texture2D redButton = game.Content.Load<Texture2D>("Buttons\\RedButton");

            // Load fonts needed
            SpriteFont menuFontBig = game.Content.Load<SpriteFont>("Fonts\\Pericles36");
            SpriteFont menuFontSmall = game.Content.Load<SpriteFont>("Fonts\\Pericles28");

            // Create main menu buttons
            playButton = new Button(game, spriteBatch, new Rectangle(103, 275, 275, 70), blueButton, menuFontBig, "Play");
            levelSelectButton = new Button(game, spriteBatch, new Rectangle(103, 375, 275, 70), blueButton, menuFontSmall, "Level Select");
            settingsButton = new Button(game, spriteBatch, new Rectangle(103, 475, 275, 70), yellowButton, menuFontBig, "Settings");
            exitButton = new Button(game, spriteBatch, new Rectangle(103, 575, 275, 70), redButton, menuFontBig, "Exit");
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  Initialized all textures needed, all fonts needed, all labels needed, 
        /// and all buttons needed.
        /// </summary>
        public override void Initialize()
        {
            // Load button textures
            Texture2D greenButton = game.Content.Load<Texture2D>("Buttons\\GreenButton");
            Texture2D redButton = game.Content.Load<Texture2D>("Buttons\\RedButton");

            // Load matter textures
            redMatterTexture = game.Content.Load<Texture2D>("Tiles\\Matter\\RedMatter\\RedMatter1");
            blueMatterTexture = game.Content.Load<Texture2D>("Tiles\\Matter\\BlueMatter\\BlueMatter1");

            // Load fonts for labels
            SpriteFont hudFont = game.Content.Load<SpriteFont>("Fonts\\Pericles28");
            SpriteFont hudFont2 = game.Content.Load<SpriteFont>("Fonts\\Pericles24");
            SpriteFont hudFont3 = game.Content.Load<SpriteFont>("Fonts\\Pericles18");

            // Create reset button
            resetButton = new Button(game, spriteBatch, new Rectangle(250, 10, 105, 60), greenButton, hudFont2, "Reset");

            // Create exit button
            exitButton = new Button(game, spriteBatch, new Rectangle(365, 10, 105, 60), redButton, hudFont, "Exit");

            // Create fuel label
            fuelLabel = new Label(game, spriteBatch, new Rectangle(10, 10, 115, 25), hudFont3, "Fuel: " + Convert.ToString(Fuel));
            fuelLabel.TextPosition = Label.LabelPosition.Left;

            // Create level label
            levelLabel = new Label(game, spriteBatch, new Rectangle(125, 10, 115, 25), hudFont3, "Level: " + Convert.ToString(Level));
            levelLabel.TextPosition = Label.LabelPosition.Left;

            // Create matter labels
            blueMatterLabel = new Label(game, spriteBatch, new Rectangle(25, 45, 40, 25), hudFont3, "0");
            redMatterLabel = new Label(game, spriteBatch, new Rectangle(98, 45, 40, 25), hudFont3, "0");

            base.Initialize();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Load textures needed for the selector as well as enable buttons as needed
        /// from the save file. 
        /// </summary>
        public override void Initialize()
        {
            // Load textures
            Texture2D blueButton = game.Content.Load<Texture2D>("Buttons\\BlueButton");
            SpriteFont menuFont = game.Content.Load<SpriteFont>("Fonts\\Pericles36");

            selector = new List<List<Button>>();

            // Get the top level the user has beaten
            int topLevel = FileHandler.TopLevel();

            // Create the buttons
            for (int y = 0; y <= 4; y++)
            {
                List<Button> row = new List<Button>();
                for (int x = 0; x < 5; x++)
                {
                    Button button = new Button(game, spriteBatch,
                                               new Rectangle((30+(x*90)), (300+(y*90)), 60, 60), blueButton, menuFont,
                                               Convert.ToString((y * 5) + x + 1));
                    // Disable the button if the user has not beaten a high enough level
                    // to unlock it yet
                    if ((y * 5) + x + 1 > topLevel + 1)
                        button.enabled = false;
                    row.Add(button);
                }
                selector.Add(row);
            }

            base.Initialize();
        }