private void Apply_Member_Joined_Operation( CLobbyMemberJoinedOperation operation ) { if ( operation.MemberType == ELobbyMemberType.Observer ) { LobbyState.Observers.Add( operation.PlayerID ); } else if ( operation.MemberType == ELobbyMemberType.Player ) { Dictionary< uint, EPersistenceID > players = LobbyState.PlayersBySlot; if ( players.ContainsKey( operation.MemberIndex ) ) { throw new CApplicationException( "Lobby member collision" ); } players.Add( operation.MemberIndex, operation.PlayerID ); Mark_Players_Not_Ready(); } else { throw new CApplicationException( "Invalid member type in lobby join operation." ); } LobbyState.Members.Add( operation.PlayerID, new CLobbyMember( operation.PlayerID ) ); }
private void On_Join_Lobby_Success( EPersistenceID player_id, EMessageRequestID request_id, ELobbyID lobby_id ) { CConnectedPlayer player = CConnectedPlayerManager.Instance.Get_Player_By_Persistence_ID( player_id ); player.On_Join_Lobby_Success( lobby_id ); CServerLobby lobby = Get_Lobby( lobby_id ); CLog.Log( ELoggingChannel.Lobby, ELogLevel.Medium, String.Format( "Player {0} successfully joined lobby {1}.", player.Name, lobby.GameDescription ) ); CJoinLobbySuccess join_response = new CJoinLobbySuccess( request_id, lobby.Clone_State() ); CServerMessageRouter.Send_Message_To_Player( join_response, player_id ); ELobbyMemberType member_type; uint member_index; lobby.Get_Member_Info( player_id, out member_index, out member_type ); CLobbyMemberJoinedOperation op = new CLobbyMemberJoinedOperation( player_id, player.Name, member_type, member_index ); Send_Message_To_Members( lobby_id, new CLobbyOperationMessage( op ), player_id ); }