Added hotkey and controller to re-open end of round scoreboard (#25884)
* 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>
This commit is contained in:
51
Content.Client/RoundEnd/RoundEndSummaryUIController.cs
Normal file
51
Content.Client/RoundEnd/RoundEndSummaryUIController.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user