53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
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,
|
|
message.CustomObjectiveText); // Frontier: add CustomObjectiveText
|
|
}
|
|
|
|
public void OnSystemLoaded(ClientGameTicker system)
|
|
{
|
|
_input.SetInputCommand(ContentKeyFunctions.ToggleRoundEndSummaryWindow,
|
|
InputCmdHandler.FromDelegate(ToggleScoreboardWindow));
|
|
}
|
|
}
|