* Added keybind for scoreboard, starting work
* Fixed the window appearing
* Added loc text
* Updated namespace for ScoreboardUIController.cs
* Switched to UISystemDependency
"- UIControllers can use [Dependency] as normal for IoC services and other controllers, but must use [UISystemDependency] for entity systems, which may be null as controllers exist before entity systems do." Jezithyr — 10/12/2022 1:20 PM
* Reverted back to functional state
* Replace with UISystemDependency
* Move RoundEndSummaryWindow to ScoreboardUIController
* Convert to EntitySystem
* Clean up command bind
* Move to RoundEnd directory
* Remove Nukeops rule when no nukies
* Cleanup
* Change to toggle hotkey
* Cleanup
* Revert "Remove Nukeops rule when no nukies"
This reverts commit
5d4bbca09f45110b24a674d59b505be87b602b67.
* Cleanup
* Make the Toggle hotkey work in lobby
* Fix error
---------
Co-authored-by: SlamBamActionman <slambamactionman@gmail.com>
Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
using JetBrains.Annotations;
using Robust.Client.Graphics;
using Robust.Client.State;
-using Robust.Shared.Utility;
+using Robust.Client.UserInterface;
namespace Content.Client.GameTicking.Managers
{
[Dependency] private readonly IClientAdminManager _admin = default!;
[Dependency] private readonly IClyde _clyde = default!;
[Dependency] private readonly SharedMapSystem _map = default!;
+ [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
- [ViewVariables] private bool _initialized;
private Dictionary<NetEntity, Dictionary<string, uint?>> _jobsAvailable = new();
private Dictionary<NetEntity, string> _stationNames = new();
- /// <summary>
- /// The current round-end window. Could be used to support re-opening the window after closing it.
- /// </summary>
- private RoundEndSummaryWindow? _window;
-
[ViewVariables] public bool AreWeReady { get; private set; }
[ViewVariables] public bool IsGameStarted { get; private set; }
[ViewVariables] public string? RestartSound { get; private set; }
// Force an update in the event of this song being the same as the last.
RestartSound = message.RestartSound;
- // Don't open duplicate windows (mainly for replays).
- if (_window?.RoundId == message.RoundId)
- return;
-
- //This is not ideal at all, but I don't see an immediately better fit anywhere else.
- _window = new RoundEndSummaryWindow(message.GamemodeTitle, message.RoundEndText, message.RoundDuration, message.RoundId, message.AllPlayersEndInfo, EntityManager);
+ _userInterfaceManager.GetUIController<RoundEndSummaryUIController>().OpenRoundEndSummaryWindow(message);
}
}
}
common.AddFunction(ContentKeyFunctions.ZoomIn);
common.AddFunction(ContentKeyFunctions.ResetZoom);
common.AddFunction(ContentKeyFunctions.InspectEntity);
+ common.AddFunction(ContentKeyFunctions.ToggleRoundEndSummaryWindow);
// Not in engine, because engine cannot check for sanbox/admin status before starting placement.
common.AddFunction(ContentKeyFunctions.EditorCopyObject);
AddButton(ContentKeyFunctions.OpenInventoryMenu);
AddButton(ContentKeyFunctions.OpenAHelp);
AddButton(ContentKeyFunctions.OpenActionsMenu);
+ AddButton(ContentKeyFunctions.ToggleRoundEndSummaryWindow);
AddButton(ContentKeyFunctions.OpenEntitySpawnWindow);
AddButton(ContentKeyFunctions.OpenSandboxWindow);
AddButton(ContentKeyFunctions.OpenTileSpawnWindow);
--- /dev/null
+using Content.Client.GameTicking.Managers;
+using Content.Shared.GameTicking;
+using Content.Shared.Input;
+using JetBrains.Annotations;
+using Robust.Client.Input;
+using Robust.Client.UserInterface.Controllers;
+using Robust.Shared.Input.Binding;
+using Robust.Shared.Player;
+
+namespace Content.Client.RoundEnd;
+
+[UsedImplicitly]
+public sealed class RoundEndSummaryUIController : UIController,
+ IOnSystemLoaded<ClientGameTicker>
+{
+ [Dependency] private readonly IInputManager _input = default!;
+
+ private RoundEndSummaryWindow? _window;
+
+ private void ToggleScoreboardWindow(ICommonSession? session = null)
+ {
+ if (_window == null)
+ return;
+
+ if (_window.IsOpen)
+ {
+ _window.Close();
+ }
+ else
+ {
+ _window.OpenCenteredRight();
+ _window.MoveToFront();
+ }
+ }
+
+ public void OpenRoundEndSummaryWindow(RoundEndMessageEvent message)
+ {
+ // Don't open duplicate windows (mainly for replays).
+ if (_window?.RoundId == message.RoundId)
+ return;
+
+ _window = new RoundEndSummaryWindow(message.GamemodeTitle, message.RoundEndText,
+ message.RoundDuration, message.RoundId, message.AllPlayersEndInfo, EntityManager);
+ }
+
+ public void OnSystemLoaded(ClientGameTicker system)
+ {
+ _input.SetInputCommand(ContentKeyFunctions.ToggleRoundEndSummaryWindow,
+ InputCmdHandler.FromDelegate(ToggleScoreboardWindow));
+ }
+}
using System.Numerics;
using Content.Client.Message;
using Content.Shared.GameTicking;
-using Robust.Client.GameObjects;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Utility;
public static readonly BoundKeyFunction MovePulledObject = "MovePulledObject";
public static readonly BoundKeyFunction ReleasePulledObject = "ReleasePulledObject";
public static readonly BoundKeyFunction MouseMiddle = "MouseMiddle";
+ public static readonly BoundKeyFunction ToggleRoundEndSummaryWindow = "ToggleRoundEndSummaryWindow";
public static readonly BoundKeyFunction OpenEntitySpawnWindow = "OpenEntitySpawnWindow";
public static readonly BoundKeyFunction OpenSandboxWindow = "OpenSandboxWindow";
public static readonly BoundKeyFunction OpenTileSpawnWindow = "OpenTileSpawnWindow";
ui-options-function-open-inventory-menu = Open inventory
ui-options-function-open-a-help = Open admin help
ui-options-function-open-abilities-menu = Open action menu
+ui-options-function-toggle-round-end-summary-window = Toggle round end summary window
ui-options-function-open-entity-spawn-window = Open entity spawn menu
ui-options-function-open-sandbox-window = Open sandbox menu
ui-options-function-open-tile-spawn-window = Open tile spawn menu
- function: OpenDecalSpawnWindow
type: State
key: F8
+- function: OpenScoreboardWindow
+ type: State
+ key: F9
- function: OpenSandboxWindow
type: State
key: B