private void InitTimer() { System.Timers.Timer timer = new System.Timers.Timer(50); timer.Elapsed += new System.Timers.ElapsedEventHandler((sender, e) => { TimerMgr.GetInstance().Update(50); }); timer.AutoReset = true; timer.Enabled = true; }
public void Reconnect() { this.AddState(RoutePlayerState.CONNECTED); TimerMgr.GetInstance().DelTimer(this.LogoutTimerId); //重连时发送断线期间的信息 for (int i = 0; i < this.MsgCache.Count; i++) { this.SendMsg(this.MsgCache[i]); } }
void Start() { FrameMgr.GetInstance(); TimerMgr.GetInstance(); PathMgr.GetInstance(); ConfigMgr.GetInstance(); AssetMgr.GetInstance(); UIMgr.GetInstance(); SoundMgr.GetInstance(); LoadSceneMgr.LoadSence("test"); }
public void Disconnect() { this.CancelState(RoutePlayerState.CONNECTED); //3分钟重连时间 this.LogoutTimerId = TimerMgr.GetInstance().AddTimer(3 * 60 * 1000, data => { this.Logout(); }, null); RSPlayerDisconnect protocol = new RSPlayerDisconnect(); protocol.PlayerId = this.PlayerId; Server.GetInstance().SendMsgToAllServer(protocol); }
public ServerSocket() { TimerMgr.GetInstance().AddTimer(50, this.HandleMsg, null, true); }