Ejemplo n.º 1
0
    public override void OnDrop(PointerEventData eventData)
    {
        if (CanDrop)
        {
            DragEquipment drag = eventData.pointerDrag.GetComponent <DragEquipment>();

            if (drag != null && drag.CanDrag)
            {
                ADropToMe oldParentDrop = drag.OldParent.GetComponent <ADropToMe>();

                //если перетащили откуда либо на пол
                if (!(oldParentDrop is DropToGround))
                {
                    //если передащили на заполненную клетку
                    EquipmentStack stack = new EquipmentStack(drag.EquipStack.EquipmentMainProperties, drag.EquipStack.EquipmentStats, drag.EquipStack.Count);
                    if (oldParentDrop.CanGetFromThisIventory(drag.EquipStack, null))
                    {
                        if (AddToThisInventory(drag.EquipStack))
                        {
                            oldParentDrop.RemoveFromThisInventory(drag.EquipStack);
                        }
                    }

                    Destroy(drag.gameObject);
                    RefreshUI();
                }
            }
        }
    }
    override public void OnDrop(PointerEventData eventData)
    {
        if (CanDrop)
        {
            var drag = eventData.pointerDrag.GetComponent <DragConsumable>();

            if (drag != null && drag.CanDrag)
            {
                ADropToMe oldParentDrop = drag.OldParent.GetComponent <ADropToMe>();

                //если перетащили откуда либо кроме самого магазина
                if (!(oldParentDrop is DropToConsumableMarket))
                {
                    if (oldParentDrop.CanGetFromThisIventory(drag.ConsumableStack, null))
                    {
                        if (AddToThisInventory(drag.ConsumableStack))
                        {
                            oldParentDrop.RemoveFromThisInventory(drag.ConsumableStack);
                        }
                    }

                    Destroy(drag.gameObject);
                    RefreshUI();
                }
            }
        }
    }
Ejemplo n.º 3
0
    override public void OnDrop(PointerEventData eventData)
    {
        if (CanDrop)
        {
            DragEquipment drag = eventData.pointerDrag.GetComponent <DragEquipment>();

            if (drag != null && drag.CanDrag)
            {
                ADropToMe oldParentDrop = drag.OldParent.GetComponent <ADropToMe>();

                //если перетащили откуда либо кроме самого магазина
                if (!(oldParentDrop is DropToEquipmentMarket) && !(oldParentDrop is DropToConsumableMarket))
                {
                    EquipmentStack stack = new EquipmentStack(drag.EquipStack.EquipmentMainProperties, drag.EquipStack.EquipmentStats, drag.EquipStack.Count);
                    if (oldParentDrop.CanGetFromThisIventory(stack, null))
                    {
                        if (AddToThisInventory(stack))
                        {
                            oldParentDrop.RemoveFromThisInventory(stack);
                        }
                    }

                    Destroy(drag.gameObject);
                    RefreshUI();
                }
            }
        }
    }