コード例 #1
0
ファイル: LoginHandler.cs プロジェクト: fry/Survivalist
        public override void Handle(LoginPacket packet)
        {
            Console.WriteLine("Connected: {0}|{1}|{2}", packet.AccountName, packet.Password, packet.Version);

            if (packet.Version != Packet.Version) {
                pipe.Close(String.Format("Invalid protocol version {0} != {1}", packet.Version, Packet.Version));
                return;
            }

            pipe.SendPacket(new LoginPacket(0, "", "", (long)server.World.Time, -1));
            pipe.SendPacket(new SetSpawnPacket(0, 64, 0));

            var player = server.World.EntityHandler.NewPlayer(pipe, packet.AccountName, packet.Password);
            var ingame = new PlayerHandler(server, pipe, player);
            server.ConnectionHandler.AddPlayer(ingame);
            server.World.EntityHandler.AddPlayer(player);
            IsFinished = true;
        }
コード例 #2
0
ファイル: PacketHandler.cs プロジェクト: fry/Survivalist
 public virtual void Handle(LoginPacket packet)
 {
     Handle(packet as Packet);
 }