示例#1
0
 protected void LoginLapseTimerProc(object sender)
 {
     try
     {
         Player[] list     = LoginMgr.GetAllPlayer();
         long     now      = DateTime.Now.Ticks;
         long     interval = (long)this.m_config.LoginLapseInterval * 60L * 1000L * 10L * 1000L;
         Player[] array    = list;
         for (int i = 0; i < array.Length; i++)
         {
             Player player = array[i];
             if (player.State == ePlayerState.NotLogin)
             {
                 if (player.LastTime + interval < now)
                 {
                     LoginMgr.RemovePlayer(player.Id);
                 }
             }
             else
             {
                 player.LastTime = DateTime.Now.Ticks;
             }
         }
     }
     catch (Exception ex)
     {
         CenterServer.log.Error("LoginLapseTimer callback", ex);
     }
 }
示例#2
0
 protected void LoginLapseTimerProc(object sender)
 {
     try
     {
         Player[] list     = LoginMgr.GetAllPlayer();
         long     now      = DateTime.Now.Ticks;
         long     interval = (long)_config.LoginLapseInterval * 10 * 1000;
         foreach (Player player in list)
         {
             if (player.State == ePlayerState.NotLogin)
             {
                 if (player.LastTime + interval < now)
                 {
                     LoginMgr.RemovePlayer(player.Id);
                 }
             }
             else
             {
                 player.LastTime = now;
             }
         }
     }
     catch (Exception ex)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("LoginLapseTimer callback", ex);
         }
     }
 }
示例#3
0
 protected void LoginLapseTimerProc(object sender)
 {
     try
     {
         Player[] allPlayer = LoginMgr.GetAllPlayer();
         long     ticks     = DateTime.Now.Ticks;
         long     num       = (long)this._config.LoginLapseInterval * 10L * 1000L;
         Player[] array     = allPlayer;
         for (int i = 0; i < array.Length; i++)
         {
             Player player = array[i];
             if (player.State == ePlayerState.NotLogin)
             {
                 if (player.LastTime + num < ticks)
                 {
                     LoginMgr.RemovePlayer(player.Id);
                 }
             }
             else
             {
                 player.LastTime = ticks;
             }
         }
     }
     catch (Exception exception)
     {
         if (CenterServer.log.IsErrorEnabled)
         {
             CenterServer.log.Error("LoginLapseTimer callback", exception);
         }
     }
 }
 public bool KitoffUser(int playerID, string msg)
 {
     try
     {
         ServerClient client = LoginMgr.GetServerClient(playerID);
         if (client != null)
         {
             msg = string.IsNullOrEmpty(msg) ? "You are kicking out by GM!" : msg;
             client.SendKitoffUser(playerID, msg);
             LoginMgr.RemovePlayer(playerID);
             return(true);
         }
     }
     catch {}
     return(false);
 }
示例#5
0
        protected override void OnDisconnect()
        {
            base.OnDisconnect();
            this._rsa = (RSACryptoServiceProvider)null;
            List <Player> serverPlayers = LoginMgr.GetServerPlayers(this);

            LoginMgr.RemovePlayer(serverPlayers);
            this.SendUserOffline(serverPlayers);
            if (this.Info == null)
            {
                return;
            }
            this.Info.State  = 1;
            this.Info.Online = 0;
            this.Info        = (ServerInfo)null;
        }
示例#6
0
 protected override void OnDisconnect()
 {
     base.OnDisconnect();
     this._rsa = null;
     if (!this.IsManager)
     {
         List <Player> player = LoginMgr.GetServerPlayers(this);
         LoginMgr.RemovePlayer(player);
         this.SendUserOffline(player);
         ServerClient.log.InfoFormat("{0}({1}:{2}) disconntected!", this.Info.Name, this.Info.IP, this.Info.Port);
         if (this.Info != null)
         {
             this.Info.State  = 1;
             this.Info.Online = 0;
         }
     }
 }
示例#7
0
        protected override void OnDisconnect()
        {
            base.OnDisconnect();

            _rsa = null;
            List <Player> player = LoginMgr.GetServerPlayers(this);

            LoginMgr.RemovePlayer(player);

            //通知其他服务器,该用户下线
            SendUserOffline(player);
            //_svr.SendToALL(pkg, this);

            if (Info != null)
            {
                Info.State  = 1;
                Info.Online = 0;
                Info        = null;
            }
        }
示例#8
0
        public static bool KitoffUser(int playerID, string msg)
        {
            bool result;

            try
            {
                ServerClient client = LoginMgr.GetServerClient(playerID);
                if (client != null)
                {
                    msg = (string.IsNullOrEmpty(msg) ? "You are kicking out by GM!" : msg);
                    client.SendKitoffUser(playerID, msg);
                    LoginMgr.RemovePlayer(playerID);
                    result = true;
                    return(result);
                }
            }
            catch
            {
            }
            result = false;
            return(result);
        }