// Methods // Public interface public void Reset() { Lobby = null; }
private void Handle_Lobby_Operation( CLobbyOperationMessage message ) { if ( Lobby == null || !CClientLogicalThread.Instance.IsConnected ) { return; } CLobbyOperation operation = message.Operation; switch ( operation.Type ) { case ELobbyOperation.Member_Joined: CLobbyMemberJoinedOperation join_op = operation as CLobbyMemberJoinedOperation; CClientResource.Output_Text< EClientTextID >( EClientTextID.Client_Lobby_Player_Joined, join_op.PlayerName ); CClientPlayerInfoManager.Instance.Begin_Player_Listen( join_op.PlayerID, join_op.PlayerName, EPlayerListenReason.In_Lobby ); break; case ELobbyOperation.Member_Left: CLobbyMemberLeftOperation leave_op = operation as CLobbyMemberLeftOperation; string player_name = CClientPlayerInfoManager.Instance.Get_Player_Name( leave_op.PlayerID ); string creator_name = CClientPlayerInfoManager.Instance.Get_Player_Name( Lobby.Creator ); EClientTextID leave_lobby_id = Compute_Leave_Lobby_Text_ID( leave_op.Reason, leave_op.PlayerID, Lobby.Creator ); if ( leave_lobby_id != EClientTextID.Invalid ) { CClientResource.Output_Text< EClientTextID >( leave_lobby_id, player_name, creator_name ); } if ( leave_op.PlayerID == CClientLogicalThread.Instance.ConnectedID ) { Lobby = null; CClientLogicalThread.Instance.Add_UI_Notification( new CUIScreenStateNotification( EUIScreenState.Chat_Idle ) ); } CClientPlayerInfoManager.Instance.End_Player_Listen( leave_op.PlayerID, EPlayerListenReason.In_Lobby ); break; case ELobbyOperation.Player_Banned: CLobbyPlayerBannedOperation ban_op = operation as CLobbyPlayerBannedOperation; CClientPlayerInfoManager.Instance.Begin_Player_Listen( ban_op.PlayerID, EPlayerListenReason.Banned_From_Lobby ); break; case ELobbyOperation.Player_Unbanned: CLobbyPlayerUnbannedOperation unban_op = operation as CLobbyPlayerUnbannedOperation; CClientPlayerInfoManager.Instance.End_Player_Listen( unban_op.PlayerID, EPlayerListenReason.Banned_From_Lobby ); break; case ELobbyOperation.Change_Game_Count: On_Lobby_Game_Count_Change( operation as CLobbyChangeGameCountOperation ); break; case ELobbyOperation.Member_Change_State: On_Lobby_State_Change( operation as CLobbyMemberChangeStateOperation ); break; } if ( Lobby != null ) { Lobby.Apply_Operation( operation ); } }
private void Join_Lobby( CLobbyState lobby_state ) { if ( Lobby != null ) { throw new CApplicationException( "Joined a second lobby while one still exists on the client." ); } Lobby = new CClientLobby( lobby_state ); Create_Player_Infos_For_Lobby_Members( Lobby ); CClientLogicalThread.Instance.Add_UI_Notification( new CUIScreenStateNotification( EUIScreenState.Lobby ) ); }
private void Create_Player_Infos_For_Lobby_Members( CClientLobby lobby ) { lobby.MemberIDs.Apply( id => CClientPlayerInfoManager.Instance.Begin_Player_Listen( id, EPlayerListenReason.In_Lobby ) ); }