Observers are now shown in the Lobby as Observers (#1834)

* Observers are now shown in the Lobby as Observers

* Weviews adwessed
This commit is contained in:
Exp
2020-08-21 11:24:06 +02:00
committed by GitHub
parent 8fe211bf88
commit 02b5632dac
5 changed files with 60 additions and 38 deletions

View File

@@ -30,7 +30,7 @@ namespace Content.Client.GameTicking
[ViewVariables] public string ServerInfoBlob { get; private set; }
[ViewVariables] public DateTime StartTime { get; private set; }
[ViewVariables] public bool Paused { get; private set; }
[ViewVariables] public Dictionary<NetSessionId, bool> Ready { get; private set; }
[ViewVariables] public Dictionary<NetSessionId, PlayerStatus> Status { get; private set; }
public event Action InfoBlobUpdated;
public event Action LobbyStatusUpdated;
@@ -54,7 +54,7 @@ namespace Content.Client.GameTicking
});
_netManager.RegisterNetMessage<MsgTickerLateJoinStatus>(nameof(MsgTickerLateJoinStatus), LateJoinStatus);
Ready = new Dictionary<NetSessionId, bool>();
Status = new Dictionary<NetSessionId, PlayerStatus>();
_initialized = true;
}
@@ -77,7 +77,7 @@ namespace Content.Client.GameTicking
AreWeReady = message.YouAreReady;
Paused = message.Paused;
if (IsGameStarted)
Ready.Clear();
Status.Clear();
LobbyStatusUpdated?.Invoke();
}
@@ -103,9 +103,9 @@ namespace Content.Client.GameTicking
private void LobbyReady(MsgTickerLobbyReady message)
{
// Merge the Dictionaries
foreach (var p in message.PlayerReady)
foreach (var p in message.PlayerStatus)
{
Ready[p.Key] = p.Value;
Status[p.Key] = p.Value;
}
LobbyReadyUpdated?.Invoke();
}