private void UpdateSlots() { foreach (KeyValuePair <Item.ItemType, GUILabeledSlotArray> kvPair in subInvSlots) { kvPair.Value.OverrideFromInventory(subInventories[kvPair.Key]); } handSlot.AssignItemStack(player.ItemInHand); }
public override void OnLeftPress() { ItemStack exchangeStack = exchangeSlot.GetCurItemStack(); ItemStack slotStack = GetCurItemStack(); if (quickMoveItem != null && slotStack != null && Input.IsActionPressed("quick_move_items")) { if (quickMoveItem(slotStack)) { ClearItemStack(); invUpdate?.Invoke(); } return; } if (exchangeStack != null && !Item.CompatibleWith(exchangeStack.Item.IType, this.GetItemType())) { return; } if (slotStack != null && !Item.CompatibleWith(slotStack.Item.IType, exchangeSlot.GetItemType())) { return; } // TODO: think of a better conditional if (exchangeStack != null && slotStack != null && slotStack.Item.Stackable && slotStack.Item.Id == exchangeStack.Item.Id) { slotStack.ChangeQuantity(exchangeStack.Count); exchangeSlot.ClearItemStack(); } else { exchangeSlot.AssignItemStack(slotStack); this.AssignItemStack(exchangeStack); } }