Exemplo n.º 1
0
    IEnumerator Start()
    {
        sliderSection = GameObject.Find("SliderSection").GetComponent <SliderGestureControl>();
        //slider = GetComponentInChildren<Slider>();
        //section = GetComponentInChildren<Toggle>();
        //section.isOn = false;
        toggleSection = GameObject.Find("ToggleSection").GetComponent <InteractiveToggle>();
        //toggleSection.HasSelection = false;
        status      = GameObject.Find("Status").GetComponent <TextMesh>();
        status.text = "LOADING ...";
        //status.active = false;

        //string url = "http://140.247.162.82:9000/point";
        WWW www = new WWW(url);

        yield return(www);

        if (!string.IsNullOrEmpty(www.error))
        {
            print(www.error);
            status.text = "ERROR: " + www.error + " ...";
            //waiting.enabled = true;
        }
        else
        {
            status.text = "DOWNLOADING CFD ...";
            //waiting.enabled = true;

            cfd = ArrayJson.getJsonArray <p0>(www.text);
            //StartCoroutine(CheckData());
            CheckData();
        }
        //CheckData();
    }
Exemplo n.º 2
0
    IEnumerator Start()
    {
        if (hasInternet)  // Ping.hasInternet )
        {
            // Debug.Log("MAKING HTTP CONNECTION");

            status.text = "LOADING VIA HTTP ...";
            UnityWebRequest www = UnityWebRequest.Get(url);
            yield return(www.SendWebRequest());

            /*
             * if (www.isNetworkError)
             * {
             *  Debug.Log(www.error);
             *  status.text = "ERROR NETWORK: " + www.error + " ...";
             * }
             * if (www.isHttpError)
             * {
             *  Debug.Log(www.error);
             *  status.text = "ERROR: " + www.error + " ...";
             *
             * }
             */

            // Debug.Log("Getting CFD");
            status.text = "GETTING CFD ...";

            cfd = ArrayJson.getJsonArray <p0>(www.downloadHandler.text);
        }

        else
        {
            cfd = ArrayJson.getJsonArray <p0>(Resources.Load <TextAsset>(localURL).text);
        }

        CheckData();
    }