public void Change_Player_State( EPersistenceID player_id, ELobbyID lobby_id, ELobbyMemberState new_state )
        {
            CServerLobby lobby = Get_Lobby( lobby_id );
            if ( lobby == null )
            {
                return;
            }

            ELobbyMemberState old_state = lobby.Get_Member_State( player_id );
            if ( old_state == new_state )
            {
                return;
            }

            CLog.Log( ELoggingChannel.Lobby, ELogLevel.Medium, String.Format( "Player {0} changed state in lobby {1} from {2} to {3}.",
                                                                                                    CConnectedPlayerManager.Get_Player_Log_Name( player_id ),
                                                                                                    Get_Lobby_Log_Description( lobby_id ),
                                                                                                    old_state.ToString(),
                                                                                                    new_state.ToString() ) );

            lobby.Set_Member_State( player_id, new_state );

            CLobbyMemberChangeStateOperation change_state_op = new CLobbyMemberChangeStateOperation( player_id, new_state );
            Send_Message_To_Members( lobby_id, new CLobbyOperationMessage( change_state_op ) );
        }
 private void Apply_Member_Change_State_Operation( CLobbyMemberChangeStateOperation operation )
 {
     LobbyState.Members[ operation.PlayerID ].State = operation.State;
 }
        private void On_Lobby_State_Change( CLobbyMemberChangeStateOperation operation )
        {
            bool is_self = operation.PlayerID == CClientLogicalThread.Instance.ConnectedID;
            switch ( operation.State )
            {
                case ELobbyMemberState.Disconnected:
                    CClientResource.Output_Text< EClientTextID >( EClientTextID.Client_Lobby_State_Change_Player_Disconnected,
                                                                                    CClientPlayerInfoManager.Instance.Get_Player_Name( operation.PlayerID ) );
                    break;

                case ELobbyMemberState.Not_Ready:
                    ELobbyMemberState previous_state = Lobby.Get_Member_State( operation.PlayerID );
                    if ( previous_state == ELobbyMemberState.Ready )
                    {
                        if ( is_self )
                        {
                            CClientResource.Output_Text< EClientTextID >( EClientTextID.Client_Lobby_State_Change_Self_Not_Ready );
                        }
                        else
                        {
                            CClientResource.Output_Text< EClientTextID >( EClientTextID.Client_Lobby_State_Change_Player_Not_Ready,
                                                                                         CClientPlayerInfoManager.Instance.Get_Player_Name( operation.PlayerID ) );
                        }
                    }
                    else
                    {
                        if ( !is_self )
                        {
                            CClientResource.Output_Text< EClientTextID >( EClientTextID.Client_Lobby_State_Change_Player_Reconnected,
                                                                                         CClientPlayerInfoManager.Instance.Get_Player_Name( operation.PlayerID ) );
                        }
                    }
                    break;

                case ELobbyMemberState.Ready:
                    if ( is_self )
                    {
                        CClientResource.Output_Text< EClientTextID >( EClientTextID.Client_Lobby_State_Change_Self_Ready );
                    }
                    else
                    {
                        CClientResource.Output_Text< EClientTextID >( EClientTextID.Client_Lobby_State_Change_Player_Ready,
                                                                                        CClientPlayerInfoManager.Instance.Get_Player_Name( operation.PlayerID ) );
                    }
                    break;
            }
        }