private void UpdateNeighbours() { Call call = new Call(POSITION_REG_DRIVER, "listNeighbours"); call.AddParameter("latitude", pos.latitude) .AddParameter("longitude", pos.longitude) .AddParameter("delta", pos.delta) .AddParameter("range", neighbourSearchRange); Response r = gateway.CallService(webHost, call); if ((r != null) && string.IsNullOrEmpty(r.error)) { try { var list = new List <WorldEntity>(); var clients = (IList <object>)r.GetResponseData("clients"); foreach (var client in clients) { var data = (IDictionary <string, object>)client; int id = UOS.Util.ConvertOrParse <int>(data["id"]); string meta = ""; object metaObj; if (data.TryGetValue("metadata", out metaObj)) { meta = metaObj.ToString().Trim().ToLower(); } if ((id != (int)myPosRegId) && meta.Contains("ubimon")) { WorldEntity e = new WorldEntity(); e.id = id; e.name = data["name"] as string; e.pos = GlobalPosition.FromJSON(data); e.distance = UOS.Util.ConvertOrParse <double>(data["distance"]); object deviceDesc = data["device"]; e.deviceDesc = (deviceDesc is string) ? (string)deviceDesc : MiniJSON.Json.Serialize(deviceDesc); e.type = WorldEntity.Type.Player; if (meta.Contains("station")) { e.type = WorldEntity.Type.Station; } else if (meta.Contains("gathering")) { e.type = WorldEntity.Type.GatheringPoint; } list.Add(e); } } list.Sort((a, b) => a.distance.CompareTo(b.distance)); neighbours = list; } catch (System.Exception e) { ((UnityGateway)uOS.gateway).logger.Log(e.ToString()); } } }