Esempio n. 1
0
    public void MakeRequest(string url, Delegates.AssetServiceCallback requestCallback)
    {
        NetworkRequestObject requestObject = new NetworkRequestObject(this, OnRequestCompleted);

        pendingRequests.Add(requestObject);
        requestObject.MakeRequest(url, requestCallback);
    }
Esempio n. 2
0
 private void OnRequestCompleted(NetworkRequestObject requestObject)
 {
     if (pendingRequests.Contains(requestObject))
     {
         pendingRequests.Remove(requestObject);
     }
 }
Esempio n. 3
0
 public static void NetworkRequestStart(NetworkRequestObject requestObject)
 {
     if (OnNetworkRequestStart != null)
     {
         OnNetworkRequestStart(requestObject);
     }
 }
Esempio n. 4
0
 private void NetworkEvent_OnNetworkRequestStart(NetworkRequestObject requestObject)
 {
     if (requestObject.Url == Configuration.API_URL + AssetService.MODELS_URI + modelIndex.ToString())
     {
         observableNetworkRequest = requestObject;
         ShowProgress();
     }
 }
Esempio n. 5
0
    IEnumerator ProgressRoutine()
    {
        while (observableNetworkRequest != null && observableNetworkRequest.isPending)
        {
            // Debug.LogFormat("Request progress: {0}", observableNetworkRequest.currentProgress);
            progressSlider.value    = (int)(observableNetworkRequest.currentProgress * 100);
            progressFillImage.color = GetProgressColor(observableNetworkRequest.currentProgress);
            progressText.text       = string.Format("{0}%", (int)(observableNetworkRequest.currentProgress * 100));
            yield return(null);
        }

        observableNetworkRequest = null;
        statusImage.enabled      = true;
    }