Example #1
0
 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;
 }
Example #2
0
    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]);
        }
    }
Example #3
0
 void Start()
 {
     FrameMgr.GetInstance();
     TimerMgr.GetInstance();
     PathMgr.GetInstance();
     ConfigMgr.GetInstance();
     AssetMgr.GetInstance();
     UIMgr.GetInstance();
     SoundMgr.GetInstance();
     LoadSceneMgr.LoadSence("test");
 }
Example #4
0
    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);
    }
Example #5
0
 public ServerSocket()
 {
     TimerMgr.GetInstance().AddTimer(50, this.HandleMsg, null, true);
 }