Exemple #1
0
        /// <summary>
        /// 擦出所有数据
        /// </summary>
        /// <param name="conn"></param>
        void RemoveData(Conn conn)
        {
            //修改个人状态
            PersonalInfo.ChangeStatusInfo(int.Parse(conn.ID), "", (int)PersonStatus.OffLine);
            //房间移除成员
            string       strContent = "SELECT * FROM counter where id=" + conn.ID + " ;";
            PersonalInfo user       = SqlConn.Select(strContent);

            ConsoleHelper.WriteColorLine("用户:" + user.id + "已超时断开连接   所在房间:" + user.roomNum, ConsoleColor.Red);

            //玩家退出不修改其所在房间的id值,为以后做离线重连继续战斗做准备
            RoomInfo roomInfo = GameCommand.GetRoom(user.roomNum);

            if (roomInfo != null)
            {
                roomInfo.RemoveMember(user.id);
            }

            Server.connMap.Remove(conn.ID);           //清除连接
            Server.connHeartTime.Remove(conn.ID);     //清除心跳包
            OffLineDetection.clients.Remove(conn.ID); //清除离线客户
        }