示例#1
0
        public JuniperPointerEventData GetJuniperPointerData(int pointerDataID)
        {
            if (!m_PointerData.ContainsKey(pointerDataID))
            {
                m_PointerData[pointerDataID] = new JuniperPointerEventData(eventSystem);
            }

            var data = m_PointerData[pointerDataID];

            if (!(data is JuniperPointerEventData))
            {
                var clone = new JuniperPointerEventData(eventSystem)
                {
                    button                = data.button,
                    clickCount            = data.clickCount,
                    clickTime             = data.clickTime,
                    delta                 = data.delta,
                    dragging              = data.dragging,
                    eligibleForClick      = data.eligibleForClick,
                    pointerCurrentRaycast = data.pointerCurrentRaycast,
                    pointerDrag           = data.pointerDrag,
                    pointerEnter          = data.pointerEnter,
                    pointerId             = data.pointerId,
                    pointerPress          = data.pointerPress,
                    pointerPressRaycast   = data.pointerPressRaycast,
                    position              = data.position,
                    pressPosition         = data.pressPosition,
                    rawPointerPress       = data.rawPointerPress,
                    scrollDelta           = data.scrollDelta,
                    selectedObject        = data.selectedObject,
                    useDragThreshold      = data.useDragThreshold
                };

                if (data.hovered != null)
                {
                    if (clone.hovered == null)
                    {
                        clone.hovered = new List <GameObject>();
                    }

                    clone.hovered.AddRange(data.hovered);
                }

                data = clone;
            }

            return((JuniperPointerEventData)data);
        }
示例#2
0
        public JuniperPointerEventData Clone(int pointerDataID, JuniperPointerEventData original)
        {
            var clone = GetJuniperPointerData(pointerDataID);

            clone.delta                 = original.delta;
            clone.position              = original.position;
            clone.scrollDelta           = original.scrollDelta;
            clone.pointerEnter          = original.pointerEnter;
            clone.useDragThreshold      = original.useDragThreshold;
            clone.pointerCurrentRaycast = original.pointerCurrentRaycast;
            if (original.clickCount == -1)
            {
                clone.eligibleForClick = false;
                clone.clickCount       = 0;
            }

            return(clone);
        }
示例#3
0
        public void ClickButtons(IEnumerable <IPointerClickHandler> buttons)
        {
            var pointerEvent = new JuniperPointerEventData(eventSystem)
            {
                button           = PointerEventData.InputButton.Left,
                keyCode          = KeyCode.Mouse0,
                eligibleForClick = true,
                clickCount       = 1,
                clickTime        = Time.unscaledTime,
            };

            foreach (var button in buttons)
            {
                if (button != null)
                {
                    button.OnPointerClick(pointerEvent);
                }
            }
        }