public void UpdateData(JClient rawClientData) { lock (lockData) { this.contentString = rawClientData.ContentString; parseObjects(); } }
protected override void parseObjects() { nearbyClients = new List<JClient>(); nearbyShots = new List<JShot>(); JObject o = JObject.Parse(ContentString); JObject jMe = (JObject)o["me"]; me = new JClient(jMe.ToString()); JObject jNearbyClients = (JObject)o["nearby-clients"]; jNearbyClients.Properties().ToList().ForEach(prop => { JObject client = (JObject)prop.Value; nearbyClients.Add(new JClient(client.ToString())); }); JObject jNearbyShots = (JObject)o["nearby-shots"]; jNearbyShots.Properties().ToList().ForEach(prop => { JObject client = (JObject)prop.Value; nearbyShots.Add(new JShot(client.ToString())); }); }
void specClient_ClientDisconnected(JClient client) { lock (lockClientArrInterp) { clientArrInterp.RemoveAll(C => C.Id == client.Id); } }
void specClient_ClientConnected(JClient client) { lock (lockClientArrInterp) { clientArrInterp.Add(new InterpolatedClient(client.ContentString)); } }