Exemple #1
0
        private void OnMouseUp()
        {
            PointerEventData ped = new PointerEventData(EventSystem.current);

            ped.position = Input.mousePosition;

            bool      brelatedUIHit = false;
            Transform transform;

            GameObject raycastHitGameObject = ((CustomStandaloneInputModule)EventSystem.current.currentInputModule)
                                              .PointerEventDataLeft().pointerEnter;


            if (raycastHitGameObject != null)
            {
                for (int i = 0; i < _relatedUIPanels.Count; i++)
                {
                    GameObject g = _relatedUIPanels[i];

                    if (raycastHitGameObject == g)
                    {
                        brelatedUIHit = true;
                    }
                    else
                    {
                        transform = raycastHitGameObject.transform.parent;
                        int count = 0;
                        while (transform != null && count < 1000)
                        {
                            count++;

                            if (transform.gameObject == g)
                            {
                                brelatedUIHit = true;
                                break;
                            }
                            else
                            {
                                transform = transform.parent;
                            }
                        }
                    }
                }
            }

            if (!brelatedUIHit && raycastHitGameObject != null)
            {
                return;
            }

            if (OnMouseUpEvent != null)
            {
                OnMouseUpEvent.Invoke();
            }
        }
Exemple #2
0
 public void OnMouseUp()
 {
     OnMouseUpEvent.Invoke();
 }