コード例 #1
0
    private void OnBuildingRequestComplete(string response)
    {
        Action action = () =>
        {
            Dictionary <string, OnlineMapsOSMNode> nodes;
            List <OnlineMapsOSMWay>      ways;
            List <OnlineMapsOSMRelation> relations;

            OnlineMapsOSMAPIQuery.ParseOSMResponse(response, out nodes, out ways, out relations);

            lock (newBuildingsData)
            {
                foreach (OnlineMapsOSMWay way in ways)
                {
                    newBuildingsData.Add(new OnlineMapsBuildingsNodeData(way, nodes));
                }
            }

            sendBuildingsReceived = true;
        };

#if !UNITY_WEBGL
        OnlineMapsThreadManager.AddThreadAction(action);
#else
        action();
#endif

        if (OnRequestComplete != null)
        {
            OnRequestComplete();
        }
    }
コード例 #2
0
        /// This event called when the request is completed.
        private void OnComplete(string response)
        {
            List <OnlineMapsOSMNode>     nodes;
            List <OnlineMapsOSMWay>      ways;
            List <OnlineMapsOSMRelation> relations;

            // Get nodes, ways and relations from response
            OnlineMapsOSMAPIQuery.ParseOSMResponse(response, out nodes, out ways, out relations);

            foreach (OnlineMapsOSMWay way in ways)
            {
                // Log highway type
                Debug.Log(way.tags.FirstOrDefault(t => t.key == "highway").value);
            }
        }