Esempio n. 1
0
        public Client()
        {
            message = new string[4] {
                " ", " ", " ", " "
            };

            vr       = new VRConnector();
            commands = new VRCommands(vr);
            vr.getClientInfo();

            sessionList = commands.refreshConnection(vr.readObject());
            commands.connectClient(sessionList);
            vr.Destination = vr.readObject().SelectToken("data").SelectToken("id").ToString();
            Thread readerThread = new Thread(reading);

            readerThread.Start();
            commands.route();
            commands.createPanel("hud");
            commands.find("Camera");
            commands.createPanel("chat");

            spp = new FakeData();


            Thread serverConnection = new Thread(serverReader);

            serverConnection.Start();


            Thread.Sleep(200);

            commands.addRoad(routeUuid);
            commands.follow(routeUuid, HUDUuid);
            commands.update(HUDUuid, cameraUuid);
            commands.update(HUDUuid, chatUuid);

            clientStart();
        }
Esempio n. 2
0
        public Client(NetworkStream stream)
        {
            this.stream = stream;
            message     = new string[4] {
                " ", " ", " ", " "
            };

            vr       = new VRConnector();
            commands = new VRCommands(vr);
            vr.getClientInfo();

            sessionList = commands.refreshConnection(vr.readObject());
            commands.connectClient(sessionList);
            vr.Destination = vr.readObject().SelectToken("data").SelectToken("id").ToString();
            Thread readerThread = new Thread(reading);

            readerThread.Start();
            commands.route();
            commands.bike();
            commands.createPanel("hud");
            commands.find("Camera");
            commands.createPanel("chat");
            //string[] ports = SerialPort.GetPortNames();
            //for (int i = 0; i < ports.Length; i++)
            //{
            //    try
            //    {
            //        spp = new SerialPortProgram(ports[i]);

            //    }
            //    catch (Exception e){
            //        Console.WriteLine(e.StackTrace);
            //    }
            //}
            spp = new FakeData();


            Thread serverConnection = new Thread(serverReader);

            serverConnection.Start();


            Thread.Sleep(400);


            commands.addRoad(routeUuid);
            commands.follow(routeUuid, bikeUuid);
            float[] offset = new float[3] {
                0, 5.75f, -1.5f
            };
            commands.update(bikeUuid, HUDUuid, offset);
            offset = new float[3] {
                1, 4.9f, -3f
            };
            commands.update(bikeUuid, cameraUuid, offset);
            offset = new float[3] {
                2, 5.75f, -1.5f
            };
            commands.update(bikeUuid, chatUuid, offset);
            commands.chat(message, chatUuid);
            clientStart();
        }