示例#1
0
 void IBeginDragHandler.OnBeginDrag(PointerEventData eventData)
 {
     commandBeingDragged = GetComponent <TopCommand> ();
     commandBeingDragged.GetComponent <CanvasGroup> ().blocksRaycasts = false;
     AttackInstructionPanel.outsidePanel = false;
     originalSlotHost = commandBeingDragged.GetComponentInParent <AttackTopCommandSlot> ();
 }
示例#2
0
 void IEndDragHandler.OnEndDrag(PointerEventData eventData)
 {
     if (AttackInstructionPanel.outsidePanel)
     {
         originalSlotHost.destructCommand();
     }
     else if (commandBeingDragged.GetComponentInParent <AttackTopCommandSlot> () != originalSlotHost)
     {
         TopCommand newC = Instantiate(Resources.Load("NoActionPrefab", typeof(TopCommand))) as TopCommand;
         newC.transform.SetParent(originalSlotHost.transform);
         commandBeingDragged.GetComponent <CanvasGroup> ().blocksRaycasts = true;
     }
     else
     {
         commandBeingDragged.transform.localPosition = Vector2.zero;
         commandBeingDragged.GetComponent <CanvasGroup> ().blocksRaycasts = true;
     }
     commandBeingDragged = null;
     originalSlotHost    = null;
 }