void HandleSetTextHotkey() { string label = reader.ReadString(); string action = reader.ReadString(); int keyCode = reader.ReadInt32(); byte keyMods = reader.ReadUInt8(); #if !ANDROID if (keyCode < 0 || keyCode > 255) { return; } Key key = LwjglToKey.Map[keyCode]; if (key == Key.None) { return; } Utils.LogDebug("CPE Hotkey added: " + key + "," + keyMods + " : " + action); if (action.Length == 0) { HotkeyList.Remove(key, keyMods); } else if (action[action.Length - 1] == '◙') // graphical form of \n { action = action.Substring(0, action.Length - 1); HotkeyList.Add(key, keyMods, action, false); } else // more input needed by user { HotkeyList.Add(key, keyMods, action, true); } #endif }
void RemoveHotkeyClick(Game game, Widget widget) { if (origHotkey.Trigger != Key.None) { HotkeyList.Remove(origHotkey.Trigger, origHotkey.Flags); HotkeyList.UserRemovedHotkey(origHotkey.Trigger, origHotkey.Flags); } game.Gui.SetNewScreen(new HotkeyListScreen(game)); }
public bool UnregisterHotkey(HotkeyInfo hotkeyInfo) { if (hotkeyInfo != null) { bool result = UnregisterHotkey(hotkeyInfo.ID); HotkeyList.Remove(hotkeyInfo); return(result); } return(false); }
void SaveChangesClick(Game game, Widget widget) { if (origHotkey.Trigger != Key.None) { HotkeyList.Remove(origHotkey.Trigger, origHotkey.Flags); HotkeyList.UserRemovedHotkey(origHotkey.Trigger, origHotkey.Flags); } MenuInputWidget input = (MenuInputWidget)widgets[actionI]; if (curHotkey.Trigger != Key.None) { HotkeyList.Add(curHotkey.Trigger, curHotkey.Flags, input.Text.ToString(), curHotkey.StaysOpen); HotkeyList.UserAddedHotkey(curHotkey.Trigger, curHotkey.Flags, curHotkey.StaysOpen, input.Text.ToString()); } game.Gui.SetNewScreen(new HotkeyListScreen(game)); }