Fix RoundStartTimeSpan not being networked on client-side after reconnecting (#23707)
Fix RoundStartTimeSpan state not being networked on reconnections
This commit is contained in:
@@ -57,6 +57,7 @@ namespace Content.Client.GameTicking.Managers
|
|||||||
|
|
||||||
SubscribeNetworkEvent<TickerJoinLobbyEvent>(JoinLobby);
|
SubscribeNetworkEvent<TickerJoinLobbyEvent>(JoinLobby);
|
||||||
SubscribeNetworkEvent<TickerJoinGameEvent>(JoinGame);
|
SubscribeNetworkEvent<TickerJoinGameEvent>(JoinGame);
|
||||||
|
SubscribeNetworkEvent<TickerConnectionStatusEvent>(ConnectionStatus);
|
||||||
SubscribeNetworkEvent<TickerLobbyStatusEvent>(LobbyStatus);
|
SubscribeNetworkEvent<TickerLobbyStatusEvent>(LobbyStatus);
|
||||||
SubscribeNetworkEvent<TickerLobbyInfoEvent>(LobbyInfo);
|
SubscribeNetworkEvent<TickerLobbyInfoEvent>(LobbyInfo);
|
||||||
SubscribeNetworkEvent<TickerLobbyCountdownEvent>(LobbyCountdown);
|
SubscribeNetworkEvent<TickerLobbyCountdownEvent>(LobbyCountdown);
|
||||||
@@ -110,6 +111,11 @@ namespace Content.Client.GameTicking.Managers
|
|||||||
_stateManager.RequestStateChange<LobbyState>();
|
_stateManager.RequestStateChange<LobbyState>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ConnectionStatus(TickerConnectionStatusEvent message)
|
||||||
|
{
|
||||||
|
RoundStartTimeSpan = message.RoundStartTimeSpan;
|
||||||
|
}
|
||||||
|
|
||||||
private void LobbyStatus(TickerLobbyStatusEvent message)
|
private void LobbyStatus(TickerLobbyStatusEvent message)
|
||||||
{
|
{
|
||||||
StartTime = message.StartTime;
|
StartTime = message.StartTime;
|
||||||
|
|||||||
@@ -86,10 +86,15 @@ namespace Content.Server.GameTicking
|
|||||||
("desc", desc));
|
("desc", desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private TickerConnectionStatusEvent GetConnectionStatusMsg()
|
||||||
|
{
|
||||||
|
return new TickerConnectionStatusEvent(RoundStartTimeSpan);
|
||||||
|
}
|
||||||
|
|
||||||
private TickerLobbyStatusEvent GetStatusMsg(ICommonSession session)
|
private TickerLobbyStatusEvent GetStatusMsg(ICommonSession session)
|
||||||
{
|
{
|
||||||
_playerGameStatuses.TryGetValue(session.UserId, out var status);
|
_playerGameStatuses.TryGetValue(session.UserId, out var status);
|
||||||
return new TickerLobbyStatusEvent(RunLevel != GameRunLevel.PreRoundLobby, LobbySong, LobbyBackground,status == PlayerGameStatus.ReadyToPlay, _roundStartTime, RoundPreloadTime, RoundStartTimeSpan, Paused);
|
return new TickerLobbyStatusEvent(RunLevel != GameRunLevel.PreRoundLobby, LobbySong, LobbyBackground, status == PlayerGameStatus.ReadyToPlay, _roundStartTime, RoundPreloadTime, RoundStartTimeSpan, Paused);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendStatusToAll()
|
private void SendStatusToAll()
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ namespace Content.Server.GameTicking
|
|||||||
? Loc.GetString("player-first-join-message", ("name", args.Session.Name))
|
? Loc.GetString("player-first-join-message", ("name", args.Session.Name))
|
||||||
: Loc.GetString("player-join-message", ("name", args.Session.Name)));
|
: Loc.GetString("player-join-message", ("name", args.Session.Name)));
|
||||||
|
|
||||||
|
RaiseNetworkEvent(GetConnectionStatusMsg(), session.Channel);
|
||||||
|
|
||||||
if (LobbyEnabled && _roundStartCountdownHasNotStartedYetDueToNoPlayers)
|
if (LobbyEnabled && _roundStartCountdownHasNotStartedYetDueToNoPlayers)
|
||||||
{
|
{
|
||||||
_roundStartCountdownHasNotStartedYetDueToNoPlayers = false;
|
_roundStartCountdownHasNotStartedYetDueToNoPlayers = false;
|
||||||
|
|||||||
@@ -63,6 +63,15 @@ namespace Content.Shared.GameTicking
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public sealed class TickerConnectionStatusEvent : EntityEventArgs
|
||||||
|
{
|
||||||
|
public TimeSpan RoundStartTimeSpan { get; }
|
||||||
|
public TickerConnectionStatusEvent(TimeSpan roundStartTimeSpan)
|
||||||
|
{
|
||||||
|
RoundStartTimeSpan = roundStartTimeSpan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public sealed class TickerLobbyStatusEvent : EntityEventArgs
|
public sealed class TickerLobbyStatusEvent : EntityEventArgs
|
||||||
|
|||||||
Reference in New Issue
Block a user