Cleaning up some of the lobby state so that leaving and rejoining/creating new lobbies works properly. Oh, also, I forgot to remove the ArePlayersReadyTime from the lobby, and also had a minor bug with the lobby heartbeat.
m_data=newUserData(false,m_data.DisplayName,m_data.ID,EmoteType.None,UserStatus.Menu);// ID and DisplayName should persist since this might be the local user.
}
#endregion
/// <summary>
/// Used for limiting costly OnChanged actions to just the members which actually changed.
m_isAwaitingQuery=true;// Note that because we make async calls, if one of them fails and doesn't call our callback, this will never be reset to false.
State=lobby.Data?.ContainsKey("State")==true?(LobbyState)int.Parse(lobby.Data["State"].Value):LobbyState.Lobby,// TODO: Consider TryParse, just in case (and below). Although, we don't have fail logic anyway...
Dictionary<string,LobbyUser>lobbyUsers=newDictionary<string,LobbyUser>();// TODO: So, right, why this?
}
}
// If the player isn't connected to Relay, or if we just don't know about them yet, get the most recent data that the lobby knows. // TODO: Relay should handle the latter case.
// If the player isn't connected to Relay, or if we just don't know about them yet, get the most recent data that the lobby knows.
// (If we have no local representation of the player, that gets added by the LocalLobby.)
LobbyUserincomingData=newLobbyUser();// TODO: This is unclear; this should be just a data object replacing that of the user, not a new user whose data are taken.