public static void Tick() { LoadBanFile(); if (null == m_BanList) { return; } // 如果需要清除 就清除掉 if (m_IsNeedClear > 0) { m_BanList.Clear(); m_IsNeedClear = 0; } bool bCrashForce = GameManager.VersionSystemOpenMgr.IsVersionSystemOpen(VersionSystemOpenKey.CrashUnityForce); int i = 20; while (i > 0 && m_BanList.Count > 0) { i--; string userID = m_BanList[m_BanList.Count - 1]; m_BanList.RemoveAt(m_BanList.Count - 1); BanManager.BanUserID2Memory(userID); TMSKSocket clientSocket = GameManager.OnlineUserSession.FindSocketByUserID(userID); if (null == clientSocket) { continue; } GameClient gameClient = GameManager.ClientMgr.FindClient(clientSocket); // 封号删除 if (null != gameClient) { RoleData roleData = new RoleData() { RoleID = StdErrorCode.Error_70 }; gameClient.sendCmd((int)TCPGameServerCmds.CMD_INIT_GAME, roleData); //string gmCmdData = string.Format("-ban4 {0} 1", gameClient.ClientData.RoleID); //转发GM消息到DBServer //GameManager.DBCmdMgr.AddDBCmd((int)TCPGameServerCmds.CMD_SPR_CHAT, // string.Format("{0}:{1}:{2}:{3}:{4}:{5}:{6}:{7}:{8}", 0, "", 0, "", 0, gmCmdData, 0, 0, 0, 0, GameManager.ServerLineID), // null, GameManager.LocalServerId); if (bCrashForce) { SendMagicCrashMsg(gameClient, MagicCrashUnityType.CrashTimeOut); } // log it! LogManager.WriteLog(LogTypes.FileBan, string.Format("FileBanLogic ban2 userID={0} roleID={1}", userID, gameClient.ClientData.RoleID)); } else { // log it! //关闭连接 Global.ForceCloseSocket(clientSocket, "被禁止登陆"); LogManager.WriteLog(LogTypes.FileBan, string.Format("FileBanLogic ForceCloseSocket userID={0}", userID)); } } }