public void MakeRequest(string url, Delegates.AssetServiceCallback requestCallback) { NetworkRequestObject requestObject = new NetworkRequestObject(this, OnRequestCompleted); pendingRequests.Add(requestObject); requestObject.MakeRequest(url, requestCallback); }
private void OnRequestCompleted(NetworkRequestObject requestObject) { if (pendingRequests.Contains(requestObject)) { pendingRequests.Remove(requestObject); } }
public static void NetworkRequestStart(NetworkRequestObject requestObject) { if (OnNetworkRequestStart != null) { OnNetworkRequestStart(requestObject); } }
private void NetworkEvent_OnNetworkRequestStart(NetworkRequestObject requestObject) { if (requestObject.Url == Configuration.API_URL + AssetService.MODELS_URI + modelIndex.ToString()) { observableNetworkRequest = requestObject; ShowProgress(); } }
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; }