private void StopDraggingFromChest(Vector2 stopPosition) { _draggableItem.Texture = null; var chestSlot = GetEmptySlotAtPosition(stopPosition, _chestContents); if (chestSlot != null) { var newSlotIndex = chestSlot.GetIndex(); _chestInstance.contents[newSlotIndex] = _heldChestItemInstance.ItemName; var slotIndex = _heldChestItemInstance.GetIndex(); _chestInstance.contents[slotIndex] = string.Empty; UpdateChestUI(); } else { var inventorySlot = GetEmptySlotAtPosition(stopPosition, _inventoryContents); if (inventorySlot != null) { _playerInstance.Inventory.Add(_heldChestItemInstance.ItemName); UpdateInventoryUI(); var slotIndex = _heldChestItemInstance.GetIndex(); _chestInstance.contents[slotIndex] = string.Empty; UpdateChestUI(); } } _heldChestItemInstance.itemCenter.Visible = true; _heldChestItemInstance = null; }
private void OnChestItem_LeftClicked(ChestItems chestItemInstance) { _heldChestItemInstance = chestItemInstance; _heldChestItemInstance.itemCenter.Visible = false; _draggableItem.Texture = Utility.GetInventoryItemResource (_heldChestItemInstance.ItemName); }
private void StopDraggingFromInventory(Vector2 stopPosition) { _draggableItem.Texture = null; var chestSlot = GetEmptySlotAtPosition(stopPosition, _chestContents); if (chestSlot != null) { var newSlotIndex = chestSlot.GetIndex(); _chestInstance.contents[newSlotIndex] = _heldInventoryItemInstance.ItemName; UpdateChestUI(); _playerInstance.Inventory.Remove(_heldInventoryItemInstance.ItemName); UpdateInventoryUI(); } _heldInventoryItemInstance.itemCenter.Visible = true; _heldInventoryItemInstance = null; }