Exemplo n.º 1
0
    IEnumerator SetTargetLocationFromServer(string tag)
    {
        //TODO: change URL
        string          uri = "https://revamp-api.herokuapp.com/item/";
        UnityWebRequest uwr = UnityWebRequest.Post(uri, tag);

        yield return(uwr.SendWebRequest());

        if (uwr.isNetworkError)
        {
            Debug.Log("Error While Sending: " + uwr.error);
        }
        else
        {
            ProductInfo productInfo = new ProductInfo();
            productInfo    = ProductInfo.CreateFromJSON(uwr.downloadHandler.text);
            targetLocation = GameObject.FindWithTag(productInfo.name);
            targetChanged  = true;
        }
    }
Exemplo n.º 2
0
    IEnumerator SetProductDescFromServer(VuMarkTarget vuMarkTarget)
    {
        string id  = GetVuMarkId(vuMarkTarget);
        string uri = "http://revamp.ap-southeast-1.elasticbeanstalk.com/item/" + id;
        //string uri = "https://revamp-api.herokuapp.com/item/" + id;
        UnityWebRequest uwr = UnityWebRequest.Get(uri);

        yield return(uwr.SendWebRequest());

        if (uwr.isNetworkError)
        {
            Debug.Log("Error While Sending: " + uwr.error);
        }
        else
        {
            ProductInfo productInfo = new ProductInfo();
            productInfo = ProductInfo.CreateFromJSON(uwr.downloadHandler.text);
            yield return(downloadProductImage(vuMarkTarget, productInfo.url));

            vumarkProductInfos.Add(GetVuMarkId(vuMarkTarget), productInfo);
        }
    }