Exemple #1
0
        public UnitShopBox(UnitShop parent, GraphicsDevice graphicsDevice, int capacity, Vector2 pos)
        {
            this.pos = pos;

            textBox = new RectBox(graphicsDevice,
                                  this.pos,
                                  width, textBoxHeight);

            divisorA = new Line(graphicsDevice,
                                new Vector2(pos.X, textBox.GetBottom()),
                                new Vector2(pos.X + width, textBox.GetBottom()),
                                5, Color.White);

            unitBoxes = new UnitShopButton[capacity];

            for (int i = 0; i < capacity; i++)
            {
                unitBoxes[i] = new UnitShopButton(i, graphicsDevice,
                                                  new Vector2(
                                                      pos.X,
                                                      (i == 0) ? textBox.GetBottom() : unitBoxes[i - 1].GetBottom()),
                                                  width, unitBoxHeight);
                unitBoxes[i].buttonPressed += parent.SellEntry;
            }

            dimensions = new Vector2(width,
                                     textBox.GetHeight() + capacity * unitBoxHeight);
        }
Exemple #2
0
 public void Reroll(object sender, RoutedEventArgs e)
 {
     UnitShop.Reroll();
     if (UnitShop.ShopLocked)
     {
         ToggleLock(sender, e);
     }
 }
Exemple #3
0
 public void buyAttempt(Grid grid, Button button, BaseUnitPackage unit, Enums.Piece piece)
 {
     if (!UnitShop.BuyUnit(unit, piece))
     {
         return;
     }
     _unitShopButtonsUI.DisableGridAndButton(grid, button);
 }
Exemple #4
0
 public void BuyUnitDef(Button button, BaseUnitPackage unit, Enums.Piece piece)//Buy unit if default piece is set
 {
     if (DefaultPieceSelector.GetDefaultPiece() == Enums.Piece.none)
     {
         return;
     }
     if (!UnitShop.BuyUnit(unit, piece))
     {
         return;
     }
     button.Content   = null;
     button.IsEnabled = false;
 }
Exemple #5
0
 public void SetupItem(GameObject unitPrefab, Team team, UnitShop shop)
 {
     this.unitPrefab = unitPrefab;
     this.team       = team;
     this.shop       = shop;
 }