Skip to content

Commit

Permalink
Add keyboard command for activating the Calculate Credits tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Rampastring committed Feb 14, 2025
1 parent a35ebd2 commit 408254a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/TSMapEditor/UI/KeyboardCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public KeyboardCommands()
AdjustTileHeightDown,
PlaceConnectedTile,
RepeatConnectedTile,
CalculateCredits,

BuildingMenu,
InfantryMenu,
Expand Down Expand Up @@ -139,6 +140,7 @@ public void ClearCommandSubscriptions()
public KeyboardCommand AdjustTileHeightDown { get; } = new KeyboardCommand("AdjustTileHeightDown", "Adjust Tile Height Down", new KeyboardCommandInput(Keys.PageDown, KeyboardModifiers.None), forActionsOnly:true);
public KeyboardCommand PlaceConnectedTile { get; } = new KeyboardCommand("PlaceConnectedTile", "Place Connected Tile", new KeyboardCommandInput(Keys.D, KeyboardModifiers.Alt));
public KeyboardCommand RepeatConnectedTile { get; } = new KeyboardCommand("RepeatConnectedTile", "Repeat Last Connected Tile", new KeyboardCommandInput(Keys.D, KeyboardModifiers.Ctrl));
public KeyboardCommand CalculateCredits { get; } = new KeyboardCommand("CalculateCredits", "Calculate Credits", new KeyboardCommandInput(Keys.C, KeyboardModifiers.Shift));

public KeyboardCommand BuildingMenu { get; } = new KeyboardCommand("BuildingMenu", "Building Menu", new KeyboardCommandInput(Keys.D1, KeyboardModifiers.None));
public KeyboardCommand InfantryMenu { get; } = new KeyboardCommand("InfantryMenu", "Infantry Menu", new KeyboardCommandInput(Keys.D2, KeyboardModifiers.None));
Expand Down
3 changes: 2 additions & 1 deletion src/TSMapEditor/UI/TopBar/TopBarMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public override void Initialize()
toolsContextMenu.AddItem("Check Distance...", () => mapUI.EditorState.CursorAction = checkDistanceCursorAction, null, null, null);
toolsContextMenu.AddItem("Check Distance (Pathfinding)...", () => mapUI.EditorState.CursorAction = checkDistancePathfindingCursorAction);
toolsContextMenu.AddItem(" ", null, () => false, null, null);
toolsContextMenu.AddItem("Calculate Credits...", () => mapUI.EditorState.CursorAction = calculateTiberiumValueCursorAction, null, null, null);
toolsContextMenu.AddItem("Calculate Credits...", () => mapUI.EditorState.CursorAction = calculateTiberiumValueCursorAction, null, null, null, KeyboardCommands.Instance.CalculateCredits.GetKeyDisplayString());
toolsContextMenu.AddItem(" ", null, () => false, null, null);
toolsContextMenu.AddItem("Load Map-Wide Overlay...", () => MapWideOverlayLoadRequested?.Invoke(this, EventArgs.Empty), null, null, null, null);
toolsContextMenu.AddItem(" ", null, () => false, null, null);
Expand Down Expand Up @@ -260,6 +260,7 @@ public override void Initialize()
KeyboardCommands.Instance.PlaceTunnel.Triggered += (s, e) => mapUI.EditorState.CursorAction = placeTubeCursorAction;
KeyboardCommands.Instance.PlaceConnectedTile.Triggered += (s, e) => windowController.SelectConnectedTileWindow.Open();
KeyboardCommands.Instance.RepeatConnectedTile.Triggered += (s, e) => RepeatLastConnectedTile();
KeyboardCommands.Instance.CalculateCredits.Triggered += (s, e) => mapUI.EditorState.CursorAction = calculateTiberiumValueCursorAction;
KeyboardCommands.Instance.Save.Triggered += (s, e) => SaveMap();

windowController.TerrainGeneratorConfigWindow.ConfigApplied += TerrainGeneratorConfigWindow_ConfigApplied;
Expand Down

0 comments on commit 408254a

Please sign in to comment.