Пример #1
0
 public MainMenu(Game game, DGetItem<Item> itemGenerator, MonsterRepository monsterRepository)
 {
     InitializeComponent();
     this.game = game;
     this.itemGenerator = itemGenerator;
     this.monsterRepository = monsterRepository;
 }
Пример #2
0
 public GameMenu(Game game, DGetItem<Item> itemGenerator, Player player, MonsterRepository monsterRepository)
 {
     InitializeComponent();
     this.game = game;
     this.itemGenerator = itemGenerator;
     this.player = player;
     this.monsterRepository = monsterRepository;
     this.UpdateText();
 }
Пример #3
0
 public static DGetItem<Item> GetItem(DGetItemStat getStat, IDictionary<string, DGetItem<Item>> getItemDictionary, DGetItem<Item> getDefaultItem)
 {
     return itemid =>
     {
         var type = getStat(itemid, "type");
         DGetItem<Item> getItem;
         if (getItemDictionary.TryGetValue(type, out getItem))
         {
             return getItem(itemid);
         }
         else
         {
             return getDefaultItem(itemid);
         }
     };
 }
Пример #4
0
        public ShopMenu(Player player, DGetItem<Item> itemGenerator)
        {
            InitializeComponent();
            shop = new Shop(player, itemGenerator);

            this.ShopInventoryPanel.RowCount = shop.Stock.Count;

            for (int i = 0; i < shop.Stock.Count; i++)
            {
                shopInventoryPriceLabel.Add(new Label());
                setupNewInventoryPriceLabel(i, this.shopInventoryPriceLabel, this.ShopInventoryPanel, shop.Stock);

                shopInventoryPicture.Add(new PictureBox());
                setupNewInventoryPicture(i, this.shopInventoryPicture, this.ShopInventoryPanel, shop.Stock, Action.Buy);

                shopInventoryLabel.Add(new Label());
                setupNewInventoryLabel(i, this.shopInventoryLabel, this.ShopInventoryPanel, shop.Stock);
            }

            this.showPlayerInventory();
        }
Пример #5
0
 public Game(DGetItem<Item> itemGenerator)
 {
     this.getItem = itemGenerator;
 }