public void UpdateRoomInfoToLobby(RoomLogic roomLogic)
 {
     // 通知大厅(往大厅发送消息)
     Protobuf.Lobby.UpdateRoomInfo output2 = new Protobuf.Lobby.UpdateRoomInfo()
     {
         RoomId         = roomLogic.RoomId,
         RoomName       = roomLogic.RoomName,
         Creator        = roomLogic.Creator,
         CurPlayerCount = roomLogic.CurPlayerCount,
         MaxPlayerCount = roomLogic.MaxPlayerCount,
         IsRunning      = true,
         IsRemove       = false,
     };
     MixedManager.Instance.LobbyManager.SendMsg(Protobuf.Lobby.LOBBY.UpdateRoomInfo, output2.ToByteArray());
 }
    public void RemovePlayer(SocketAsyncEventArgs args, bool bCloseRoomIfNoUser)
    {
        bool       ret = false;
        PlayerInfo pi  = GetPlayer(args);

        if (pi == null)
        {
            Log($"RoomManager RemovePlayer Error - Player not found!");
            return;
        }

        // 如果该玩家还没有离开房间, 则要离开这个房间
        RoomLogic roomLogic = Rooms[pi.RoomId];

        if (roomLogic.IsOnline(pi.Enter.TokenId))
        {
            roomLogic.Offline(pi.Enter.TokenId);

            // 通知大厅
            UpdateRoomInfoToLobby(roomLogic);
        }

        // 最后看是否需要关闭房间
        if (roomLogic.CurPlayerCount == 0 && bCloseRoomIfNoUser)
        {                     // 关闭房间
            roomLogic.Fini(); // 结束化
            Rooms.Remove(pi.RoomId);
            // 通知大厅:删除房间
            Protobuf.Lobby.UpdateRoomInfo output2 = new Protobuf.Lobby.UpdateRoomInfo()
            {
                RoomId   = roomLogic.RoomId,
                IsRemove = true,
            };
            MixedManager.Instance.LobbyManager.SendMsg(Protobuf.Lobby.LOBBY.UpdateRoomInfo, output2.ToByteArray());
        }
        Players.Remove(args);
    }