using System; using System.Collections; using System.Collections.Generic; using System.Text; using UnityEngine; using UnityEngine.Events; using UnityEngine.EventSystems; using UnityEngine.Serialization; using UnityEngine.UI; public class UCInputField : InputField { public Event globalkeyEvent; public override void OnUpdateSelected(BaseEventData eventData) { if (!isFocused) return; bool consumedEvent = false; globalkeyEvent = new Event(); while (GlobalMKHookInput.PopEvents(ref globalkeyEvent)) { if (globalkeyEvent.rawType == EventType.KeyDown) { consumedEvent = true; var shouldContinue = KeyPressed(globalkeyEvent); if (shouldContinue == EditState.Finish) { DeactivateInputField(); break; } } switch (globalkeyEvent.type) { case EventType.ValidateCommand: case EventType.ExecuteCommand: switch (globalkeyEvent.commandName) { case "SelectAll": SelectAll(); consumedEvent = true; break; } break; } } if (consumedEvent) UpdateLabel(); eventData.Use(); } }