public void TranslateMessage(MessageGetGameRoomPlayersResponse message)
 {
     if (Event_OnGetGameRoomPlayersResponseTranslated != null)
     {
         Event_OnGetGameRoomPlayersResponseTranslated(null, message);
     }
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 private void TheServerToClientMessageTranslator_Event_OnGetGameRoomPlayersResponseTranslated(object sender, MessageGetGameRoomPlayersResponse e)
 {
     if (OnGetGameRoomPlayersRequestSuccessful != null)
     {
         OnGetGameRoomPlayersRequestSuccessful(null, e);
     }
 }