コード例 #1
0
        private void BuyItem(CommercialBuilding building, ICommercialItem item, Button button)
        {
            try
            {
                int currentCash = this.ninja.Cash;
                building.Sell(item, ninja);
                if (currentCash == this.ninja.Cash)
                {
                    MessageBox.Show("You rich the maximum of items that you can hold (30 items)!");
                }
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(ex.Message);
            }

            button.PerformClick();
        }