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; }
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); }
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); }
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); }
/// <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); }