public override void OnUpdateSelected(BaseEventData eventData) { if (!this.isFocused) { return; } bool consumedEvent = false; while (Event.PopEvent(processEvent)) { if (processEvent.rawType == EventType.KeyDown) { if (!CombinationPressed(processEvent)) { continue; } consumedEvent = true; EditState state = this.KeyPressed(processEvent); if (state == EditState.Finish) { DeactivateInputField(); } break; } } if (consumedEvent) { this.UpdateLabel(); } eventData.Use(); }
public override void OnUpdateSelected(BaseEventData eventData) { if (!isFocused) return; bool consumedEvent = false; while (Event.PopEvent(m_ProcessingEvent)) { if (m_ProcessingEvent.rawType == EventType.KeyDown) { if (!IsAllowedCombination(m_ProcessingEvent)) { OnCharEntered(this, new EventArgs()); continue; } consumedEvent = true; var shouldContinue = KeyPressed(m_ProcessingEvent); if (shouldContinue == EditState.Finish) { DeactivateInputField(); break; } } } if (consumedEvent) { UpdateLabel(); } eventData.Use(); }
public override void OnUpdateSelected(BaseEventData eventData) { if (!isFocused) return; bool consumedEvent = false; while (Event.PopEvent(m_ProcessingEvent)) { if (m_ProcessingEvent.rawType == EventType.KeyDown) { if (ProcessKeyPress(m_ProcessingEvent)) { continue; } consumedEvent = true; var shouldContinue = KeyPressed(m_ProcessingEvent); if (shouldContinue == EditState.Finish) { DeactivateInputField(); break; } } } if (consumedEvent) UpdateLabel(); eventData.Use(); }
static public int Use(IntPtr l) { try { UnityEngine.EventSystems.BaseEventData self = (UnityEngine.EventSystems.BaseEventData)checkSelf(l); self.Use(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int Use(IntPtr l) { try{ UnityEngine.EventSystems.BaseEventData self = (UnityEngine.EventSystems.BaseEventData)checkSelf(l); self.Use(); return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
public override void OnUpdateSelected(UnityEngine.EventSystems.BaseEventData eventData) { if (!this.isFocused) { return; } bool flag = false; while (Event.PopEvent(this.m_ProcessingEvent)) { if (this.m_ProcessingEvent.rawType == EventType.KeyDown) { flag = true; InputField.EditState editState; if (this.m_ProcessingEvent.keyCode == KeyCode.Backspace) { editState = this.KeyPressed2(this.m_ProcessingEvent); } else { editState = this.KeyPressed(this.m_ProcessingEvent); } if (editState == InputField.EditState.Finish) { this.DeactivateInputField(); break; } } } if (flag) { this.UpdateLabel(); } eventData.Use(); }
// To change default behavior and to support multiple gui, // override InputFiled method here. public override void OnUpdateSelected(BaseEventData eventData) { if (!isFocused) return; // To support multiple gui, set the window that this input filed is belonging to // as the current active window. Window.selected = parentWindow; bool consumedEvent = false; var e = new Event(); while (Event.PopEvent(e)) { if (e.rawType == EventType.KeyDown) { consumedEvent = true; // Skip because these keys are used for histroy selection in single-line mode // and for move cursor manually in multi-line mode. switch (e.keyCode) { case KeyCode.UpArrow: case KeyCode.DownArrow: continue; } // Skip if completion view is open. if (parentWindow.hasCompletion) { if (e.keyCode == KeyCode.Tab || KeyUtil.Enter()) { break; } } var shouldContinue = KeyPressed(e); // Prevent finish. // Command submission and cancel are observed and handled in Core. switch (e.keyCode) { case KeyCode.Return: case KeyCode.KeypadEnter: case KeyCode.Escape: shouldContinue = EditState.Continue; break; } if (shouldContinue == EditState.Finish) { DeactivateInputField(); break; } } } if (consumedEvent) { UpdateLabel(); } eventData.Use(); }