Ejemplo n.º 1
0
        private void LoadContent_Ui(ContentManager Content)
        {
            augmentIcon = Content.Load <Texture2D>("PreparationTurn/StatAugmentIcon");

            moneyBox = new RectBox(graphicsDevice,
                                   characterDrawPos + new Vector2(uiScale * turnPlayer.CharacterSprite.Width / 2, winBarDimensions.Y + unitBarDimensions.Y),
                                   (int)moneyBoxDimensions.X, (int)moneyBoxDimensions.Y);

            emptyRect         = UiTools.GeneratePixelTexture(graphicsDevice);
            characterBoundary = Content.Load <Texture2D>("CharacterSelect/Buttons/ButtonBoundaryLR");
            vsAiIcon          = Content.Load <Texture2D>("PreparationTurn/vsPlayerIcon");
            vsPlayerIcon      = Content.Load <Texture2D>("PreparationTurn/vsPlayerIcon");
            moneyIcon         = Content.Load <Texture2D>("PreparationTurn/MoneyIcon");
            //information used by the stage box:
            stageInfo = new StageViewBox(graphicsDevice,
                                         currentStage,
                                         bebasSmall,
                                         stageNumber + 1,
                                         stageIndex + 1,
                                         WindowTools.PaddingToPixelCoordinate(0f, 0.25f, 10, 10)
                                         );

            //Buttons
            Texture2D buttonTexture = Content.Load <Texture2D>("PreparationTurn/EndTurnButton");
            Texture2D hoverTexture  = Content.Load <Texture2D>("PreparationTurn/EndTurnButtonHovered");

            bool[,] mask  = UiTools.CreateBoolMask(buttonTexture);
            endTurnButton = new SinglePressSpriteButton(WindowTools.PaddingToPixelCoordinate(0f, 0.17f, 10, 10),
                                                        buttonTexture,
                                                        hoverTexture,
                                                        mask, uiScale);

            //assign the end turn function to the button's event handler.
            endTurnButton.buttonPressed += HandleEndTurnButtonPress;

            levelUnitCapButton = new LevelUnitCapButton(graphicsDevice,
                                                        moneyBox.GetPos() + new Vector2(moneyBoxDimensions.X, 0f),
                                                        (int)WindowTools.GetUpscaledValue(225f), (int)moneyBoxDimensions.Y);

            //and so on with all used buttons
            levelUnitCapButton.buttonPressed += HandleLevelUpCapPress;

            useAbilityButton = new UseAbilityButton(graphicsDevice,
                                                    WindowTools.PaddingToPixelCoordinate(0.1f, 0.17f, 10, 10),
                                                    (int)WindowTools.GetUpscaledValue(225f),
                                                    (int)(buttonTexture.Height * uiScale)
                                                    );

            useAbilityButton.buttonPressed += HandleAbilityButtonPress;

            //divisor line to distinguish between money box/level up button.
            divisorLine = new Line(graphicsDevice, levelUnitCapButton.GetPos(), levelUnitCapButton.GetPos() + new Vector2(0, levelUnitCapButton.GetHeight()), 5, Color.White);


            //help button
            helpButton = new TutorialButton(graphicsDevice, this,
                                            WindowTools.PaddingToPixelCoordinate(0.90f, 0f, 0, 10),
                                            (int)(20 * uiScale),
                                            (int)(10 * uiScale));
        }
Ejemplo n.º 2
0
 public void AssignAbilityToButton(Button abilityButton)
 {
     AbilityButton = abilityButton;
     _buttonScript = abilityButton.GetComponent <Button>().GetComponent <UseAbilityButton>();
 }