示例#1
0
        private void SendPointerClickEvent(PointerControl controlIndex, bool clicked, float time)
        {
            var inputEvent = InputSystem.CreateEvent <GenericControlEvent>();

            inputEvent.time         = time;
            inputEvent.deviceType   = typeof(Touchscreen);
            inputEvent.deviceIndex  = 0;            ////FIXME: must be right index for us
            inputEvent.controlIndex = (int)controlIndex;
            inputEvent.value        = clicked ? 1.0f : 0.0f;
            InputSystem.QueueEvent(inputEvent);
        }
示例#2
0
        private void SendPointerMoveEvent(Vector3 position, Vector3 delta, float time)
        {
            var inputEvent = InputSystem.CreateEvent <PointerMoveEvent>();

            inputEvent.time        = time;
            inputEvent.deviceType  = typeof(Touchscreen);
            inputEvent.deviceIndex = 0;             ////FIXME: must be right index for us
            inputEvent.position    = position;
            inputEvent.delta       = delta;
            InputSystem.QueueEvent(inputEvent);
        }
        public void SetAxisValue(int controlIndex, float value)
        {
            var control = this[controlIndex] as InputControl;

            if (control == null)
            {
                return;
            }
            float currentValue = control.rawValue;

            if (value == currentValue)
            {
                return;
            }

            var inputEvent = InputSystem.CreateEvent <GenericControlEvent>();

            inputEvent.deviceType   = typeof(VirtualJoystick);
            inputEvent.deviceIndex  = 0;            // TODO: Use index of device itself, but that's not currently stored on device.
            inputEvent.controlIndex = controlIndex;
            inputEvent.value        = value;
            InputSystem.QueueEvent(inputEvent);
        }