Add current station time to game lobby (#9665)
Co-authored-by: Kara <lunarautomaton6@gmail.com>
This commit is contained in:
@@ -32,6 +32,7 @@ namespace Content.Client.GameTicking.Managers
|
||||
[ViewVariables] public bool DisallowedLateJoin { get; private set; }
|
||||
[ViewVariables] public string? ServerInfoBlob { get; private set; }
|
||||
[ViewVariables] public TimeSpan StartTime { get; private set; }
|
||||
[ViewVariables] public TimeSpan RoundStartTimeSpan { get; private set; }
|
||||
[ViewVariables] public new bool Paused { get; private set; }
|
||||
[ViewVariables] public Dictionary<NetUserId, LobbyPlayerStatus> Status { get; private set; } = new();
|
||||
[ViewVariables] public IReadOnlyDictionary<EntityUid, Dictionary<string, uint?>> JobsAvailable => _jobsAvailable;
|
||||
@@ -87,6 +88,7 @@ namespace Content.Client.GameTicking.Managers
|
||||
private void LobbyStatus(TickerLobbyStatusEvent message)
|
||||
{
|
||||
StartTime = message.StartTime;
|
||||
RoundStartTimeSpan = message.RoundStartTimeSpan;
|
||||
IsGameStarted = message.IsRoundStarted;
|
||||
AreWeReady = message.YouAreReady;
|
||||
LobbySong = message.LobbySong;
|
||||
|
||||
@@ -136,6 +136,7 @@ namespace Content.Client.Lobby
|
||||
if (gameTicker.IsGameStarted)
|
||||
{
|
||||
_lobby.StartTime.Text = string.Empty;
|
||||
_lobby.StationTime.Text = Loc.GetString("lobby-state-player-status-station-time", ("stationTime", _gameTiming.RealTime.Subtract(_gameTicker.RoundStartTimeSpan).ToString("hh\\:mm")));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -159,6 +160,7 @@ namespace Content.Client.Lobby
|
||||
}
|
||||
}
|
||||
|
||||
_lobby.StationTime.Text = Loc.GetString("lobby-state-player-status-station-time", ("stationTime", TimeSpan.Zero.ToString("hh\\:mm")));
|
||||
_lobby.StartTime.Text = Loc.GetString("lobby-state-round-start-countdown-text", ("timeLeft", text));
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
<!-- Server info -->
|
||||
<hudUi:NanoHeading Text="{Loc 'ui-lobby-server-info-block'}" />
|
||||
<info:ServerInfo Name="ServerInfo" Access="Public" MinSize="0 30" VerticalExpand="false" Margin="3 3 3 3" MaxWidth="400" HorizontalAlignment="Left"/>
|
||||
<Label Name="StationTime" Access="Public" FontColorOverride="{x:Static maths:Color.LightGray}" Margin="3 3 3 3" HorizontalAlignment="Left"/>
|
||||
<ui:HSpacer Spacing="5"/>
|
||||
<lobbyUi:LobbyCharacterPreviewPanel Name="CharacterPreview" Access="Public"></lobbyUi:LobbyCharacterPreviewPanel>
|
||||
<ui:HSpacer Spacing="5"/>
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Content.Server.GameTicking
|
||||
private TickerLobbyStatusEvent GetStatusMsg(IPlayerSession session)
|
||||
{
|
||||
_playersInLobby.TryGetValue(session, out var status);
|
||||
return new TickerLobbyStatusEvent(RunLevel != GameRunLevel.PreRoundLobby, LobbySong, LobbyBackground,status == LobbyPlayerStatus.Ready, _roundStartTime, Paused);
|
||||
return new TickerLobbyStatusEvent(RunLevel != GameRunLevel.PreRoundLobby, LobbySong, LobbyBackground,status == LobbyPlayerStatus.Ready, _roundStartTime, _roundStartTimeSpan, Paused);
|
||||
}
|
||||
|
||||
private void SendStatusToAll()
|
||||
|
||||
@@ -45,15 +45,17 @@ namespace Content.Shared.GameTicking
|
||||
public bool YouAreReady { get; }
|
||||
// UTC.
|
||||
public TimeSpan StartTime { get; }
|
||||
public TimeSpan RoundStartTimeSpan { get; }
|
||||
public bool Paused { get; }
|
||||
|
||||
public TickerLobbyStatusEvent(bool isRoundStarted, string? lobbySong, string? lobbyBackground, bool youAreReady, TimeSpan startTime, bool paused)
|
||||
public TickerLobbyStatusEvent(bool isRoundStarted, string? lobbySong, string? lobbyBackground, bool youAreReady, TimeSpan startTime, TimeSpan roundStartTimeSpan, bool paused)
|
||||
{
|
||||
IsRoundStarted = isRoundStarted;
|
||||
LobbySong = lobbySong;
|
||||
LobbyBackground = lobbyBackground;
|
||||
YouAreReady = youAreReady;
|
||||
StartTime = startTime;
|
||||
RoundStartTimeSpan = roundStartTimeSpan;
|
||||
Paused = paused;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,5 @@ lobby-state-ready-button-join-state = Join
|
||||
lobby-state-ready-button-ready-up-state = Ready Up
|
||||
lobby-state-player-status-not-ready = Not Ready
|
||||
lobby-state-player-status-ready = Ready
|
||||
lobby-state-player-status-observer = Observer
|
||||
lobby-state-player-status-observer = Observer
|
||||
lobby-state-player-status-station-time = The station time is: {$stationTime}
|
||||
|
||||
Reference in New Issue
Block a user