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; }
private void AddButtonEvents()//Na svaki UnitButton doda da kad se klikne kupimo unita { BtnLock = _unitShopButtonsUI.getLockButton(); BtnLock.Click += ToggleLock; foreach (Button button in _unitShopButtonsUI.UnitButtons) { button.Click += (o, e) => { BuyUnitDef(o as Button, (BaseUnitPackage)(o as Button).DataContext, DefaultPieceSelector.GetDefaultPiece()); }; } }