示例#1
0
 public void updateChat(string newMessage)
 {
     for (int i = 0; i < message.Length - 1; i++)
     {
         message[i] = message[i + 1];
     }
     message[3] = newMessage;
     commands.chat(message, chatUuid);
 }
示例#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();
        }