Ejemplo n.º 1
0
    public void ExchangeWithSlotOnDrop(ItemSlotDropHandler destinationSlot)
    {
        // this is an item being dragged slot
        // get item drag handler in destination slot
        InventoryItemDragHandler destinationItemDragHandler = destinationSlot.GetComponentInChildren <InventoryItemDragHandler>();

        // move item being dragged (source) into destination slot
        InventoryItemDragHandler.itemBeingDragged.SetParent(destinationSlot);
        // move destination drag handler into this slot
        destinationItemDragHandler.SetParent(this);
        // raise events
        itemHasBeenDroppedIntoTheItemSlotEvent.Raise(this);
        itemHasBeenDroppedIntoTheItemSlotEvent.Raise(destinationSlot);
    }
Ejemplo n.º 2
0
 public void PutItemIntoSlot(InventoryItemDragHandler itemBeingDragged)
 {
     // move item being dragged UI into this slot
     itemBeingDragged.SetParent(this);
     //// reset UI position to 0/0/0/0
     //itemBeingDragged.transform.gameObject.GetComponent<RectTransform>().offsetMin = new Vector2(0, 0); // [ left - bottom ]
     //itemBeingDragged.transform.gameObject.GetComponent<RectTransform>().offsetMax = new Vector2(0, 0); // [ right - top ]
     //// verify if we are in edit party screen
     //if (transform.root.Find("MiscUI").GetComponentInChildren<EditPartyScreen>(false) != null)
     //{
     //    // move InventoryItem to the new parent object
     //    itemBeingDragged.LInventoryItem.transform.SetParent(GetParentObjectTransform());
     //}
     //// verify if we are in battle screen
     //else if (transform.root.Find("MiscUI").GetComponentInChildren<BattleScreen>(false) != null)
     //{
     //    // do not move InventoryItem to the new parent object, because this is item equipped on a hero
     //}
     //else
     //{
     //    Debug.LogError("Unknonw active screen");
     //}
     //Debug.LogError("remove below");
     // verify if this is hero eqiupment slot
     //if (Mode.HeroEquipment == slotMode)
     //{
     //    //itemHasBeenDroppedIntoEquipmentSlotEvent.Raise(this);
     //}
     //else
     //{
     //    // Mode.PartyInventory
     //    itemHasBeenDroppedIntoInventorySlotEvent.Raise(this);
     //}
     // raise event
     itemHasBeenDroppedIntoTheItemSlotEvent.Raise(this);
 }