예제 #1
0
    public void ButtonEnter(NodeButtonBehavior button, PointerEventData data)
    {
        lastEnter = button;
        var node = board.GetOffsetNode(button.XIndex, button.YIndex);

        if (node != null && button != downButton)
        {
            if (downButton != null && node.CanReceive)
            {
                if (AreNextToo(downButton, button))
                {
                    lastEnter.Hover();
                }
            }
            else if (node.Affiliation == BoardNodeAffiliation.Player && node.CanSend)
            {
                lastEnter.Hover();
            }
        }
    }
예제 #2
0
    public void OnPointerUp(PointerEventData eventData)
    {
        if (downButton != null)
        {
            if (lastEnter != null)
            {
                lastEnter.Unhover();

                if (downButton != lastEnter)
                {
                    var node = board.GetOffsetNode(lastEnter.XIndex, lastEnter.YIndex);
                    if (node != null)
                    {
                        if (AreNextToo(lastEnter, downButton))
                        {
                            if (NodeSwipeOccurred != null)
                            {
                                NodeSwipeOccurred(downButton, lastEnter, MathUtils.ClosestCardinal(eventData.position - pointDown));
                            }
                        }
                    }
                    else
                    {
                        //RaiseSwipeOccurred(eventData);
                    }
                    downButton.Deselect();
                }
                else
                {
                    downButton.Hover();
                    lastEnter = downButton;
                    //RaiseSwipeOccurred(eventData);
                }
            }
            else
            {
                downButton.Deselect();
                //RaiseSwipeOccurred(eventData);
            }
        }
        else
        {
            RaiseSwipeOccurred(eventData);
        }

        downButton = null;
    }