void Update() { while (_stringsToParse.Count > 0) { try { byte[] toProcess = _stringsToParse.First(); if (toProcess != null) { // TMA: THe first char distinguishes between a BodyMessage and a CloudMessage if (Convert.ToChar(toProcess[0]) == 'C') { string stringToParse = Encoding.ASCII.GetString(toProcess); string[] splitmsg = stringToParse.Split(MessageSeparators.L0); message.set(splitmsg[1], toProcess, splitmsg[0].Length); gameObject.GetComponent <Tracker>().setNewCloud(message); } else if (Convert.ToChar(toProcess[0]) == 'A') { Debug.Log("Got Calibration Message! "); string stringToParse = Encoding.ASCII.GetString(toProcess); string[] splitmsg = stringToParse.Split(MessageSeparators.L0); AvatarMessage av = new AvatarMessage(splitmsg[1], toProcess); gameObject.GetComponent <Tracker>().processAvatarMessage(av); } else if (Convert.ToChar(toProcess[0]) == 'S') { Debug.Log("Got Surfaces Message! "); string stringToParse = Encoding.ASCII.GetString(toProcess); string[] s = stringToParse.Split(MessageSeparators.L0); if (s.Length == 2) { GameObject.Find("Main").GetComponent <Main>().receiveSurface(s[1]); } else { Debug.LogError("NO SURFACE"); } } } _stringsToParse.RemoveAt(0); } catch (Exception exc) { _stringsToParse.RemoveAt(0); } } }
void Update() { if (_startConfig) { //udpRestart(); _startConfig = false; } if (_start) { while (_stringsToParse.Count > 0) { try { byte[] toProcess = _stringsToParse.First(); if (toProcess != null) { // TMA: THe first char distinguishes between a BodyMessage and a CloudMessage if (Convert.ToChar(toProcess[0]) == 'C') { string stringToParse = Encoding.ASCII.GetString(toProcess); string[] splitmsg = stringToParse.Split(MessageSeparators.L0); message.set(splitmsg[1], toProcess, splitmsg[0].Length); gameObject.GetComponent <Tracker>().setNewCloud(message); } else if (Convert.ToChar(toProcess[0]) == 'A') { Debug.Log("Got Calibration Message! "); string stringToParse = Encoding.ASCII.GetString(toProcess); string[] splitmsg = stringToParse.Split(MessageSeparators.L0); AvatarMessage av = new AvatarMessage(splitmsg[1], toProcess); gameObject.GetComponent <Tracker>().processAvatarMessage(av); } } _stringsToParse.RemoveAt(0); } catch (Exception exc) { _stringsToParse.RemoveAt(0); } } } }