private void BuyItem(CommercialBuilding building, ICommercial item, Button button) { try { int currentCash = ninja.Cash; building.Sell(item, ninja); if(currentCash == ninja.Cash) { MessageBox.Show("You rich the maximum of items that you can hold (10 items per category)!"); } } catch (ArgumentException ex) { MessageBox.Show(ex.Message); } button.PerformClick(); }
private void btnPizza_Click(object sender, EventArgs e) { fastFood = FastFood.Instance; pnlPizza.Visible = true; lblPizzaCashValue.Text = ninja.Cash.ToString(); lblPizzaCokePrice.Text = "Price:" + fastFood.Goods[0].Price; lblPizzaCokeEnergy.Text = "Energy: " + ((Energizer)fastFood.Goods[0]).HealingPoints; lblPizzaCoffeePrice.Text = "Price:" + fastFood.Goods[1].Price; lblPizzaCoffeeEnergy.Text = "Energy: " + ((Energizer)fastFood.Goods[1]).HealingPoints; lblPizzaIceCreamPrice.Text = "Price:" + fastFood.Goods[2].Price; lblPizzaIceCreamEnergy.Text = "Energy: " + ((Energizer)fastFood.Goods[2]).HealingPoints; ; lblPizzaHamburgerPrice.Text = "Price:" + fastFood.Goods[3].Price; lblPizzaHamburgerEnergy.Text = "Energy: " + ((Energizer)fastFood.Goods[3]).HealingPoints; lblPizzaPizzaPrice.Text = "Price:" + fastFood.Goods[4].Price; lblPizzaPizzaEnergy.Text = "Energy: " + ((Energizer)fastFood.Goods[4]).HealingPoints; lblPizzaEnergydrinkPrice.Text = "Price:" + fastFood.Goods[5].Price; lblPizzaEnergydrinkEnergy.Text = "Energy: " + ((Energizer)fastFood.Goods[5]).HealingPoints; }
private void btnPlayground_Click(object sender, EventArgs e) { playground = Playground.Instance; pnlPlayground.Visible = true; lblPlaygroundCash.Text = ninja.Cash.ToString(); lblPlaygroundPokerPrice.Text = "Price: " + playground.Goods[0].Price; lblPlaygroundPokerEnergy.Text = "Power: " + ((Recreation)playground.Goods[0]).UpgradeTotalEnergy; ; lblPlaygroundVideoPrice.Text = "Price: " + playground.Goods[1].Price; lblPlaygroundVideoEnergy.Text = "Power: " + ((Recreation)playground.Goods[1]).UpgradeTotalEnergy; ; lblPlaygroundBowlingPrice.Text = "Price: " + playground.Goods[2].Price; lblPlaygroundBowlingEnergy.Text = "Power: " + ((Recreation)playground.Goods[2]).UpgradeTotalEnergy; ; lblPlaygroundBilliardsPrice.Text = "Price: " + playground.Goods[3].Price; lblPlaygroundBilliardsEnergy.Text = "Power: " + ((Recreation)playground.Goods[3]).UpgradeTotalEnergy; ; lblPlaygroundDancePrice.Text = "Price: " + playground.Goods[4].Price; lblPlaygroundDanceEnergy.Text = "Power: " + ((Recreation)playground.Goods[4]).UpgradeTotalEnergy; ; }
private void btnMall_Click(object sender, EventArgs e) { mall = ShoppingMall.Instance; pnlMall.Visible = true; lblMallCash.Text = ninja.Cash.ToString(); lblMallShurikanPrice.Text = "Price:" + mall.Goods[2].Price; lblMallShurikanPower.Text = "Power: " + ((Power)mall.Goods[2]).AttackPower; lblMallBaseballPrice.Text = "Price:" + mall.Goods[1].Price; lblMallBaseballPower.Text = "Power: " + ((Power)mall.Goods[1]).AttackPower; lblMallHammerPrice.Text = "Price:" + mall.Goods[0].Price; lblMallHammerPower.Text = "Power: " + ((Power)mall.Goods[0]).AttackPower; ; lblMallTomahawkPrice.Text = "Price:" + mall.Goods[3].Price; lblMallTomahawkPower.Text = "Power: " + ((Power)mall.Goods[3]).AttackPower; lblMallPoisonDartPrice.Text = "Price:" + mall.Goods[4].Price; lblMallPoisonDartPower.Text = "Power: " + ((Power)mall.Goods[4]).AttackPower; lblMallForumflagPrice.Text = "Price:" + mall.Goods[5].Price; lblMallForumflagPower.Text = "Power: " + ((Power)mall.Goods[5]).AttackPower; lblCSharpBookPrice.Text = "Price:" + mall.Goods[7].Price; lblCSharpBookPower.Text = "Power: " + ((Power)mall.Goods[7]).AttackPower; lblMallHelpFromTeamPrice.Text = "Price:" + mall.Goods[8].Price; lblHelpFromTeamPower.Text = "Power: " + ((Power)mall.Goods[8]).AttackPower; lblHelpFromTrainerPrice.Text = "Price:" + mall.Goods[9].Price; lblHelpFromTrainerPower.Text = "Power: " + ((Power)mall.Goods[9]).AttackPower; lblMallVirusPrice.Text = "Price:" + mall.Goods[6].Price; lblMallVirusPower.Text = "Power: " + ((Power)mall.Goods[6]).AttackPower; }