public bool ValidateLoginAndGetID(string name, string password, ref int userID, ref bool isFirst) { try { //Player player = LoginMgr.GetPlayerByName(name); //if (player != null && player.Password == password) //{ // userID = player.Id; // isFirst = player.IsFirst; // return true; //} Player[] list = LoginMgr.GetAllPlayer(); if (list != null) { foreach (Player p in list) { if (p.Name == name && p.Password == password) { userID = p.Id; isFirst = p.IsFirst; return(true); } } } } catch { } return(false); }
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); } }
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); } } }
public static Dictionary <int, int> GetOnlineForLine() { Dictionary <int, int> dictionary = new Dictionary <int, int>(); Player[] allPlayer = LoginMgr.GetAllPlayer(); Player[] array = allPlayer; for (int i = 0; i < array.Length; i++) { Player player = array[i]; if (player.CurrentServer != null) { if (dictionary.ContainsKey(player.CurrentServer.Info.ID)) { Dictionary <int, int> dictionary2; int iD; (dictionary2 = dictionary)[iD = player.CurrentServer.Info.ID] = dictionary2[iD] + 1; } else { dictionary.Add(player.CurrentServer.Info.ID, 1); } } } return(dictionary); }
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 static bool ValidateLoginAndGetID(string name, string password, ref int userID, ref bool isFirst) { bool result; try { Player[] list = LoginMgr.GetAllPlayer(); if (list != null) { Player[] array = list; for (int i = 0; i < array.Length; i++) { Player p = array[i]; if (p.Name == name && p.Password == password) { userID = p.Id; isFirst = p.IsFirst; result = true; return(result); } } } } catch (Exception e) { CenterServer.log.Error(e); } result = false; return(result); }
public bool ValidateLoginAndGetID(string name, string password, ref int userID, ref bool isFirst) { try { Player[] allPlayer = LoginMgr.GetAllPlayer(); if (allPlayer != null) { Player[] array = allPlayer; for (int i = 0; i < array.Length; i++) { Player player = array[i]; if (player.Name == name && player.Password == password) { userID = player.Id; isFirst = player.IsFirst; return(true); } } } } catch { } return(false); }
public static List <Player> GetServerPlayers(ServerClient server) { List <Player> list = new List <Player>(); Player[] allPlayer = LoginMgr.GetAllPlayer(); Player[] array = allPlayer; for (int i = 0; i < array.Length; i++) { Player player = array[i]; if (player.CurrentServer == server) { list.Add(player); } } return(list); }
public static int GetOnlineCount() { Player[] allPlayer = LoginMgr.GetAllPlayer(); int num = 0; Player[] array = allPlayer; for (int i = 0; i < array.Length; i++) { Player player = array[i]; if (player.State != ePlayerState.NotLogin) { num++; } } return(num); }
public static Player GetPlayerByName(string name) { Player[] allPlayer = LoginMgr.GetAllPlayer(); if (allPlayer != null) { Player[] array = allPlayer; for (int i = 0; i < array.Length; i++) { Player player = array[i]; if (player.Name == name) { return(player); } } } return(null); }