private void CommandBarOnOnKeyBindDown(GUIBoundKeyEventArgs args) { if (args.Function == EngineKeyFunctions.TextReleaseFocus) { Toggle(); return; } else if (args.Function == EngineKeyFunctions.TextScrollToBottom) { Output.ScrollToBottom(); args.Handle(); } else if (args.Function == EngineKeyFunctions.GuiTabNavigateNext) { NextCommand(); args.Handle(); return; } else if (args.Function == EngineKeyFunctions.GuiTabNavigatePrev) { PrevCommand(); args.Handle(); return; } }
private void CommandBarPubOnOnKeyBindDown(GUIBoundKeyEventArgs args) { if (args.Function == EngineKeyFunctions.ShowDebugConsole) { Toggle(); args.Handle(); } else if (args.Function == EngineKeyFunctions.TextReleaseFocus) { Toggle(); args.Handle(); } }
private void CommandBarOnOnKeyBindDown(GUIBoundKeyEventArgs args) { if (args.Function == EngineKeyFunctions.TextReleaseFocus) { CommandBar.ReleaseKeyboardFocus(); args.Handle(); Toggle(); return; } else if (args.Function == EngineKeyFunctions.TextHistoryPrev) { args.Handle(); var current = CommandBar.Text; if (!string.IsNullOrWhiteSpace(current) && _currentCommandEdited) { // Block up/down if something is typed in. return; } if (_historyPosition <= 0) { return; } CommandBar.Text = CommandHistory[--_historyPosition]; } else if (args.Function == EngineKeyFunctions.TextHistoryNext) { args.Handle(); var current = CommandBar.Text; if (!string.IsNullOrWhiteSpace(current) && _currentCommandEdited) { // Block up/down if something is typed in. return; } if (++_historyPosition >= CommandHistory.Count) { CommandBar.Text = ""; _historyPosition = CommandHistory.Count; return; } CommandBar.Text = CommandHistory[_historyPosition]; } else if (args.Function == EngineKeyFunctions.TextScrollToBottom) { args.Handle(); Output.ScrollToBottom(); } }
protected internal override void KeyBindDown(GUIBoundKeyEventArgs args) { base.KeyBindDown(args); if (!this.HasKeyboardFocus()) { return; } if (args.Function == EngineKeyFunctions.TextHistoryPrev) { if (HistoryIndex <= 0) { return; } if (HistoryIndex == History.Count) { _historyTemp = Text; } HistoryIndex--; Text = History[HistoryIndex]; CursorPos = Text.Length; args.Handle(); } else if (args.Function == EngineKeyFunctions.TextHistoryNext) { if (HistoryIndex >= History.Count) { return; } HistoryIndex++; if (HistoryIndex == History.Count) { Text = _historyTemp; } else { Text = History[HistoryIndex]; } CursorPos = Text.Length; args.Handle(); } }
private void InputKeyBindDown(GUIBoundKeyEventArgs args) { if (args.Function == EngineKeyFunctions.TextReleaseFocus) { Input.ReleaseKeyboardFocus(); args.Handle(); return; } else if (args.Function == EngineKeyFunctions.TextHistoryPrev) { if (_inputIndex == -1 && _inputHistory.Count != 0) { _inputTemp = Input.Text; _inputIndex++; } else if (_inputIndex + 1 < _inputHistory.Count) { _inputIndex++; } if (_inputIndex != -1) { Input.Text = _inputHistory[_inputIndex]; } Input.CursorPos = Input.Text.Length; args.Handle(); return; } else if (args.Function == EngineKeyFunctions.TextHistoryNext) { if (_inputIndex == 0) { Input.Text = _inputTemp; _inputTemp = ""; _inputIndex--; } else if (_inputIndex != -1) { _inputIndex--; Input.Text = _inputHistory[_inputIndex]; } Input.CursorPos = Input.Text.Length; args.Handle(); } }
private void HandKeyBindDown(GUIBoundKeyEventArgs args, string slotName) { if (!TryGetHands(out var hands)) { return; } if (args.Function == ContentKeyFunctions.MouseMiddle) { hands.SendChangeHand(slotName); args.Handle(); return; } var entity = hands.GetEntity(slotName); if (entity == null) { if (args.Function == EngineKeyFunctions.UIClick && hands.ActiveIndex != slotName) { hands.SendChangeHand(slotName); args.Handle(); } return; } if (_itemSlotManager.OnButtonPressed(args, entity)) { args.Handle(); return; } if (args.Function == EngineKeyFunctions.UIClick) { if (hands.ActiveIndex == slotName) { hands.UseActiveHand(); } else { hands.AttackByInHand(slotName); } args.Handle(); } }
private void InputKeyBindDown(GUIBoundKeyEventArgs args) { if (args.Function == EngineKeyFunctions.TextReleaseFocus) { Input.ReleaseKeyboardFocus(); args.Handle(); return; } }
protected internal override void KeyBindDown(GUIBoundKeyEventArgs args) { base.KeyBindDown(args); if (args.Function != EngineKeyFunctions.UIClick) { return; } BottomContainer.Visible = !BottomContainer.Visible; args.Handle(); }
protected internal override void KeyBindDown(GUIBoundKeyEventArgs args) { base.KeyBindDown(args); if (!args.CanFocus) { return; } BottomContainer.Visible = !BottomContainer.Visible; args.Handle(); }
public bool OnButtonPressed(GUIBoundKeyEventArgs args, IEntity?item) { if (item == null) { return(false); } if (args.Function == ContentKeyFunctions.ExamineEntity) { _entitySystemManager.GetEntitySystem <ExamineSystem>() .DoExamine(item); } else if (args.Function == ContentKeyFunctions.OpenContextMenu) { _entitySystemManager.GetEntitySystem <VerbSystem>() .OpenContextMenu(item, _uiMgr.ScreenToUIPosition(args.PointerLocation)); } else if (args.Function == ContentKeyFunctions.ActivateItemInWorld) { var inputSys = _entitySystemManager.GetEntitySystem <InputSystem>(); var func = args.Function; var funcId = _inputManager.NetworkBindMap.KeyFunctionID(args.Function); var mousePosWorld = _eyeManager.ScreenToMap(args.PointerLocation); var coordinates = _mapManager.TryFindGridAt(mousePosWorld, out var grid) ? grid.MapToGrid(mousePosWorld) : EntityCoordinates.FromMap(_mapManager, mousePosWorld); var message = new FullInputCmdMessage(_gameTiming.CurTick, _gameTiming.TickFraction, funcId, BoundKeyState.Down, coordinates, args.PointerLocation, item.Uid); // client side command handlers will always be sent the local player session. var session = _playerManager.LocalPlayer?.Session; if (session == null) { return(false); } inputSys.HandleInputCommand(session, func, message); } else { return(false); } args.Handle(); return(true); }
protected override void KeyBindDown(GUIBoundKeyEventArgs args) { base.KeyBindDown(args); if (args.Function != EngineKeyFunctions.UIRightClick && args.Function != EngineKeyFunctions.UIClick) { return; } if (OnRightClicked?.Invoke(this) == true) { args.Handle(); } }
private void ButtonOnOnKeyBindDown(GUIBoundKeyEventArgs args) { if (args.Function == EngineKeyFunctions.UIRightClick) { if (Binding != null) { _control._deferCommands.Add(() => { _control._inputManager.RemoveBinding(Binding); _control._inputManager.SaveToUserData(); }); } args.Handle(); } }
protected internal override void KeyBindDown(GUIBoundKeyEventArgs args) { base.KeyBindDown(args); if (args.Function != EngineKeyFunctions.UIClick) { return; } var item = _tryFindItemAtPosition(args.RelativePosition); if (item != null && item.Selectable) { _selectedIndex = item.Index; OnItemSelected?.Invoke(); args.Handle(); } }
public bool OnButtonPressed(GUIBoundKeyEventArgs args, IEntity item) { args.Handle(); if (item == null) { return(false); } if (args.Function == ContentKeyFunctions.ExamineEntity) { _entitySystemManager.GetEntitySystem <ExamineSystem>() .DoExamine(item); } else if (args.Function == ContentKeyFunctions.OpenContextMenu) { _entitySystemManager.GetEntitySystem <VerbSystem>() .OpenContextMenu(item, new ScreenCoordinates(args.PointerLocation.Position)); } else if (args.Function == ContentKeyFunctions.ActivateItemInWorld) { var inputSys = _entitySystemManager.GetEntitySystem <InputSystem>(); var func = args.Function; var funcId = _inputManager.NetworkBindMap.KeyFunctionID(args.Function); var mousePosWorld = _eyeManager.ScreenToWorld(args.PointerLocation); var message = new FullInputCmdMessage(_gameTiming.CurTick, funcId, BoundKeyState.Down, mousePosWorld, args.PointerLocation, item.Uid); // client side command handlers will always be sent the local player session. var session = _playerManager.LocalPlayer.Session; inputSys.HandleInputCommand(session, func, message); } else { return(false); } return(true); }