示例#1
0
        private void btnViewGladiator_click(object sender, EventArgs e)
        {
            string        gladName = (string)dgvUI.CurrentCell.Value;
            GladiatorView gv       = new GladiatorView(Gladiator.PickGladiatorFromDGV(MyGladList, gladName), MyGladList, Player.Inventory);

            gv.Show();
        }
示例#2
0
        private void buttonPuchase_Click(object sender, EventArgs e)
        {
            switch (shopType)
            {
            case ShopType.Gladiator:
            {
                try
                {
                    rtbUI.Text += Environment.NewLine +
                                  (World.GladiatorShopByID(Player.CurrentTown.GladiatorShop.ID).PurchaseGladiator
                                       (Gladiator.PickGladiatorFromDGV(MyGladList, (string)dgvUI.CurrentCell.Value)))
                                  + Environment.NewLine;
                    GoldUpdateAndVisible();
                    dgvUI.Rows.Clear();
                    foreach (Gladiator gladiator in Player.CurrentTown.GladiatorShop.Stock)
                    {
                        dgvUI.Rows.Add(gladiator.Name, gladiator.Value);
                    }
                }
                catch
                {
                    return;
                }
                break;
            }

            case ShopType.Item:
            {
                Item selectedItem = Item.PickItemFromDGV((string)dgvUI.CurrentCell.Value);
                if (ItemShop.ItemPurchaseSuccessful(selectedItem))
                {
                    GoldUpdateAndVisible();
                    rtbUI.Text += "Item bought: " + selectedItem.Name + " for " + selectedItem.Value.ToString() + " gold." + Environment.NewLine;
                }
                else
                {
                    rtbUI.Text += "You don't have enough gold to buy this." + Environment.NewLine;
                }


                break;
            }
            }
        }