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(); }
private void BtnPizza_Click(object sender, EventArgs e) { this.fastFood = FastFood.Instance; this.pnlPizza.Visible = true; this.lblPizzaCashValue.Text = this.ninja.Cash.ToString(); this.btnPizza1.BackgroundImage = GiveBackgroundImage(fastFood.Goods[0].Name); this.btnPizza2.BackgroundImage = GiveBackgroundImage(fastFood.Goods[1].Name); this.btnPizza3.BackgroundImage = GiveBackgroundImage(fastFood.Goods[2].Name); this.btnPizza4.BackgroundImage = GiveBackgroundImage(fastFood.Goods[3].Name); this.btnPizza5.BackgroundImage = GiveBackgroundImage(fastFood.Goods[4].Name); this.btnPizza6.BackgroundImage = GiveBackgroundImage(fastFood.Goods[5].Name); this.lblPizzaCokeEnergy.Text = "Energy: " + ((IEnergizer)this.fastFood.Goods[0]).HealingPoints; this.lblPizzaCoffeePrice.Text = "Price:" + this.fastFood.Goods[1].Price; this.lblPizzaCoffeeEnergy.Text = "Energy: " + ((IEnergizer)this.fastFood.Goods[1]).HealingPoints; this.lblPizzaIceCreamPrice.Text = "Price:" + this.fastFood.Goods[2].Price; this.lblPizzaIceCreamEnergy.Text = "Energy: " + ((IEnergizer)this.fastFood.Goods[2]).HealingPoints; this.lblPizzaHamburgerPrice.Text = "Price:" + this.fastFood.Goods[3].Price; this.lblPizzaHamburgerEnergy.Text = "Energy: " + ((IEnergizer)this.fastFood.Goods[3]).HealingPoints; this.lblPizzaPizzaPrice.Text = "Price:" + this.fastFood.Goods[4].Price; this.lblPizzaPizzaEnergy.Text = "Energy: " + ((IEnergizer)this.fastFood.Goods[4]).HealingPoints; this.lblPizzaEnergydrinkPrice.Text = "Price:" + this.fastFood.Goods[5].Price; this.lblPizzaEnergydrinkEnergy.Text = "Energy: " + ((IEnergizer)this.fastFood.Goods[5]).HealingPoints; }
private void BtnPlayground_Click(object sender, EventArgs e) { this.playground = Playground.Instance; this.pnlPlayground.Visible = true; this.lblPlaygroundCash.Text = this.ninja.Cash.ToString(); this.lblPlaygroundPokerPrice.Text = "Price: " + this.playground.Goods[0].Price; this.lblPlaygroundPokerEnergy.Text = "Power: " + ((Recreation)this.playground.Goods[0]).UpgradeTotalEnergy; this.lblPlaygroundVideoPrice.Text = "Price: " + this.playground.Goods[1].Price; this.lblPlaygroundVideoEnergy.Text = "Power: " + ((Recreation)this.playground.Goods[1]).UpgradeTotalEnergy; this.lblPlaygroundBowlingPrice.Text = "Price: " + this.playground.Goods[2].Price; this.lblPlaygroundBowlingEnergy.Text = "Power: " + ((Recreation)this.playground.Goods[2]).UpgradeTotalEnergy; this.lblPlaygroundBilliardsPrice.Text = "Price: " + this.playground.Goods[3].Price; this.lblPlaygroundBilliardsEnergy.Text = "Power: " + ((Recreation)this.playground.Goods[3]).UpgradeTotalEnergy; this.lblPlaygroundDancePrice.Text = "Price: " + this.playground.Goods[4].Price; this.lblPlaygroundDanceEnergy.Text = "Power: " + ((Recreation)this.playground.Goods[4]).UpgradeTotalEnergy; }
private void BtnMall_Click(object sender, EventArgs e) { this.mall = ShoppingMall.Instance; this.pnlMall.Visible = true; this.lblMallCash.Text = this.ninja.Cash.ToString(); this.lblMallShurikanPrice.Text = "Price:" + this.mall.Goods[2].Price; this.lblMallShurikanPower.Text = "Power: " + ((SpecialPower)this.mall.Goods[2]).AttackPower; this.lblMallBaseballPrice.Text = "Price:" + this.mall.Goods[1].Price; this.lblMallBaseballPower.Text = "Power: " + ((SpecialPower)this.mall.Goods[1]).AttackPower; this.lblMallHammerPrice.Text = "Price:" + this.mall.Goods[0].Price; this.lblMallHammerPower.Text = "Power: " + ((SpecialPower)this.mall.Goods[0]).AttackPower; this.lblMallTomahawkPrice.Text = "Price:" + this.mall.Goods[3].Price; this.lblMallTomahawkPower.Text = "Power: " + ((SpecialPower)this.mall.Goods[3]).AttackPower; this.lblMallPoisonDartPrice.Text = "Price:" + this.mall.Goods[4].Price; this.lblMallPoisonDartPower.Text = "Power: " + ((SpecialPower)this.mall.Goods[4]).AttackPower; this.lblMallForumflagPrice.Text = "Price:" + this.mall.Goods[5].Price; this.lblMallForumflagPower.Text = "Power: " + ((SpecialPower)this.mall.Goods[5]).AttackPower; this.lblCSharpBookPrice.Text = "Price:" + this.mall.Goods[7].Price; this.lblCSharpBookPower.Text = "Power: " + ((SpecialPower)this.mall.Goods[7]).AttackPower; this.lblMallHelpFromTeamPrice.Text = "Price:" + this.mall.Goods[8].Price; this.lblHelpFromTeamPower.Text = "Power: " + ((SpecialPower)this.mall.Goods[8]).AttackPower; this.lblHelpFromTrainerPrice.Text = "Price:" + this.mall.Goods[9].Price; this.lblHelpFromTrainerPower.Text = "Power: " + ((SpecialPower)this.mall.Goods[9]).AttackPower; this.lblMallVirusPrice.Text = "Price:" + this.mall.Goods[6].Price; this.lblMallVirusPower.Text = "Power: " + ((SpecialPower)this.mall.Goods[6]).AttackPower; }