示例#1
0
 protected virtual bool NoValidCollision(Pvr_UIPointer pointer, List <RaycastResult> results)
 {
     return(results.Count == 0 || !CheckTransformTree(results[0].gameObject.transform, pointer.pointerEventData.pointerEnter.transform));
 }
示例#2
0
    protected virtual void Hover(Pvr_UIPointer pointer, List <RaycastResult> results)
    {
        if (pointer.pointerEventData.pointerEnter)
        {
            CheckPointerHoverClick(pointer, results);
            if (!ValidElement(pointer.pointerEventData.pointerEnter))
            {
                pointer.pointerEventData.pointerEnter = null;
                return;
            }

            if (NoValidCollision(pointer, results))
            {
                ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerEnter, pointer.pointerEventData, ExecuteEvents.pointerExitHandler);
                pointer.pointerEventData.hovered.Remove(pointer.pointerEventData.pointerEnter);
                pointer.pointerEventData.pointerEnter = null;
            }
        }
        else
        {
            foreach (var result in results)
            {
                if (!ValidElement(result.gameObject))
                {
                    continue;
                }

                var target = ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.pointerEnterHandler);
                if (target != null)
                {
                    var selectable = target.GetComponent <Selectable>();
                    if (selectable)
                    {
                        var noNavigation = new Navigation();
                        noNavigation.mode     = Navigation.Mode.None;
                        selectable.navigation = noNavigation;
                    }

                    pointer.OnUIPointerElementEnter(pointer.SetUIPointerEvent(result, target, pointer.hoveringElement));
                    pointer.hoveringElement = target;
                    pointer.pointerEventData.pointerCurrentRaycast = result;
                    pointer.pointerEventData.pointerEnter          = target;
                    pointer.pointerEventData.hovered.Add(pointer.pointerEventData.pointerEnter);
                    break;
                }
                else
                {
                    if (result.gameObject != pointer.hoveringElement)
                    {
                        pointer.OnUIPointerElementEnter(pointer.SetUIPointerEvent(result, result.gameObject, pointer.hoveringElement));
                    }
                    pointer.hoveringElement = result.gameObject;
                }
            }

            if (pointer.hoveringElement && results.Count == 0)
            {
                pointer.OnUIPointerElementExit(pointer.SetUIPointerEvent(new RaycastResult(), null, pointer.hoveringElement));
                pointer.hoveringElement = null;
            }
        }
    }
示例#3
0
 protected virtual void Awake()
 {
     pointer = this;
     originalPointerOriginTransform = pointerOriginTransform;
 }