private void HandlePlayerJoined(Message message)
    {
        ushort id;
        string name;

        using (DarkRiftReader reader = message.GetReader())
        {
            id   = reader.ReadUInt16();
            name = reader.ReadString();
        }

        _lobbyStateManager.AddPlayerToLobby(id, name);
        ushort sceneIndex = (ushort)2;

        _lobbyMessageSender.SendLoadLobbyMessage(id, sceneIndex);
    }
Exemple #2
0
 private void ParseUpdateLobbyMessage(Message message)
 {
     Debug.Log("Updated Lobby");
     _connectedPlayers.Clear();
     using (DarkRiftReader reader = message.GetReader())
     {
         while (reader.Position < reader.Length)
         {
             ushort id       = reader.ReadUInt16();
             bool   ready    = reader.ReadBoolean();
             string nickname = reader.ReadString();
             _lobbyManager.AddPlayerToLobby(id, nickname, ready);
             _connectedPlayers.Add(id);
         }
         _lobbyManager.CheckDisconnectedPlayers(_connectedPlayers);
     }
 }