示例#1
0
 public TextFieldEvent(KeyboardEvent keyboardEvent) : base(keyboardEvent.Type, keyboardEvent.Target)
 {
     KeyCode = keyboardEvent.KeyCode;
     Control = keyboardEvent.Control;
     Shift = keyboardEvent.Shift;
     Alt = keyboardEvent.Alt;
     Character = keyboardEvent.CurrentEvent.character;
 }
示例#2
0
        private void RedispatchKeyEvent(IEventDispatcher targetComponent, ICloneable systemManagerKeyEvent)
        {
            _keyEvent = (KeyboardEvent)systemManagerKeyEvent.Clone();
            _keyEvent.Target = targetComponent;
            
            /**
             * 1) Dispatch from here
             * */
            DispatchEvent(_keyEvent);

            // the event might be canceled
            if (_keyEvent.Canceled)
                return;

            /**
             * 2) Dispatch from the component
             * */
            targetComponent.DispatchEvent(_keyEvent);
        }
示例#3
0
        private void KeyUpSlot(params object[] parameters)
        {
            UnityEngine.Event e = (UnityEngine.Event)parameters[0];

            KeyboardEvent ke = new KeyboardEvent(KeyboardEvent.KEY_UP)
                                   {
                                       CurrentEvent = e,
                                       KeyCode = e.keyCode,
                                       Shift = e.shift,
                                       Control = e.control,
                                       Alt = e.alt
                                   };
            DispatchEvent(ke, false);
        }
示例#4
0
        private void KeyDownSlot(params object[] parameters)
        {
            UnityEngine.Event e = (UnityEngine.Event)parameters[0];
            //Debug.Log("KeyDownSlot: " + e.keyCode);

            KeyboardEvent ke = new KeyboardEvent(KeyboardEvent.KEY_DOWN)
                                   {
                                       CurrentEvent = e,
                                       KeyCode = e.keyCode,
                                       Shift = e.shift,
                                       Control = e.control,
                                       Alt = e.alt
                                   };
            DispatchEvent(ke, false);
        }
示例#5
0
 /// <summary>
 /// Creates the combo from keyboard event
 /// </summary>
 /// <param name="event"></param>
 /// <returns></returns>
 public static KeyCombination FromKeyboardEvent(KeyboardEvent @event)
 {
     return new KeyCombination(@event.Type, @event.KeyCode, @event.Control, @event.Shift, @event.Alt);
 }