public void UpdatePlayer(GameLobbyPlayerData player) { playerData = player; playerNameText.text = playerData.Name; playerReadyToggle.isOn = playerData.Ready; backgroundImage.color = Id == ColyseusConnector.Instance.Client.id ? OwnClientColor : NormalColor; ownerImage.enabled = player.Owner; }
void UpdatePlayer(GameLobbyPlayerData playerData) { var listing = playerListings.FirstOrDefault(l => l.Id == playerData.Id); if (listing == null) { listing = CreateNewListing(); } listing.UpdatePlayer(playerData); }
public static GameLobbyPlayerData ReadPlayer(object playerEntry, string ownerId) { var player = ReadObject(playerEntry); var id = player["id"] as string; var playerData = new GameLobbyPlayerData { Id = id, Name = player["name"] as string, Ready = player["ready"] as bool? == true, Owner = id == ownerId, }; return(playerData); }