Beispiel #1
0
        private void OnFetchGraphResponse(bool error, Spaces.Core.RestAPI.RestGetSpaceMetadataResponse metadata)
        {
            if (error)
            {
                ProcessError(Process.FetchingGraph);
            }
            else
            {
                //Graph = JsonUtility.FromJson<SpaceGraph>(metadata.metadata);
                Graph = metadata.spaceGraph;

                if (Graph == null)
                {
                    Graph = new SpaceGraph();
                }

                if (Graph.assetIDs == null)
                {
                    Graph.assetIDs = new List <string>(assetIDs);
                }
                else
                {
                    assetIDs = Graph.assetIDs;
                }

                isGraphFetched = true;
                SaveGraphToCache();
                ProcessEnd(Process.FetchingGraph);
            }
        }
Beispiel #2
0
    void OnGetMetadataResponse(bool error, Spaces.Core.RestAPI.RestGetSpaceMetadataResponse metadata)
    {
        if (error)
        {
            Debug.Log("Retrieval fail. Blurgh.");
        }
        else
        {
            Debug.Log("Check out this dope Metadata! :\n" + metadata.metadata);

            Debug.Log("Gonna build me a node!");
            Node reconstitutedNode = JsonUtility.FromJson <Node>(metadata.metadata);

            if (reconstitutedNode != null)
            {
                StartCoroutine(Node.RenderNodeTree(reconstitutedNode));
            }
        }
    }
Beispiel #3
0
        public void GetSpaceMetadataResponse(bool error, string response)
        {
            if (error)
            {
                doneCallback(true, null);
            }
            else
            {
                try
                {
                    TinyJSON.Variant test;
                    var getSpaceMetadataResponse = TinyJSON.Decoder.Decode(response) as TinyJSON.ProxyObject;
                    var spaceMetadata            = new RestGetSpaceMetadataResponse();

                    spaceMetadata.metadata   = getSpaceMetadataResponse.TryGetValue("metadata", out test) ? test.ToString().Trim('"').Replace("\\\"", "\"").Replace("\\\\\"", "\\\"") : "";
                    spaceMetadata.spaceGraph = JsonUtility.FromJson <SpaceGraph>(spaceMetadata.metadata);

                    if (spaceMetadata.spaceGraph == null)
                    {
                        spaceMetadata.spaceGraph = new SpaceGraph();
                    }

                    if (spaceMetadata.spaceGraph.nodes == null)
                    {
                        spaceMetadata.spaceGraph.nodes = new List <Node>();
                    }

                    doneCallback(false, spaceMetadata);
                }
                catch (System.Exception e)
                {
                    UnityEngine.Debug.LogException(e);
                    doneCallback(true, null);
                }
            }
        }