コード例 #1
0
        public override void Execute(float d)
        {
            if (Input.GetMouseButton(0))
            {
                PointerEventData pointerData = new PointerEventData(EventSystem.current)
                {
                    position = Input.mousePosition
                };

                List <RaycastResult> results = new List <RaycastResult>();

                EventSystem.current.RaycastAll(pointerData, results);

                IClickable c = null;

                foreach (RaycastResult r in results)
                {
                    c = r.gameObject.GetComponentInParent <IClickable>();
                    if (c != null)
                    {
                        c.OnHighlight();
                        break;
                    }
                    else
                    {
                        Debug.Log(r.gameObject.name);
                    }
                }
            }
        }
コード例 #2
0
        public override void Execute(float d)
        {
            List <RaycastResult> results = Settings.GetUIObjects();

            foreach (RaycastResult r in results)
            {
                IClickable c = r.gameObject.GetComponentInParent <IClickable>();
                if (c != null)
                {
                    c.OnHighlight();
                    break;
                }
            }
        }
コード例 #3
0
        public void onMouseEvent(IClickable c, Player player)
        {
            if (dragCard != null && !Input.GetMouseButton(0))
            {
                dropDragCard();
            }

            if (curBoardOverlay == BoardOverlayType.detail)
            {
                if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.J))
                {
                    curBoardOverlay = BoardOverlayType.none;
                    cardDetail.gameObject.SetActive(false);
                }
                return;
            }

            if (c != null && curBoardOverlay == BoardOverlayType.none)
            {
                //card detail view
                if (Input.GetKeyDown(KeyCode.J) && (c is CardInstance) && c != null)
                {
                    cardDetail.loadCard(((CardInstance)c).card, ((CardInstance)c).owner);
                    cardDetail.gameObject.SetActive(true);
                    curBoardOverlay = BoardOverlayType.detail;
                    return;
                }

                //highlight
                if (!Input.GetMouseButton(0))
                {
                    c.OnHighlight();
                }

                //drag
                if (Input.GetMouseButtonDown(0))
                {
                    c.OnLeftClick();
                    if ((c is CardInstance) && ((CardInstance)c).owner == player && gameManager.isPlayerTurn(player))
                    {
                        setDragCard((CardInstance)c);
                    }
                    return;
                }
                return;
            }
        }
コード例 #4
0
    public override void Execute(float d)
    {
        var results = Settings.GetUIObjects();

        IClickable clickable = null;

        foreach (RaycastResult result in results)
        {
            clickable = result.gameObject.GetComponentInParent <IClickable>();

            if (clickable != null)
            {
                clickable.OnHighlight();
                break;
            }
        }
    }
コード例 #5
0
    public override void Execute(float d)
    {
        PointerEventData pointerData = new PointerEventData(EventSystem.current)
        {
            position = Input.mousePosition
        };

        List <RaycastResult> results = new List <RaycastResult>();

        EventSystem.current.RaycastAll(pointerData, results);

        IClickable c = null;

        foreach (RaycastResult r in results)
        {
            c = r.gameObject.GetComponentInParent <IClickable>();
            if (c != lastClickable && lastClickable != null && c != null)
            {
                lastClickable.OnDehighlight();
            }
            if (c != null)
            {
                lastClickable = c;
                c.OnHighlight();
                break;
            }
            else
            {
                if (lastClickable != null)
                {
                    lastClickable.OnDehighlight();
                    lastClickable = null;
                }
                //Runs for any object that is not clickable
            }
        }
    }