Exemplo n.º 1
0
        public IEventSystemHandler Process(JuniperPointerEventData eventData, float pixelDragThresholdSquared, List <KeyCode> keyPresses)
        {
            if (buttonEvent.buttonValueName != buttonName)
            {
                SetButton(buttonEvent.GetButtonValue <ButtonIDType>());
            }

            IsPressed = ButtonPressedNeeded(button);
            var evtData = ClonedPointerEventNeeded(buttonEvent.GetInstanceID(), eventData);

            evtData.keyCode = buttonEvent.inputKey;
            switch (evtData.keyCode)
            {
            case KeyCode.Mouse0: evtData.button = InputButton.Left; break;

            case KeyCode.Mouse1: evtData.button = InputButton.Right; break;

            case KeyCode.Mouse2: evtData.button = InputButton.Middle; break;

            default: evtData.button = (InputButton)(-1); break;
            }

            TestUpDown(evtData, keyPresses);
            TestDrag(evtData, pixelDragThresholdSquared);

            if (evtData.pointerEnter != null)
            {
                return(evtData.pointerEnter.GetComponent <IEventSystemHandler>());
            }
            else
            {
                return(null);
            }
        }