Пример #1
0
        public static void Start()
        {
            Packet.RegisterHandler(PacketId.Scene, HandleScene);
            Packet.RegisterHandler(PacketId.Objects, HandleObjects);
            Packet.RegisterHandler(PacketId.AuthResponse, HandleAuthResponse);
            Packet.RegisterHandler(PacketId.Message, HandleMessage);

            NetObject.RegisterNetObject(typeof(NetShip));
            NetObject.RegisterNetObject(typeof(NetAsteroid));
            NetObject.RegisterNetObject(typeof(NetBullet));

            var config = new NetPeerConfiguration(Constants.ApplicationIdentifier);

            client = new NetClient(config);
            client.Start();

            Connect();
        }
Пример #2
0
        public static void Start()
        {
            Packet.RegisterHandler(PacketId.Auth, HandleAuth);
            Packet.RegisterHandler(PacketId.Upload, HandleUpload);

            NetObject.RegisterNetObject(typeof(NetShip));
            NetObject.RegisterNetObject(typeof(NetAsteroid));
            NetObject.RegisterNetObject(typeof(NetBullet));

            SessionManager = new SessionManager();

            var config = new NetPeerConfiguration(Constants.ApplicationIdentifier);

            config.Port = Constants.Port;

            server = new NetServer(config);
            server.Start();
        }