Exemplo n.º 1
0
        public void Setup(PlayerView player)
        {
            _player = player;

            for (var i = 0; i < _inventorySlotViews.Count; i++)
            {
                _inventorySlotViews[i].Setup(this, i);
            }

            InputManager.Instance.RegisterAction(Command.ScrollInventoryForward, this, ScrollInventoryForward);
            InputManager.Instance.RegisterAction(Command.ScrollInventoryBackward, this, ScrollInventoryBackward);

            InputManager.Instance.RegisterAction(Command.SelectItemInSlotView0, this,
                                                 () => { PutOrTakeItemFromSlotView(0); });
            InputManager.Instance.RegisterAction(Command.SelectItemInSlotView1, this,
                                                 () => { PutOrTakeItemFromSlotView(1); });
            InputManager.Instance.RegisterAction(Command.SelectItemInSlotView2, this,
                                                 () => { PutOrTakeItemFromSlotView(2); });

            //todo remove
            var item1 = new ItemView(_itemConfig.GetItemDatum("KEY"));
            var item2 = new ItemView(_itemConfig.GetItemDatum("SWORD"));
            var item3 = new ItemView(_itemConfig.GetItemDatum("ARMOR"));
            var item4 = new ItemView(_itemConfig.GetItemDatum("BOW"));
            var item5 = new ItemView(_itemConfig.GetItemDatum("LOCKPICK"));

            SetItemInInventorySlot(1, item1);
            SetItemInInventorySlot(2, item2);
            SetItemInInventorySlot(5, item3);
            SetItemInInventorySlot(10, item4);
            SetItemInInventorySlot(18, item5);
        }