This commit is contained in:
sin365 2023-12-18 12:46:21 +08:00
parent 15cfb0af8c
commit 7dd00b0936
2 changed files with 7 additions and 1 deletions

View File

@ -22,10 +22,15 @@ namespace ServerCore.Manager
private System.Timers.Timer _ClientCheckTimer; private System.Timers.Timer _ClientCheckTimer;
private long _RemoveOfflineCacheMin; private long _RemoveOfflineCacheMin;
/// <summary>
/// 初始化并指定检查时间
/// </summary>
/// <param name="ticktime">tick检查毫秒数</param>
/// <param name="RemoveOfflineCache">清理掉线分钟数</param>
public void Init(long ticktime, long RemoveOfflineCacheMin) public void Init(long ticktime, long RemoveOfflineCacheMin)
{ {
//换算成毫秒 //换算成毫秒
_RemoveOfflineCacheMin = RemoveOfflineCacheMin * 1000; _RemoveOfflineCacheMin = RemoveOfflineCacheMin;
_ClientCheckTimer = new System.Timers.Timer(); _ClientCheckTimer = new System.Timers.Timer();
_ClientCheckTimer.Interval = ticktime; _ClientCheckTimer.Interval = ticktime;
_ClientCheckTimer.AutoReset = true; _ClientCheckTimer.AutoReset = true;

View File

@ -14,6 +14,7 @@ namespace ServerCore.Manager
public static void InitServer(int port) public static void InitServer(int port)
{ {
g_ClientMgr = new ClientManager(); g_ClientMgr = new ClientManager();
g_ClientMgr.Init(45000, 120);
g_Log = new LogManager(); g_Log = new LogManager();
g_Login = new LoginManager(); g_Login = new LoginManager();
g_Chat = new ChatManager(); g_Chat = new ChatManager();