コード例 #1
0
        private void MergeSlots(ISlot fromSlot, ISlot toSlot)
        {
            if (toSlot.SpaceLeft(toSlot.StoredItem) == 0)
            {
                return;
            }

            int toSlotSpaceLeft = toSlot.SpaceLeft(toSlot.StoredItem);
            int canMergeNum     = (toSlotSpaceLeft >= fromSlot.SlotCount) ? fromSlot.SlotCount : toSlotSpaceLeft;

            fromSlot.RemoveStackPortion(canMergeNum);
            toSlot.AddStackPortion(toSlot.StoredItem, canMergeNum);
        }