Esempio n. 1
0
        private void UpdateInventoryStrings()
        {
            for (int i = 0; i < (int)inv.Type; i++)
            {
                if (inv[i] is null)
                {
                    InventoryNames[i]   = string.Empty;
                    InventoryAmounts[i] = string.Empty;
                }
                else
                {
                    InventoryNames[i] = inv[i].Type.ToString();

                    IStackable stackableItem = inv[i] as IStackable;
                    if (stackableItem is null)
                    {
                        InventoryAmounts[i] = string.Empty;
                    }
                    else
                    {
                        InventoryAmounts[i] = stackableItem.Amount.ToString();
                    }
                }
            }
        }
        //need to recursively reload the stacks for this "top" level and any nested equation groups basically another recursive required here
        public void RestackForReuse()
        {
            IStackable[] actionItemsInLifoOrder = new IStackable[LIFOActionItemsCopyOfOriginalStack.Count()];

            IStackable[] conditionItemsInLifoOrder = new IStackable[LIFOConditionItemsCopyOfOriginalStack.Count()];

            LIFOActionItemsCopyOfOriginalStack.CopyTo(actionItemsInLifoOrder, 0);
            LIFOConditionItemsCopyOfOriginalStack.CopyTo(conditionItemsInLifoOrder, 0);

            IEnumerable <IStackable> reversedActions    = actionItemsInLifoOrder.Reverse <IStackable>();
            IEnumerable <IStackable> reversedConditions = conditionItemsInLifoOrder.Reverse <IStackable>();

            this.ActionStackableItemsStack.Clear();
            this.ConditionStackableItemsStack.Clear();

            foreach (IStackable actionStackable in reversedActions)
            {
                this.ActionStackableItemsStack.Push(actionStackable);
            }
            foreach (IStackable conditionStackable in reversedConditions)
            {
                if (conditionStackable is EquationGroup)
                {
                    ((EquationGroup)conditionStackable).RestackForReuse();
                }
                this.ConditionStackableItemsStack.Push(conditionStackable);
            }
        }
Esempio n. 3
0
        public virtual void OnUIEditorGUI(BaseItem item)
        {
            Name        = UnityEditor.EditorGUILayout.TextField("Name", Name);
            Description = UnityEditor.EditorGUILayout.TextField("Description", Description);
            Type        = (ItemTypeEnum)UnityEditor.EditorGUILayout.EnumPopup("Type", Type);

            #region IStackable Interface

            IStackable iStackableInterface = item as IStackable;
            if (iStackableInterface != null)
            {
                var indent = UnityEditor.EditorGUI.indentLevel;
                UnityEditor.EditorGUILayout.Space();
                UnityEditor.EditorGUILayout.BeginVertical("Box");
                UnityEngine.GUIStyle  boldFontStyle = UnityEditor.EditorStyles.foldout;
                UnityEngine.FontStyle previousStyle = boldFontStyle.fontStyle;
                boldFontStyle.fontStyle   = UnityEngine.FontStyle.Bold;
                iStackableInterfaceToggle = UnityEditor.EditorGUILayout.Foldout(iStackableInterfaceToggle, "IStackable Interface", boldFontStyle);
                boldFontStyle.fontStyle   = previousStyle;
                if (iStackableInterfaceToggle)
                {
                    UnityEditor.EditorGUI.indentLevel = 1;
                    iStackableInterface.IsStackable   = UnityEditor.EditorGUILayout.Toggle("Is Stackable", iStackableInterface.IsStackable);
                    iStackableInterface.DestroyOnUse  = UnityEditor.EditorGUILayout.Toggle("Destroy on Use", iStackableInterface.DestroyOnUse);
                    iStackableInterface.Quantity      = UnityEditor.EditorGUILayout.IntField("Quantity", iStackableInterface.Quantity);
                    iStackableInterface.StackableMax  = UnityEditor.EditorGUILayout.IntField("Stackable Max", iStackableInterface.StackableMax);
                }
                UnityEditor.EditorGUI.indentLevel = indent;
                UnityEditor.EditorGUILayout.EndVertical();
            }

            #endregion IStackable Interface
        }
Esempio n. 4
0
            public bool PickUp(Item item)
            {
                if (this.Item is null)
                {
                    this.Item = item;

                    return(true);
                }

                IStackable currentItem = this.Item as IStackable;

                if (currentItem == null)
                {
                    return(false);
                }

                if (item.Type != this.Item.Type)
                {
                    return(false);
                }

                IStackable itemAdd = (IStackable)item;

                if (currentItem.Amount + itemAdd.Amount > currentItem.StackMax)
                {
                    return(false);
                }

                currentItem.Add(itemAdd.Amount);
                return(true);
            }
Esempio n. 5
0
        private void UpdateIcon()
        {
            if (_item == null)
            {
                ItemImage.sprite = null;
                ItemCount.text   = "";
                gameObject.SetActive(false);
                _isMouseHovering = false;
            }
            else
            {
                ItemImage.sprite = _item.Icon;

                IStackable stackable = _item as IStackable;
                if (stackable == null)
                {
                    ItemCount.text = "";
                }
                else
                {
                    ItemCount.text = stackable.Count.ToString();
                    if (stackable.IsNoStackLimit == false)
                    {
                        ItemCount.text += "/" + stackable.StackLimit.ToString();
                        ItemCount.color = Color.Lerp(_noStackColor, _fullStackColor, stackable.Count / (float)stackable.StackLimit);
                    }
                    else
                    {
                        ItemCount.color = _fullStackColor;
                    }
                }

                gameObject.SetActive(true);
            }
        }
Esempio n. 6
0
 public void Add(IStackable ist)
 {
     // if(failed)
     //     return;
     Expression.Add(ist);
     if (ist is Operator)
     {
         var op = ist as Operator;
         if (stack.Count >= op.Operands)
         {
             Sequence sq = new Sequence();
             for (var x = 0; x < op.Operands; x++)
             {
                 sq.Add(stack.Pop());
             }
             sq.Add(op);
             stack.Push(sq);
         }
         else
         {
             failed = true;
         }
     }
     else
     {
         stack.Push(ist);
     }
 }
        public void StackItem(Item item, SlotPosition?slotPosition = null)
        {
            Debug.Assert(item is IStackable);
            IStackable stackable = item as IStackable;

            if (slotPosition != null)
            {
                TryStackItem(item, slotPosition.GetValueOrDefault());
            }
            for (int i = 0; i < RowCount && stackable.Count > 0; ++i)
            {
                for (int j = 0; j < InventoryRow.NUMBER_SLOTS && stackable.Count > 0; ++j)
                {
                    TryStackItem(item, new SlotPosition(i, j));
                }
            }
            if (stackable.Count > 0)
            {
                if (IsFull)
                {
                    AddRows();
                }
                _rows[GetAvailableRowIndex()].AddItem(item);
            }

            EventManager.TriggerEvent(EventName.UPDATE_INVENTORY);

            Debug.Log(this.ToString());
        }
Esempio n. 8
0
        private static void StackAction(IStackable obj, List <byte> output)
        {
            var bytes = obj.Stack();

            output.AddRange(Encoding.UTF8.GetBytes(obj.GetType().FullName !+';'));
            output.AddRange(bytes);
        }
Esempio n. 9
0
            public Item Drop()
            {
                if (this.Item is null)
                {
                    return(null);
                }

                Item droppedItem = this.Item;

                IStackable item = this.Item as IStackable;

                if (item != null)
                {
                    if (item.Amount > 1)
                    {
                        item.Remove();
                    }
                    else
                    {
                        this.Item = null;
                    }
                }
                else
                {
                    this.Item = null;
                }

                return(droppedItem);
            }
Esempio n. 10
0
        private void InteractWithItemObject(ItemObject itemObject)
        {
            Debug.Assert(itemObject.Item != null);
            IUsable     usable     = itemObject.Item as IUsable;
            IPickupable pickupable = itemObject.Item as IPickupable;
            IEquipable  equipable  = itemObject.Item as IEquipable;
            IStackable  stackable  = itemObject.Item as IStackable;

            if (usable != null)
            {
                usable.OnUse(_stats, itemObject);
            }
            else if (pickupable != null)
            {
                if (equipable != null && equipable.IsDurable && _equipment.EquipmentTable[equipable.EquipmentType].IsEmpty)
                {
                    equipable.OnEquip(_equipment, _stats);
                }
                else if (stackable != null)
                {
                    stackable.OnStack(_inventory);
                }
                else
                {
                    pickupable.OnPutInInventory(_inventory);
                }
                pickupable.OnRemoveFromGround(itemObject);
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Drops a single item from the inventory. Stackable items are separated in this way.
        /// dropList will carry these items back to the main game engine where they can be placed
        /// around the hero.
        /// </summary>
        /// <param name="item"></param>
        /// <returns>True if item dropped successfully</returns>
        private static bool Drop(InventoryItem item)
        {
            if (item == null)
            {
                return(false);
            }

            InventoryItem itemRemoved  = null;
            bool          dropFromList = true;

            if (item is IStackable && (item as IStackable).Qty > 1)
            {   // To remove only one item from the stack and drop it on the floor
                // leaving the stack in the inventory with adjusted values

                IStackable itemStack = item as IStackable;
                // Preserve old inventoryList Dictionary values on item
                var oldItemSortingValue      = item.SortingValue;
                var oldItemInventoryGameText = inventoryList[oldItemSortingValue];

                // Remove old item from inventoryList (not contents though)
                inventoryList.Remove(oldItemSortingValue);

                // Get the consumed item by removing it from the stack
                itemRemoved = (InventoryItem)((item as IStackable).Remove());

                // Update the GameText object using the new InventoryTitle (incorperates qty change)
                oldItemInventoryGameText.Text = item.InventoryTitle;

                // Insert the updated data back into the Dictionary (because the key is different, we couldn't just change it)
                inventoryList.Add(item.SortingValue, oldItemInventoryGameText);

                dropFromList = false;
            }

            if (dropFromList && inventoryContents.Remove(item.UniqueID))
            {
                // Item is last in the stack, or is not stackable so drop it from the list
                inventoryList.Remove(item.SortingValue);
                weight -= item.InventoryWeight;
                dropList.Add(item);
                return(true);
            }
            else if (!dropFromList && itemRemoved != null)
            {
                // Item is not last from stack, but still need to drop an item on the floor
                weight -= itemRemoved.InventoryWeight;
                dropList.Add(itemRemoved);
            }
            else
            {
                return(false);  // Was not able to drop item from list
            }
            UpdateCurrentItem();
            return(true); // Drop was successful
        }
Esempio n. 12
0
        public virtual void UnStack(IStackable newParent)
        {
            if ((object)newParent != this)
            {
                StackedCard.OnChangedParent -= UnStack;
                StackedCard = null;

                GetComponent <BoxCollider2D>().enabled = true;
                OnBecameEmpty?.Invoke();
            }
        }
 public void RemoveStackableFromInventory(IStackable stackable, int amount)
 {
     if (stackable.Quantity <= amount)
     {
         RemoveItemFromInventory(stackable.Item);
     }
     else
     {
         stackable.Quantity -= amount;
     }
 }
        public void SplitItem(SlotPosition slotPosition, int splitCount)
        {
            IStackable stackable = GetItem(slotPosition) as IStackable;

            Debug.Assert(stackable != null);
            stackable.Count -= splitCount;
            UpdateCapacity();

            EventManager.TriggerEvent(EventName.UPDATE_INVENTORY);

            Debug.Log(this.ToString());
        }
Esempio n. 15
0
        private void Awake()
        {
            IStackable stackable = newItem as IStackable;

            if (stackable != null)
            {
                stackable.stackCount = 1;
            }
            isCoroutineRunning = false;

            inventory = new Inventory(inventorySize);
        }
        private void TryStackItem(Item item, SlotPosition slotPosition)
        {
            Item       itemInventory      = GetItem(slotPosition);
            IStackable stackableInventory = itemInventory as IStackable;
            IStackable stackable          = item as IStackable;

            if (stackableInventory != null && itemInventory.Name == item.Name)
            {
                int availableStackCount = Mathf.Min(stackable.Count, stackableInventory.StackLimit - stackableInventory.Count);
                stackableInventory.Count += availableStackCount;
                stackable.Count          -= availableStackCount;
            }
        }
Esempio n. 17
0
        public void Open(ItemIcon itemIcon)
        {
            Debug.Assert(itemIcon.Item is IStackable);
            _itemIcon  = itemIcon;
            _stackable = (IStackable)_itemIcon.Item;

            StackCountSlider.minValue = 1;
            StackCountSlider.maxValue = _stackable.Count;

            SplitCount = _stackable.Count;

            gameObject.SetActive(true);
        }
Esempio n. 18
0
        private void SplitItem(object[] eventParams)
        {
            Debug.Assert(eventParams.Length == 1 && eventParams[0] is ItemIcon);
            ItemIcon   itemIcon  = (ItemIcon)eventParams[0];
            IStackable stackable = itemIcon.Item as IStackable;

            if (stackable == null)
            {
                Debug.Log("Not splitable");
                return;
            }
            EventManager.TriggerEvent(EventName.OPEN_SPLIT_SCREEN, eventParams);
        }
Esempio n. 19
0
        public void UnStack(IStackable newParent) //Процедура отвязки ребенка от родителя и наоборот
        {
            if ((object)newParent != this)
            {
                OnPickedUp -= StackedCard.PickUp;
                OnPutDown  -= StackedCard.PutDown;

                StackedCard.OnChangedParent -= UnStack;
                StackedCard = null;

                if (Hidden)
                {
                    Open();
                }
            }
        }
Esempio n. 20
0
        private void ReturnAirItem(object[] eventParams)
        {
            if (_airItem.IsEmpty)
            {
                return;
            }

            SlotPosition originalPosition = _airItem.OriginalPosition;
            Item         itemAir          = _airItem.Item;
            IPickupable  pickupableAir    = itemAir as IPickupable;
            IEquipable   equipableAir     = itemAir as IEquipable;
            IStackable   stackableAir     = itemAir as IStackable;

            pickupableAir.OnRemoveFromAir(_airItem);

            if (originalPosition.RowIndex == EquipmentSlot.EQUIPMENT_SLOT_ROW_INDEX)
            {
                Equipment.EquipmentType equipmentType = (Equipment.EquipmentType)originalPosition.SlotIndex;

                if (_equipment.EquipmentTable[equipmentType].IsEmpty)
                {
                    equipableAir.OnEquip(_equipment, _stats);
                }
                else
                {
                    pickupableAir.OnPutInInventory(_inventory);
                }
            }
            else
            {
                if (stackableAir != null)
                {
                    stackableAir.OnStack(_inventory, originalPosition);
                }
                else if (_inventory.IsItemEmpty(originalPosition))
                {
                    pickupableAir.OnPutInInventory(_inventory, originalPosition);
                }
                else
                {
                    pickupableAir.OnPutInInventory(_inventory);
                }
            }
        }
    void Initialize()
    {
        // robot
        //var origin = new[] { 500.900f, 678.200f, 192.100f, -0.6991f, 0.0012f, 0.0028f, 0.7150f };
        var origin = new[] { 555.500f, 644.000f, 194.400f, 0.69813f, -0.00181f, 0.00000f, -0.71597f }; //This was copied from RobotStudio's updated AutoPickAndPlace

        _robot = Robot.IRB1600(origin);

        // materials
        _tileMaterial  = Resources.Load <Material>("TileMaterial");
        _robotMaterial = Resources.Load <Material>("RobotMaterial");
        _pickMaterial  = Resources.Load <Material>("PickMaterial");
        _placeMaterial = Resources.Load <Material>("PlaceMaterial");

        // stackable
        var stackableType = GetStackables().ElementAt(_stackableIndex);

        _stackable = Activator.CreateInstance(stackableType, _mode) as IStackable;
    }
        public void ConsumeItem(SlotPosition slotPosition)
        {
            Item        item       = GetItem(slotPosition);
            IPickupable pickupable = item as IPickupable;
            IStackable  stackable  = item as IStackable;

            if (stackable != null)
            {
                stackable.Count -= 1;
            }
            if (stackable == null || stackable.Count == 0)
            {
                pickupable.OnRemoveFromInventory(this, slotPosition);
            }
            UpdateCapacity();

            EventManager.TriggerEvent(EventName.UPDATE_INVENTORY);

            Debug.Log(this.ToString());
        }
    void Initialize()
    {
        _selectedMaterial = new Material(_material)
        {
            color = Color.red
        };

        switch (_team)
        {
        case Team.Debug: { _stackable = new StackingVisionSimple(_mode); break; }

        case Team.TeamA: { _stackable = new StackingFillAndBuild(_mode); break; }

        case Team.TeamBBJT: { _stackable = new StackingTeamBBJT(_mode); break; }

        case Team.TeamC: { _stackable = new StackingTeamC(_mode); break; }

        default:
            throw new ArgumentOutOfRangeException("Team not found.");
        }
    }
Esempio n. 24
0
        /// <summary>
        /// получить первую незполненную ячейку
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        protected int GetFirstNotFull(IStackable item)
        {
            int ret = -1;

            for (int i = 0; i < items.Length; i++)
            {
                if (items[i] != null)
                {
                    //предмет найден
                    if (items[i].GetType() == item.GetType())
                    {
                        //предмета не максимальное количество
                        if ((items[i] as IStackable).StackSize > items[i].Count)
                        {
                            return(i);
                        }
                    }
                }
            }
            return(ret);
        }
Esempio n. 25
0
        private void GetPlace() //Процедура определения новой позиции карты либо оставление ее на прежнем месте
        {
            ContactFilter2D filter = new ContactFilter2D();

            filter.NoFilter();
            List <Collider2D> colliders = new List <Collider2D>();

            Physics2D.OverlapBox(transform.position, transform.localScale, 0, filter, colliders);

            float      distance  = 10f;
            IStackable stackable = null;

            foreach (var collider in colliders)
            {
                if (collider.transform != transform)
                {
                    if (distance > (collider.transform.position - transform.position).magnitude)
                    {
                        if (collider.TryGetComponent(out IStackable stackableTemp))
                        {
                            stackable = stackableTemp;
                        }

                        distance = (collider.transform.position - transform.position).magnitude;
                    }
                }
            }

            if (stackable != null)
            {
                if (stackable.Stack(this))
                {
                    OnChangedParent?.Invoke(stackable);
                    Position = transform.localPosition;
                    return;
                }
            }

            transform.localPosition = Position;
        }
Esempio n. 26
0
        private void SplitStackableItem(object[] eventParams)
        {
            Debug.Assert(eventParams.Length == 2 && eventParams[0] is ItemIcon && eventParams[1] is int);
            ItemIcon     itemIcon     = (ItemIcon)eventParams[0];
            int          splitCount   = (int)eventParams[1];
            Item         item         = itemIcon.Item;
            SlotPosition slotPosition = itemIcon.Position;
            IStackable   stackable    = (IStackable)item;

            if (splitCount == stackable.Count)
            {
                IPickupable pickupable = (IPickupable)item;
                pickupable.OnRemoveFromInventory(_inventory, slotPosition);
                pickupable.OnPutInAir(_airItem, slotPosition);
            }
            else
            {
                Item splitItem = item.Copy();
                ((IStackable)splitItem).Count = splitCount;
                ((IPickupable)splitItem).OnPutInAir(_airItem, slotPosition);
                stackable.OnSplit(_inventory, slotPosition, splitCount);
            }
        }
Esempio n. 27
0
        public void SpawnItemNextPlayer(object[] eventParams)
        {
            Debug.Assert(eventParams.Length == 2 && eventParams[0] is Vector3 && eventParams[1] is Item);
            Vector3    playerPosition = (Vector3)eventParams[0];
            Item       item           = (Item)eventParams[1];
            IEquipable equipable      = item as IEquipable;
            IStackable stackable      = item as IStackable;

            int itemCount = (stackable == null) ? 1 : stackable.Count;

            for (int i = 0; i < itemCount; ++i)
            {
                Vector3    itemPosition = playerPosition + (Vector3)Random.insideUnitCircle.normalized * DISTANCE_DROPPED_ITEM;
                GameObject itemObject   = Instantiate(ItemPrefab, itemPosition, Quaternion.identity, ItemParent);
                itemObject.GetComponent <ItemObject>().Item = ItemDB.GetItem(item.Name);
                if (equipable != null)
                {
                    IEquipable equipableGround = itemObject.GetComponent <ItemObject>().Item as IEquipable;
                    equipableGround.CurDurability = equipable.CurDurability;
                    equipableGround.MaxDurability = equipable.MaxDurability;
                }
            }
        }
Esempio n. 28
0
 public void Add(IStackable stackable) => _stackables.Add(stackable);
Esempio n. 29
0
 public void Stack(IStackable otherStack) => StackableExtension.Stack(this, otherStack);
Esempio n. 30
0
        public void OnDrop(PointerEventData eventData)
        {
            if (UIItem.DraggedItem == null)
            {
                return;
            }
            if (UIItem.DraggedItem.Item == null)
            {
                return;
            }

            if (HaveItem == false)
            {
                AddUIItem(UIItem.DraggedItem);

                if (IsCrossInventory)
                {
                    Debug.Log("EMPTY CROSS PANEL");

                    // Remove item from inventory that its coming from
                    EventMessenger.Instance.Raise(new EventRemoveItemFromInventory(UIItem.DraggedItemStartSlot.InventoryUUID, UIItem.DraggedItem.Item, false));

                    UIItem.DraggedItem.Item.BaseData.InventoryUUID = InventoryUUID;

                    // IMPORTANT SET THE INVENTORY
                    // IMPORTANT SET THE INVENTORY
                    //this.ThisUIItem.Item.Inventory = ThisUIItem.Item.Inventory;

                    // Add Item to the new inventory
                    EventMessenger.Instance.Raise(new EventAddItemToInventory(InventoryUUID, UIItem.DraggedItem.Item, false));

                    this.ThisUIItem.transform.SetParent(UIItem.DraggedItemStartSlot.transform);
                }
                else
                {
                    Debug.Log("EMPTY SAME PANEL");
                    // IMPORTANT SET THE INVENTORY
                    // IMPORTANT SET THE INVENTORY
                    //UIItem.DraggedItem.Item.Inventory = ThisUIItem.Item.Inventory;
                    this.ThisUIItem.transform.SetParent(UIItem.DraggedItemStartSlot.transform);
                }
            }
            else
            {
                // If the item in the slot is stackable check here too and dont return to original position
                // if we have an item in the slot where this slot is being dragged return to original position

                // Set the start slot ItemContainer to this slot item container
                UIItem.DraggedItemStartSlot.ThisUIItem = this.ThisUIItem;

                // Here I can change where to check for the stackable interface
                // could be in the item itself (ItemContainer.Item)
                // or it could be in the data (ItemContainer.Item.BaseData)
                IStackable stackInterface = ThisUIItem.Item as IStackable;
                if (stackInterface != null && stackInterface.IsStackable)
                {
                    StackResult stackResult = stackInterface.Stack(UIItem.DraggedItem.Item as BaseItem);
                    if (stackResult != null)
                    {
                        if ((stackResult.item.BaseData as IStackableData).Quantity <= 0)
                        {
                            //Debug.Log("ITEMS WERE STACKED RESULT QUANTITY IS <= 0");

                            // Set the slot ItemContainer that the item is being dragged from to null
                            UIItem.DraggedItemStartSlot.ThisUIItem = ThisUIItem;

                            ThisUIItem.UpdateQuantity();
                            UIItem.DraggedItem.UpdateQuantity();

                            if (IsCrossInventory)
                            {
                                Debug.Log("STACK WITH DESTROY CROSS PANEL");
                                // --> EventMessenger.Instance.Raise(new EventUIInventoryItemChanged(InventoryPanel.Inventory.UniqueUUID, InventoryItem.Item.BaseData));
                            }
                            else
                            {
                                Debug.Log("STACK WITH DESTROY SAME PANEL");

                                UIItem.DraggedItem.transform.SetParent(UIItem.DraggedItemStartSlot.transform);
                                // --> EventMessenger.Instance.Raise(new EventUIInventoryItemChanged(InventoryPanel.Inventory.UniqueUUID, InventoryItem.Item.BaseData));
                            }
                        }
                        else
                        {
                            Debug.Log("ITEMS WERE STACKED BOTH ITEMS STILL HAVE QUANTITY");
                            // right item (dragged item) exchanged the quantities but
                            // it still have quantity put it back where it came from
                            UIItem.DraggedItem.transform.SetParent(UIItem.DraggedItemStartSlot.transform);

                            // update the left (item in this slot) item quantity
                            ThisUIItem.UpdateQuantity();

                            // update right item (dragged item) quantity
                            UIItem.DraggedItem.UpdateQuantity();
                        }
                    }
                    else
                    {
                        // stack failed for some reason maybe the items were not stackable
                        // or the left item (item in the slot) was full. Do a switch;
                        Debug.Log("STACK IS NULL DO A SWITCH ON THE ITEMS");
                        SwapNonStackable();
                    }
                }
                else
                {
                    Debug.LogError("Item [" + ThisUIItem.Item.BaseData.Name + "] Does not implement the IStackable interface. Or the item is not marked as stackable " + "[" + ThisUIItem.GetType() + "]");
                    //Debug.Log("ITEM COREDATA IS MARKED AS NON STACKABLE SWAP ITEMS");
                    SwapNonStackable();
                }

                ThisUIItem.UpdateSlotInfo();

                // When stacking an item the inventory item of tmpItemStartSlot will
                // be null. Lets check that and only update the slot info if its not null
                if (UIItem.DraggedItemStartSlot.ThisUIItem != null)
                {
                    UIItem.DraggedItemStartSlot.ThisUIItem.UpdateSlotInfo();
                }
            }
        }