public void TranslateMessage(int clientID, MessageGetGameRoomPlayersRequest message) { if (TranslatedMessageGetGamePlayersRequest != null) { TranslatedMessageGetGamePlayersRequest(clientID, message); } }
public void OnClientMessage_MessageGetGameRoomPlayersRequest(int clientID, MessageGetGameRoomPlayersRequest message, GameRoomManager gameRoomManager, GameClientManager gameClientManager) { var roomID = message.RoomID; var roomHostClientID = gameRoomManager.GetGameRoomHostClientIDFromGameRoomID(message.RoomID); var players = new List <ANetworkPlayer>(); var playerManager = new PlayerManager(); players.Add(playerManager.GeneratePlayerFromClientID(roomHostClientID, message.RoomID, gameClientManager, gameRoomManager)); //the first clientID will be the host var clientIDs = gameRoomManager.GetGameClientsInRoom(roomID); for (int i = 0; i < clientIDs.Count; i++) { if (clientIDs[i] != roomHostClientID) { players.Add(playerManager.GeneratePlayerFromClientID(clientIDs[i], message.RoomID, gameClientManager, gameRoomManager)); } } var messageResponse = new MessageGetGameRoomPlayersResponse(players); var gameClient = gameClientManager.GetGameClientFromClientID(clientID); SendDataToClient(gameClient, messageResponse); }
private void TheClientToServerMeossageTranslator_TranslatedMessageGetGamePlayersRequest(object clientID, MessageGetGameRoomPlayersRequest e) { TheClientToServerMessenger.OnClientMessage_MessageGetGameRoomPlayersRequest((int)clientID, e, TheGameRoomManager, TheGameClientManager); }