Beispiel #1
0
        public InventoryScreen(string inventoryFont)
        {
            // Set the font for the inventory
            this.inventoryFont = inventoryFont;

            // Add some buttons to add / delete from player inv
            GuiButton buttonAddSword = GuiButton.createButtonWithLabel(new Point(0, 300), "Add Sword", "testure", "font");

            buttonAddSword.ClickHandler = () => inventory.addItem(Item.getItem("sword"));
            addElement(buttonAddSword);

            GuiButton buttonAddPotion = GuiButton.createButtonWithLabel(new Point(buttonAddSword.Bounds.Right + 16, buttonAddSword.Bounds.Top), "Add Potion", "testure", "font");

            buttonAddPotion.ClickHandler = () => inventory.addItem(Item.getItem("hpPot"));
            addElement(buttonAddPotion);

            GuiButton buttonRemoveSword = GuiButton.createButtonWithLabel(new Point(buttonAddSword.Bounds.Left, buttonAddSword.Bounds.Bottom + 16), "Remove Sword", "testure", "font");

            buttonRemoveSword.ClickHandler = () => inventory.removeItem(Item.getItem("sword"));
            addElement(buttonRemoveSword);

            GuiButton buttonRemovePotion = GuiButton.createButtonWithLabel(new Point(buttonAddPotion.Bounds.Left, buttonAddPotion.Bounds.Bottom + 16), "Remove Potion", "testure", "font");

            buttonRemovePotion.ClickHandler = () => inventory.removeItem(Item.getItem("hpPot"));
            addElement(buttonRemovePotion);
        }
        public OverlayEconomyState()
        {
            // Add the end turn button
            buttonEndTurn = GuiButton.createButtonWithLabel(MaxOfEmpires.overlayPos.ToPoint(), "End turn", null, "font");
            addElement(buttonEndTurn);

            // Add a label showing whose turn it currently is
            labelCurrentPlayer = GuiLabel.createNewLabel(new Vector2(buttonEndTurn.Bounds.Right + 2, buttonEndTurn.Bounds.Top + 2), "Current player: ", "font");
            addElement(labelCurrentPlayer);

            // Add a label telling the player how much money they have
            labelPlayerMoney = GuiLabel.createNewLabel(new Vector2(labelCurrentPlayer.Bounds.Left, labelCurrentPlayer.Bounds.Bottom + 5), "Money: 0G", "font");
            addElement(labelPlayerMoney);

            labelPlayerMoneyPerTurn = GuiLabel.createNewLabel(new Vector2(labelCurrentPlayer.Bounds.Left, labelPlayerMoney.Bounds.Bottom + 5), "Money per turn: 0G", "font");
            addElement(labelPlayerMoneyPerTurn);

            // Add a label telling the player how much population they have
            labelPlayerPopulation = GuiLabel.createNewLabel(new Vector2(labelCurrentPlayer.Bounds.Left, labelPlayerMoneyPerTurn.Bounds.Bottom + 5), "Free Population: 0", "font");
            addElement(labelPlayerPopulation);

            // Add labels for unit stats
            listArmySoldiers = GuiList.createNewList(new Point(labelPlayerMoneyPerTurn.Bounds.Location.X, labelPlayerPopulation.Bounds.Bottom + 5), 5, new List <GuiElement>(), 300);
            listArmySoldiers.addElement(ElementArmySelection.CreateBuildButton(Point.Zero, "1", null, null)); // Add this so that the size is calculated correctly
            addElement(listArmySoldiers);

            buildingInfoPosition = new Point(buttonEndTurn.Bounds.Left, listArmySoldiers.Bounds.Bottom + listArmySoldiers.MaxHeight + 5);

            // Remove this label so that it doesn't display bullshit :)
            listArmySoldiers.removeElement(0);
        }
        public OverlayEconomyState()
        {
            // Add the end turn button
            buttonEndTurn = GuiButton.createButtonWithLabel(new Point((int)MaxOfEmpires.OverlayPos.X + 20, 10), "End turn", null, "font");
            addElement(buttonEndTurn);

            // Add a label showing whose turn it currently is
            labelCurrentPlayer = GuiLabel.createNewLabel(new Vector2(buttonEndTurn.Bounds.Right + 2, buttonEndTurn.Bounds.Top + 2), "Current player: ", "font");
            addElement(labelCurrentPlayer);

            // Add labels for unit stats
            listArmySoldiers = GuiList.createNewList(new Point(buttonEndTurn.Bounds.Location.X, labelCurrentPlayer.Bounds.Bottom + 5), 5, new System.Collections.Generic.List <GuiLabel>(), 300);

            addElement(listArmySoldiers);
        }
        public OverlayBattleState()
        {
            // Add the end turn button
            buttonEndTurn = GuiButton.createButtonWithLabel(new Point((int)MaxOfEmpires.OverlayPos.X + 20, 10), "End turn", null, "font");
            addElement(buttonEndTurn);

            // Add a label showing whose turn it currently is
            labelCurrentPlayer = GuiLabel.createNewLabel(new Vector2(buttonEndTurn.Bounds.Right + 2, buttonEndTurn.Bounds.Top + 2), "Current player: ", "font");
            addElement(labelCurrentPlayer);

            // Add labels for unit stats
            labelUnitName = GuiLabel.createNewLabel(new Vector2(buttonEndTurn.Bounds.Left, buttonEndTurn.Bounds.Bottom + 100), "Type: ", "font");
            labelUnitHp   = GuiLabel.createNewLabel(new Vector2(buttonEndTurn.Bounds.Left, labelUnitName.Bounds.Bottom + 2), "Unit Hp/Max: ", "font");
            labelUnitAtt  = GuiLabel.createNewLabel(new Vector2(labelUnitHp.Bounds.Left, labelUnitHp.Bounds.Bottom + 2), "Unit Att/Def: ", "font");
            labelUnitHit  = GuiLabel.createNewLabel(new Vector2(labelUnitAtt.Bounds.Left, labelUnitAtt.Bounds.Bottom + 2), "Unit Hit/Dodge: ", "font");

            addElement(labelUnitName);
            addElement(labelUnitHp);
            addElement(labelUnitAtt);
            addElement(labelUnitHit);
        }
        public OverlaySettingsMenu()
        {
            CheckCurrent();

            // Add the settings menu label
            labelTitle = GuiLabel.createNewLabel(new Vector2(10), "Settings", "titleFont");
            addElement(labelTitle);

            // Camera setting
            // Add the camera label
            labelCamera = GuiLabel.createNewLabel(new Vector2(100, 110), "How do you wish to control the camera? Current: " + CurrentCamera, "font");
            addElement(labelCamera);

            // Mouse control button
            buttonCameraControlMouse = GuiButton.createButtonWithLabel(new Point(100, 140), "Mouse", null, "font");
            buttonCameraControlMouse.ClickHandler = () => { MaxOfEmpires.settings.CameraControl = 1; CurrentCamera = "Mouse"; };
            addElement(buttonCameraControlMouse);

            // Keyboard control button
            buttonCameraControlKeyboard = GuiButton.createButtonWithLabel(new Point(200, 140), "Keyboard", null, "font");
            buttonCameraControlKeyboard.ClickHandler = () => { MaxOfEmpires.settings.CameraControl = 2; CurrentCamera = "Keyboard"; };
            addElement(buttonCameraControlKeyboard);

            // Both control button
            buttonCameraControlBoth = GuiButton.createButtonWithLabel(new Point(300, 140), "Both", null, "font");
            buttonCameraControlBoth.ClickHandler = () => { MaxOfEmpires.settings.CameraControl = 3; CurrentCamera = "Both"; };
            addElement(buttonCameraControlBoth);


            // Resolution setting
            // Add the resolution label
            labelResolution = GuiLabel.createNewLabel(new Vector2(100, 210), "What is your preferred resolution? Current: " + CurrentResolution, "font");
            addElement(labelResolution);

            // 800 x 480 button
            buttonResolution1 = GuiButton.createButtonWithLabel(new Point(100, 240), "800 x 480", null, "font");
            buttonResolution1.ClickHandler = () => { MaxOfEmpires.settings.Resolution = 1; CurrentResolution = "800 x 480"; };
            addElement(buttonResolution1);

            // 1280 x 768 button
            buttonResolution2 = GuiButton.createButtonWithLabel(new Point(200, 240), "1280 x 768", null, "font");
            buttonResolution2.ClickHandler = () => { MaxOfEmpires.settings.Resolution = 2; CurrentResolution = "1280 x 768"; };
            addElement(buttonResolution2);

            // 1920 x 1080 button
            buttonResolution3 = GuiButton.createButtonWithLabel(new Point(300, 240), "1920 x 1080", null, "font");
            buttonResolution3.ClickHandler = () => { MaxOfEmpires.settings.Resolution = 3; CurrentResolution = "1920 x 1080"; };
            addElement(buttonResolution3);


            // Fullscreen setting
            // Add the fullscreen label
            labelFullscreen = GuiLabel.createNewLabel(new Vector2(100, 310), "Would you like to play in fullscreen? Current: " + CurrentFullscreen, "font");
            addElement(labelFullscreen);

            // Fullscreen on button
            buttonFullscreenOn = GuiButton.createButtonWithLabel(new Point(100, 340), "Yes", null, "font");
            buttonFullscreenOn.ClickHandler = () => { MaxOfEmpires.settings.Fullscreen = true; CurrentFullscreen = "Yes"; };
            addElement(buttonFullscreenOn);

            // Fullscreen off button
            buttonFullscreenOff = GuiButton.createButtonWithLabel(new Point(200, 340), "No", null, "font");
            buttonFullscreenOff.ClickHandler = () => { MaxOfEmpires.settings.Fullscreen = false; CurrentFullscreen = "No"; };
            addElement(buttonFullscreenOff);


            // Operator buttons
            // Back button
            buttonBack = GuiButton.createButtonWithLabel(new Point(0, MaxOfEmpires.ScreenSize.Y - 50), "Back to main", null, "font");
            buttonBack.ClickHandler = () => { GameStateManager.SwitchState("mainMenu", true); MaxOfEmpires.settings.BackToSaved(); CheckCurrent(); };
            addElement(buttonBack);
            MoveToCenter(buttonBack);

            // Save button
            buttonSave = GuiButton.createButtonWithLabel(new Point((buttonBack.Bounds.X - (MaxOfEmpires.ScreenSize.X / 4)), MaxOfEmpires.ScreenSize.Y - 50), "Save and back", null, "font");
            buttonSave.ClickHandler = () => { MaxOfEmpires.settings.ApplySettings(); GameStateManager.SwitchState("mainMenu", true); };
            addElement(buttonSave);

            // Default buttton
            buttonDefault = GuiButton.createButtonWithLabel(new Point((buttonBack.Bounds.X + (MaxOfEmpires.ScreenSize.X / 4)), MaxOfEmpires.ScreenSize.Y - 50), "Reset to default", null, "font");
            buttonDefault.ClickHandler = () => { MaxOfEmpires.settings.ResetSettings(); CheckCurrent(); };
            addElement(buttonDefault);

            // Set everything to the center of the screen
            CenterElements();
        }
 /// <summary>
 /// Private constructor so the static creation method must be used.
 /// </summary>
 /// <param name="startPos">The starting position of this element on the screen.</param>
 /// <param name="buildingString">The string in the label.</param>
 private ElementArmySelection(Point startPos, string buildingString, string removeText, string addText) : base(new Rectangle(startPos, Point.Zero))
 {
     labelUnitSelection    = GuiLabel.createNewLabel(startPos.ToVector2(), buildingString, "font");
     buttonAddSelection    = GuiButton.createButtonWithLabel(new Point(labelUnitSelection.Bounds.Right + 15, labelUnitSelection.Bounds.Top), addText, null, "font");
     buttonRemoveSelection = GuiButton.createButtonWithLabel(new Point(buttonAddSelection.Bounds.Right + 15, labelUnitSelection.Bounds.Top), removeText, null, "font");
 }
 /// <summary>
 /// Private constructor so the static creation method must be used.
 /// </summary>
 /// <param name="startPos">The starting position of this element on the screen.</param>
 /// <param name="buildingString">The string in the label.</param>
 private ElementBuildButton(Point startPos, string buildingString, string buttontext) : base(new Rectangle(startPos, Point.Zero))
 {
     labelBuildingNameAndCost = GuiLabel.createNewLabel(startPos.ToVector2(), buildingString, "font");
     buttonBuildBuilding      = GuiButton.createButtonWithLabel(new Point(labelBuildingNameAndCost.Bounds.Right + 5, labelBuildingNameAndCost.Bounds.Top), buttontext, null, "font");
 }