Ejemplo n.º 1
0
        //Here we processing event when click on item
        public void OnPointerClick(PointerEventData eventData)
        {
            //Right click to drop
            if (eventData.clickCount > 1 && eventData.button == PointerEventData.InputButton.Right)
            {
                inventory.DropItem(this);
                return;
            }

            //Substract stack event
            if (eventData.clickCount > 1 && eventData.button == PointerEventData.InputButton.Left && item.stackable && item.stackSize > 1)
            {
                if (inventory.CheckFreeSpaceForAllSlots(item.width, item.height))
                {
                    inventory.SubstractStack(this);
                }
            }

            //Double click to swap item if it's not stackable
            if (eventData.clickCount > 1 && eventData.button == PointerEventData.InputButton.Left && !item.stackable)
            {
                print("Swap items");

                if (equipmentPanel == null)
                {
                    inventory.SwapEquipment(this, false);
                }
            }
        }
Ejemplo n.º 2
0
        //Here we processing event when click on item
        public void OnPointerClick(PointerEventData eventData)
        {
            //Right click to drop
            if (eventData.clickCount > 1 && eventData.button == PointerEventData.InputButton.Right)
            {
                inventory.DropItem(this);
                return;
            }

            //Substract stack event
            if (eventData.clickCount > 1 && eventData.button == PointerEventData.InputButton.Left && item.stackSize > 1)
            {
                if (inventory.CheckFreeSpaceForAllSlots(item.width, item.height))
                {
                    inventory.SubstractStack(this);
                }
            }
        }