private void GameClientOnLobbyPlayersUpdated(LobbyPlayersUpdate lobbyPlayersUpdate) { var lobbyPlayers = new List <LobbyPlayer>(); foreach (var lobbyPlayer in lobbyPlayersUpdate.LobbyPlayers) { lobbyPlayers.Add(new LobbyPlayer(lobbyPlayer.PlayerId, lobbyPlayer.PlayerName, Color.FromArgb(lobbyPlayer.Color), (PlayerPosition)lobbyPlayer.PlayerPosition)); } _lobbyPlayers = lobbyPlayers; LobbyPlayersUpdated?.Invoke(lobbyPlayers); }
private void LobbyPlayersUpdate() { var allLobbyPlayers = GetAllLobbyPlayers(); var lobbyPlayersUpdate = new LobbyPlayersUpdate(new List <VsadilNestihl.Networking.Messages.Lobby.LobbyPlayer>()); foreach (var lobbyPlayer in allLobbyPlayers) { lobbyPlayersUpdate.LobbyPlayers.Add(new VsadilNestihl.Networking.Messages.Lobby.LobbyPlayer( lobbyPlayer.PlayerId, lobbyPlayer.PlayerName, lobbyPlayer.Color.ToArgb(), (int)lobbyPlayer.PlayerPosition)); } LobbyPlayersUpdated?.Invoke(allLobbyPlayers); foreach (var lobbyPlayer in allLobbyPlayers.Where(x => x.PlayerHandler != null)) { lobbyPlayer.PlayerHandler.LobbyPlayersUpdate(lobbyPlayersUpdate); } }
private void OnLobbyPlayersUpdate(LobbyPlayersUpdate lobbyPlayersUpdate) { LobbyPlayersUpdated?.Invoke(lobbyPlayersUpdate); }