public override bool HandlesKeyDown(Key key) { suppressNextPress = false; if (HandlesAllInput) // text input bar { if (key == game.Mapping(KeyBind.SendChat) || key == Key.KeypadEnter || key == game.Mapping(KeyBind.PauseOrExit)) { SetHandlesAllInput(false); game.CursorVisible = false; game.Camera.RegrabMouse(); game.Keyboard.KeyRepeat = false; if (key == game.Mapping(KeyBind.PauseOrExit)) { input.Clear(); } input.EnterInput(); altText.SetActive(false); chatIndex = game.Chat.Log.Count - chatLines; ScrollHistory(); } else if (key == Key.PageUp) { chatIndex -= chatLines; ScrollHistory(); } else if (key == Key.PageDown) { chatIndex += chatLines; ScrollHistory(); } else if (game.Server.SupportsFullCP437 && key == game.Input.Keys[KeyBind.ExtInput]) { altText.SetActive(!altText.Active); } else { input.HandlesKeyDown(key); UpdateAltTextY(); } return(key < Key.F1 || key > Key.F35); } if (key == game.Mapping(KeyBind.Chat)) { OpenTextInputBar(""); } else if (key == Key.Slash) { OpenTextInputBar("/"); } else { return(false); } return(true); }
public override bool HandlesKeyDown(Key key) { suppressNextPress = false; if (HandlesAllInput) // text input bar { if (key == game.Mapping(KeyBind.SendChat) || key == Key.KeypadEnter || key == game.Mapping(KeyBind.PauseOrExit)) { SetHandlesAllInput(false); game.CursorVisible = false; game.Camera.RegrabMouse(); game.Keyboard.KeyRepeat = false; if (key == game.Mapping(KeyBind.PauseOrExit)) { input.Clear(); } input.EnterInput(); altText.SetActive(false); // Do we need to move all chat down? int resetIndex = game.Chat.Log.Count - chatLines; if (chatIndex != resetIndex) { chatIndex = ClampIndex(resetIndex); ResetChat(); } } else if (key == Key.PageUp) { ScrollHistoryBy(-chatLines); } else if (key == Key.PageDown) { ScrollHistoryBy(chatLines); } else { input.HandlesKeyDown(key); UpdateAltTextY(); } return(key < Key.F1 || key > Key.F35); } if (key == game.Mapping(KeyBind.Chat)) { OpenTextInputBar(""); } else if (key == Key.Slash) { OpenTextInputBar("/"); } else { return(false); } return(true); }
public override bool HandlesKeyDown(Key key) { suppressNextPress = false; if (HandlesAllInput) // text input bar { if (key == game.Mapping(KeyBind.SendChat) || key == Key.KeypadEnter || key == game.Mapping(KeyBind.PauseOrExit)) { SetHandlesAllInput(false); Keyboard.KeyRepeat = false; if (key == game.Mapping(KeyBind.PauseOrExit)) { input.Clear(); } input.EnterInput(); altText.SetActive(false); // Reset chat when user has scrolled up in chat history int defaultIndex = game.Chat.Log.Count - chatLines; if (chatIndex != defaultIndex) { chatIndex = ClampIndex(defaultIndex); ResetChat(); } } else if (key == Key.PageUp) { ScrollHistoryBy(-chatLines); } else if (key == Key.PageDown) { ScrollHistoryBy(chatLines); } else { input.HandlesKeyDown(key); UpdateAltTextY(); } return(key < Key.F1 || key > Key.F35); } if (key == game.Mapping(KeyBind.Chat)) { OpenInput(""); } else if (key == Key.Slash) { OpenInput("/"); } else { return(false); } return(true); }