Example #1
0
        public ButtonArray(Texture2D[] imgs, int x, int y)
        {
            this.x = x;
            this.y = y;

            ImageButton[] temp = new ImageButton[imgs.Length];
            for (int i = 0; i < imgs.Length; ++i)
                temp[i] = new ImageButton(imgs[i], x, y - 50 - imgs[0].Height*i, 50, 50);

            this.buttons = temp;
        }
Example #2
0
        public void LoadContent()
        {
            ContentManager Content = Game.game.Content;

            BottomBar = Content.Load<Texture2D>(@"GameGUI\BottomBar");

            Texture2D EvoBack1 = Content.Load<Texture2D>(@"GameGUI\EvoBlockEpoch1");
            Texture2D EvoBack2 = Content.Load<Texture2D>(@"GameGUI\EvoBlockEpoch2");
            Texture2D EvoBack3 = Content.Load<Texture2D>(@"GameGUI\EvoBlockEpoch3");

            // Evo Blocks and Epoch Buttons
            // Epoch 1
            Epoch1 = new ImageButton(Content.Load<Texture2D>(@"GameGUI\Epoch1"), 169, 495, 30, 90);
            Epoch1.SetInfo("Epoch 1", "Epoch 1 is active. You may use these Evo Blocks.");
            Epoch1.MouseEvent = null;
            Epoch1.setMode(2);

            EvoButton[0, 0] = new ImageButton(EvoBack1, Content.Load<Texture2D>(@"GameGUI\EvoBlockEpoch1_RedDNA"), 203, 495, 67, 28);
            EvoButton[0, 0].SetInfo("ATK DNA", "Increase Attack Power of Derps.", 1);
            EvoButton[0, 0].MouseEvent = ButtonClickEvents.EvoBlockBuildEvent;
            EvoButton[0, 0].setMode(1);
            EvoButton[0, 1] = new ImageButton(EvoBack1, Content.Load<Texture2D>(@"GameGUI\EvoBlockEpoch1_BlueDNA"), 203, 526, 67, 28);
            EvoButton[0, 1].SetInfo("DEF DNA", "Increase Defense of Derps.", 2);
            EvoButton[0, 1].MouseEvent = ButtonClickEvents.EvoBlockBuildEvent;
            EvoButton[0, 1].setMode(1);
            EvoButton[0, 2] = new ImageButton(EvoBack1, Content.Load<Texture2D>(@"GameGUI\EvoBlockEpoch1_YellowDNA"), 203, 557, 67, 28);
            EvoButton[0, 2].SetInfo("Solar DNA", "Energy harvester.", 3);
            EvoButton[0, 2].MouseEvent = ButtonClickEvents.EvoBlockBuildEvent;
            EvoButton[0, 2].setMode(1);

            // Epoch 2
            Epoch2 = new ImageButton(Content.Load<Texture2D>(@"GameGUI\Epoch2"), 278, 495, 30, 90);
            Epoch2.SetInfo("Epoch 2", "Epoch 2 is locked. Build more energy to unlock it.");
            Epoch2.MouseEvent = null;

            EvoButton[1, 0] = new ImageButton(EvoBack2, Content.Load<Texture2D>(@"GameGUI\EvoBlockEpoch1_RedDNA"), 312, 495, 67, 28);
            EvoButton[1, 0].SetInfo("MELEE DNA", "Epoch 2 is locked. Build more energy to unlock it.", 4);
            EvoButton[1, 0].MouseEvent = ButtonClickEvents.EvoBlockBuildEvent;
            EvoButton[1, 1] = new ImageButton(EvoBack2, Content.Load<Texture2D>(@"GameGUI\EvoBlockEpoch1_RedDNA"), 312, 526, 67, 28);
            EvoButton[1, 1].SetInfo("RANGE DNA", "Epoch 2 is locked. Build more energy to unlock it.", 5);
            EvoButton[1, 1].MouseEvent = ButtonClickEvents.EvoBlockBuildEvent;
            EvoButton[1, 2] = new ImageButton(EvoBack2, Content.Load<Texture2D>(@"GameGUI\EvoBlockEpoch1_RedDNA"), 312, 557, 67, 28);
            EvoButton[1, 2].SetInfo("SPEED DNA", "Epoch 2 is locked. Build more energy to unlock it.", 6);
            EvoButton[1, 2].MouseEvent = ButtonClickEvents.EvoBlockBuildEvent;

            // Epoch 3
            Epoch3 = new ImageButton(Content.Load<Texture2D>(@"GameGUI\Epoch2"), 387, 495, 30, 90);
            Epoch3.SetInfo("Epoch 3", "Epoch 3 is locked. Build more energy to unlock it.", 6);
            Epoch3.MouseEvent = null;

            EvoButton[2, 0] = new ImageButton(EvoBack3, Content.Load<Texture2D>(@"GameGUI\EvoBlockEpoch1_RedDNA"), 421, 495, 67, 28);
            EvoButton[2, 0].SetInfo("MUTATE DNA", "Epoch 3 is locked. Build more energy to unlock it.", 7);
            EvoButton[2, 0].MouseEvent = ButtonClickEvents.EvoBlockBuildEvent;
            EvoButton[2, 1] = new ImageButton(EvoBack3, Content.Load<Texture2D>(@"GameGUI\EvoBlockEpoch1_RedDNA"), 421, 526, 67, 28);
            EvoButton[2, 1].SetInfo("UNIFY DNA", "Epoch 3 is locked. Build more energy to unlock it.", 8);
            EvoButton[2, 1].MouseEvent = ButtonClickEvents.EvoBlockBuildEvent;
            //EvoButton[2, 2] = new ImageButton(EvoBack3, Content.Load<Texture2D>(@"GameGUI\EvoBlockEpoch1_RedDNA"), 421, 557, 67, 28);
            //EvoButton[2, 2].SetInfo("Epoch 1", "Epoch 1 is active. You may use these Evo Blocks.");
            //EvoButton[2, 2].MouseEvent = null;

            // Remove DNA Button
            RemoveDNA = new ImageButton(Content.Load<Texture2D>(@"GameGUI\RemoveDNA"), 364, 465, 125, 28);
            RemoveDNA.SetInfo("Remove DNA", "Click this then click the DNA to remove.", -1);
            RemoveDNA.MouseEvent = ButtonClickEvents.EvoBlockBuildEvent;

            // Energy Stuff
            EnergyPointer = Content.Load<Texture2D>(@"GameGUI\EnergyMeter");

            // Menu Bar Buttons
            Options = new ImageButton(Content.Load<Texture2D>(@"GameGUI\Options"), 716, 505, 67, 28);
            Options.SetInfo("Options", "CURRENTLY NOT IMPLEMENTED");
            Options.MouseEvent = null;

            Quit = new ImageButton(Content.Load<Texture2D>(@"GameGUI\Quit"), 716, 543, 67, 28);
            Quit.SetInfo("Quit", "Quit the current session.");
            Quit.MouseEvent = OnQuitButton;

            smallFont = Content.Load<SpriteFont>("smallGUI");
            largeFont = Content.Load<SpriteFont>("largeGUI");
        }
Example #3
0
        public void LoadContent()
        {
            ContentManager Content = Game.game.Content;

            controlRibbon = Content.Load<Texture2D>(@"GameGUI\ControlRibbon");

            infoBox = Content.Load<Texture2D>(@"GameGUI\InfoBox");
            buildingBox = Content.Load<Texture2D>(@"GameGUI\BuildingBox");
            energyBox = Content.Load<Texture2D>(@"GameGUI\EnergyBox");

            // Building Box Buttons
            buildboxButtons = new ImageButton[2, 3];
            ImageButton.OnMouseDown[,] buildboxActions = { { OnButton0_0, OnButton0_1, OnButton0_2 }, { OnButton1_0, OnButton1_1, OnButton1_2 } };
            String[,] infoString = { { "Build Level 1 DNA", "Build Level 2 DNA", "Build Level 3 DNA" }, { "Build Level 1 Factories", "Build Level 2 Factories", "Build Level 3 Factories" } };
            for (int i = 0; i < 3; ++i)
            {
                for (int j = 0; j < 2; ++j)
                {
                    Texture2D temp = Content.Load<Texture2D>(@"GameGUI\Buttons\BuildButton" + j + "_" + i);
                    buildboxButtons[j, i] = new ImageButton(temp, 327 + 110 * i, 520 + 35 * j, 100, 30);
                    buildboxButtons[j, i].MouseEvent = buildboxActions[j, i];
                    buildboxButtons[j, i].info = infoString[j, i];

                    if (i != 0)
                    {
                        buildboxButtons[j, i].Active = false;
                        buildboxButtons[j, i].info += " *LOCKED*";
                    }
                }
            }
            // Building Box Button Submenus (Arrays)
            buildboxArrays = new ButtonArray[2, 3];
            int[,] ArraySizes = {{2, 1, 1}, {1, 1, 1}};
            ImageButton.OnMouseDown[, ,] buildboxArrayActions = { { { }, { }, { } }, { { }, { }, { } } };
            for (int i = 0; i < 3; ++i)
            {
                for (int j = 0; j < 2; ++j)
                {
                    Texture2D[] temp = new Texture2D[ArraySizes[j, i]];
                    for (int k = 0; k < temp.Length; ++k)
                        temp[k] = Content.Load<Texture2D>(@"GameGUI\Buttons\BuildArray" + j + "_" + i + "_" + k);

                    buildboxArrays[j, i] = new ButtonArray(temp, buildboxButtons[j, i].X + 50, buildboxButtons[j, i].Y);
                }
            }

            Texture2D menuButton = Content.Load<Texture2D>(@"GameGUI\MenuButton");
            MenuButton = new ImageButton(menuButton, 199, 491, 32, 105);
            MenuButton.MouseEvent = OnMenuButton;
            MenuButton.info = "Return to the Main Menu";

            font = Content.Load<SpriteFont>("guiFontSmall");
        }