private void Start() { _rigidbody = GetComponent <Rigidbody>(); _animator = GetComponent <Animator>(); _originPosition = transform.position; _originRotation = transform.rotation; _currentSpeed = _speed; _volume.profile.TryGet <FilmGrain>(out _grain); _dollyComponent = _dolly.GetComponent <Dolly>(); }
public Form1() { InitializeComponent(); logoPicture.Image = new Bitmap("logo.png"); remotePicture.Image = new Bitmap("MVRemote.jpg"); reportText.AppendText(Environment.NewLine + String.Format("{0,-20}{1,-15}{2,-29}{3}\n", DateTime.Now.ToString("yyyy/MM/dd HH:mm"), "XXXXXXX", "1,2,3", "XXX")); dolly = new Dolly(this); using (StreamReader sr = new StreamReader("dolly.txt")) { string line; while ((line = sr.ReadLine()) != null) { string[] args = line.Split(new char[] { ' ', '=', '\t' }); switch (args[0]) { case "RadarIP": dolly.DollyIP = args[1]; break; case "SpeedX": dolly.SpeedX = int.Parse(args[1]); break; case "SpeedY": dolly.SpeedY = int.Parse(args[1]); break; case "SpeedR": dolly.SpeedR = int.Parse(args[1]); break; case "MaxSpeed": dolly.MaxSpeed = int.Parse(args[1]); break; case "MaxAccel": dolly.MaxAccel = int.Parse(args[1]); break; case "MaxCurrent": dolly.MaxCurrent = int.Parse(args[1]); break; case "Current": dolly.Current = int.Parse(args[1]); break; case "CurrentThreshold": dolly.CurrentThreshold = int.Parse(args[1]); break; default: break; } } dolly.Start(); } try { using (StreamReader sr = new StreamReader("config.txt")) { String[] args; sqlConnectionString = sr.ReadLine(); comName = sr.ReadLine(); LedComName = sr.ReadLine(); ledBaudRate = int.Parse(sr.ReadLine()); localIp = sr.ReadLine(); for (int i = 0; i < 3; i++) { radarIp[i] = sr.ReadLine(); args = sr.ReadLine().Split(new char[] { ' ', ',' }); for (int j = 0; j < 5; j++) { configIntegration[i, j] = int.Parse(args[j]); } args = sr.ReadLine().Split(new char[] { ' ', ',' }); for (int j = 0; j < 5; j++) { configSensitivity[i, j] = int.Parse(args[j]); } args = sr.ReadLine().Split(new char[] { ' ', ',' }); for (int j = 0; j < 5; j++) { configStart[i, j] = Single.Parse(args[j]); } args = sr.ReadLine().Split(new char[] { ' ', ',' }); for (int j = 0; j < 5; j++) { configRange[i, j] = Single.Parse(args[j]); } Radar r = new Radar(new IPEndPoint(IPAddress.Parse(radarIp[i]), 21000), this, i + 1); r.OperationMode = 1; r.MRMCodeChannel = (byte)(i + 1); radarList.Add(r); } comboBox1.SelectedIndex = int.Parse(sr.ReadLine()); plateInitial = sr.ReadLine().Split(new char[] { ' ', ',' }); foreach (string s in plateInitial) { plateInitialCombo.Items.Add(s); } plateInitialCombo.SelectedIndex = 0; inspectors = sr.ReadLine().Split(new char[] { ' ', ',' }); foreach (string s in inspectors) { inspectorCombo.Items.Add(s); } inspectorCombo.SelectedIndex = 0; passText = sr.ReadLine(); vibText = sr.ReadLine(); radarText = sr.ReadLine(); } } catch (Exception e) { statusTextBox.AppendText(String.Format("{0,-20}", DateTime.Now.ToString("yyyy/MM/dd HH:mm")) + "配置文件读取异常" + Environment.NewLine); } led = new LedDisplay(this, LedComName.Remove(0, 3), ledBaudRate); port.PortName = comName; port.BaudRate = 9600; port.Parity = Parity.None; port.StopBits = StopBits.One; port.DataBits = 8; port.Handshake = Handshake.None; port.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler); sql = new SqlClient(this, sqlConnectionString); try { port.Open(); } catch (Exception e) { statusTextBox.AppendText(String.Format("{0,-20}", DateTime.Now.ToString("yyyy/MM/dd HH:mm")) + "串口打开失败,微震无法正常使用" + Environment.NewLine); //graphicTimer.Start(); connectAllButton.Enabled = true; timeTimer.Start(); return; } bytesRead = -1; expectingZero = false; try { tcpServer = new TcpListener(IPAddress.Parse(localIp), 12000); tcpServer.Start(); tcpServer.BeginAcceptTcpClient(new AsyncCallback(endConnection), null); udpServer = new UdpClient(new IPEndPoint(IPAddress.Parse(localIp), 13000)); udpReceiveTask = Task.Factory.StartNew(udpReceiving, TaskCreationOptions.LongRunning); } catch (Exception e) { statusTextBox.AppendText(String.Format("{0,-20}", DateTime.Now.ToString("yyyy/MM/dd HH:mm")) + "微震服务器初始化失败,请检查配置文件后重启程序" + Environment.NewLine); } connectAllButton.Enabled = true; timeTimer.Start(); }