/// <summary> /// Constructor /// </summary> /// <param name="info"></param> public Scene(ServerInfo info) { _info = info; _info.Online = 0; _info.State = 2; _players = new Dictionary<int, GamePlayer>(); _locker = new ReaderWriterLock(); }
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; } }
public Scene(ServerInfo info) { }
/// <summary> /// 战斗服务器登陆 /// </summary> /// <param name="pkg"></param> public void HandleLogin(GSPacketIn pkg) { //pkg.ReadBytes(2); byte[] rgb = pkg.ReadBytes(); string[] temp = Encoding.UTF8.GetString(_rsa.Decrypt(rgb, false)).Split(','); if (temp.Length == 2) { _rsa = null; int id = int.Parse(temp[0]); Info = ServerMgr.GetServerInfo(id); if (Info == null || Info.State != 1) { log.ErrorFormat("Error Login Packet from {0} want to login serverid:{1}", TcpEndpoint, id); Disconnect(); } else { Strict = false; //SendASS(CenterServer.Instance.ASSState); CenterServer.Instance.SendConfigState(); Info.Online = 0; Info.State = 2; } } else { log.ErrorFormat("Error Login Packet from {0}", TcpEndpoint); Disconnect(); } }