public void RunTick() { // Mouse Handling this.MouseOver = this.GetMouseOverState(); if (this.MouseOver == UIMouseOverState.On) { UIComponent.ComponentWithFocus = this; // Mouse Clicked if (Cursor.LeftMouseState == Cursor.MouseDownState.Clicked) { UIComponent.ComponentSelected = this; } } // If the Mouse just exited this component: //else if(this.MouseOver == UIMouseOverState.Exited) {} // Key Handling if (UIComponent.ComponentSelected == this) { InputClient input = Systems.input; // Get Characters Pressed (doesn't assist with order) string charsPressed = input.GetCharactersPressed(); UICreoInput comp = (UICreoInput)UIComponent.ComponentSelected; if (charsPressed.Length > 0) { comp.SetInputText(comp.text + charsPressed); } // Backspace (+Shift, +Control) if (input.LocalKeyDown(Keys.Back) && this.lastBack < Systems.timer.UniFrame) { if (input.LocalKeyPressed(Keys.Back)) { this.lastBack = Systems.timer.UniFrame + 10; } else { this.lastBack = Systems.timer.UniFrame + 4; } if (input.LocalKeyDown(Keys.LeftShift) || input.LocalKeyDown(Keys.RightShift) || input.LocalKeyDown(Keys.LeftControl) || input.LocalKeyDown(Keys.RightControl)) { comp.SetInputText(""); } else if (comp.text.Length > 0) { comp.SetInputText(comp.text.Substring(0, comp.text.Length - 1)); } } } }
public void EditorInput() { InputClient input = Systems.input; // Release TempTool Control every tick: if (EditorTools.tempTool != null) { EditorTools.ClearTempTool(); } // Get the Local Keys Held Down Keys[] localKeys = input.GetAllLocalKeysDown(); if (localKeys.Length == 0) { return; } // Key Presses that AREN'T using control keys: if (!input.LocalKeyDown(Keys.LeftControl) && !input.LocalKeyDown(Keys.RightControl)) { // Func Tool Key Binds if (FuncTool.funcToolKey.ContainsKey(localKeys[0])) { EditorTools.SetTempTool(FuncTool.funcToolMap[FuncTool.funcToolKey[localKeys[0]]]); } // Tile Tool Key Binds else if (EditorUI.currentSlotGroup > 0) { this.CheckTileToolKeyBinds(localKeys[0]); } } // Open Wheel Menu if (input.LocalKeyPressed(Keys.Tab)) { this.editorUI.contextMenu.OpenMenu(); } // Button Mappings else if (input.LocalKeyPressed(Keys.P)) { FuncButton.funcButtonMap[(byte)FuncButtonEnum.Play].ActivateFuncButton(); } // If holding shift down, increase camera movement speed by 3. byte moveMult = (input.LocalKeyDown(Keys.LeftShift) || input.LocalKeyDown(Keys.RightShift)) ? (byte)3 : (byte)1; // Camera Movement Systems.camera.MoveWithInput(Systems.localServer.MyPlayer.input, moveMult); Systems.camera.StayBoundedAuto(350, 250); }
public void RunTick() { InputClient input = Systems.input; // Get Characters Pressed (doesn't assist with order) string charsPressed = input.GetCharactersPressed(); if (charsPressed.Length > 0) { ConsoleTrack.instructionText += charsPressed; } // Backspace else if (input.LocalKeyDown(Keys.Back) && ConsoleTrack.instructionText.Length > 0) { // After a hard delete (just pressed), wait 10 frames rather than 3. if (input.LocalKeyPressed(Keys.Back)) { ConsoleTrack.instructionText = ConsoleTrack.instructionText.Substring(0, ConsoleTrack.instructionText.Length - 1); this.backspaceFrame = Systems.timer.UniFrame + 10; // If held shift or control, remove the full line. if (input.LocalKeyDown(Keys.LeftShift) || input.LocalKeyDown(Keys.RightShift) || input.LocalKeyDown(Keys.LeftControl) || input.LocalKeyDown(Keys.RightControl)) { ConsoleTrack.instructionText = ""; } } else if (this.backspaceFrame < Systems.timer.UniFrame) { ConsoleTrack.instructionText = ConsoleTrack.instructionText.Substring(0, ConsoleTrack.instructionText.Length - 1); // Delete a character every 3 frames. this.backspaceFrame = Systems.timer.UniFrame + 3; } } // Up + Down - Scroll through Console Text else if (input.LocalKeyPressed(Keys.Up)) { this.ScrollConsoleText(-1); } else if (input.LocalKeyPressed(Keys.Down)) { this.ScrollConsoleText(1); } // Tab - Appends the tab lookup to the current instruction text. else if (input.LocalKeyDown(Keys.Tab)) { ConsoleTrack.instructionText += ConsoleTrack.tabLookup; } // Enter - Process the instruction. else if (input.LocalKeyPressed(Keys.Enter)) { ConsoleTrack.activate = true; // The instruction is meant to run (rather than just reveal new text hints). } // Close Console (Tilde, Escape) else if (input.LocalKeyPressed(Keys.OemTilde) || input.LocalKeyPressed(Keys.Escape)) { UIHandler.SetMenu(null, false); } // If there was no input provided, end here. else { return; } // Process the Instruction this.SendCommand(ConsoleTrack.instructionText, false); }