void OnGUI() { // Start download the audio file if (!GetComponent <UnityEngine.AudioSource>().isPlaying&& GUI.Button(new Rect(10, 10, 200, 60), "Play")) { StartDownload(); } // Display some info if an audio is playing if (GetComponent <UnityEngine.AudioSource>().isPlaying) { GUI.Label(new Rect(10, 100, 200, 30), string.Format("{0} / {1}", GetComponent <UnityEngine.AudioSource>().time, lengthInSec)); if (clip != null) { GUI.Label(new Rect(10, 140, 400, 30), string.Format("Downloaded: {0} / {1} - {2:P2}", downloadedBytes, frames, downloadedBytes / (float)downloadLength)); } } HTTPManager.IsCachingDisabled = GUI.Toggle(new Rect(10, 180, 400, 30), HTTPManager.IsCachingDisabled, "Caching Disabled"); if (GUI.Button(new Rect(3, Screen.height - 200, -5 + Screen.width / 2, 195), "Clear cache")) { HTTPCacheService.BeginClear(); } // Go back to the demo selector if (GUI.Button(new Rect(20 + Screen.width / 2, Screen.height - 200, -30 + Screen.width / 2, 195), "Back")) { Application.LoadLevel(0); } }
public IEnumerator StartLoadConfig() { yield return(new WaitForSeconds(0.1f)); HTTPCacheService.BeginClear(); //程序开始时候,加载config配置文件 _request = new HTTPRequest(new Uri(ConfigUrl), true, OnRequestFinished); _request.Send(); }
public static void ClearUserData() { APIUser.Logout(); Caching.ClearCache(); PlayerPrefs.DeleteAll(); HTTPCacheService.BeginClear(); string path = Application.get_persistentDataPath() + "/ab"; if (Directory.Exists(path)) { Directory.Delete(path, recursive: true); } }
// Token: 0x060025A8 RID: 9640 RVA: 0x000B99E4 File Offset: 0x000B7DE4 private void OnGUI() { GeneralStatistics stats = HTTPManager.GetGeneralStatistics(StatisticsQueryFlags.All); GUIHelper.DrawArea(new Rect(0f, 0f, (float)(Screen.width / 3), 160f), false, delegate { GUIHelper.DrawCenteredText("Connections"); GUILayout.Space(5f); GUIHelper.DrawRow("Sum:", stats.Connections.ToString()); GUIHelper.DrawRow("Active:", stats.ActiveConnections.ToString()); GUIHelper.DrawRow("Free:", stats.FreeConnections.ToString()); GUIHelper.DrawRow("Recycled:", stats.RecycledConnections.ToString()); GUIHelper.DrawRow("Requests in queue:", stats.RequestsInQueue.ToString()); }); GUIHelper.DrawArea(new Rect((float)(Screen.width / 3), 0f, (float)(Screen.width / 3), 160f), false, delegate { GUIHelper.DrawCenteredText("Cache"); if (!HTTPCacheService.IsSupported) { GUI.color = Color.yellow; GUIHelper.DrawCenteredText("Disabled in WebPlayer, WebGL & Samsung Smart TV Builds!"); GUI.color = Color.white; } else { GUILayout.Space(5f); GUIHelper.DrawRow("Cached entities:", stats.CacheEntityCount.ToString()); GUIHelper.DrawRow("Sum Size (bytes): ", stats.CacheSize.ToString("N0")); GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Clear Cache", new GUILayoutOption[0])) { HTTPCacheService.BeginClear(); } GUILayout.EndVertical(); } }); GUIHelper.DrawArea(new Rect((float)(Screen.width / 3 * 2), 0f, (float)(Screen.width / 3), 160f), false, delegate { GUIHelper.DrawCenteredText("Cookies"); if (!CookieJar.IsSavingSupported) { GUI.color = Color.yellow; GUIHelper.DrawCenteredText("Saving and loading from disk is disabled in WebPlayer, WebGL & Samsung Smart TV Builds!"); GUI.color = Color.white; } else { GUILayout.Space(5f); GUIHelper.DrawRow("Cookies:", stats.CookieCount.ToString()); GUIHelper.DrawRow("Estimated size (bytes):", stats.CookieJarSize.ToString("N0")); GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Clear Cookies", new GUILayoutOption[0])) { HTTPManager.OnQuit(); } GUILayout.EndVertical(); } }); if (SampleSelector.SelectedSample == null || (SampleSelector.SelectedSample != null && !SampleSelector.SelectedSample.IsRunning)) { GUIHelper.DrawArea(new Rect(0f, 165f, (float)((SampleSelector.SelectedSample != null) ? (Screen.width / 3) : Screen.width), (float)(Screen.height - 160 - 5)), false, delegate { this.scrollPos = GUILayout.BeginScrollView(this.scrollPos, new GUILayoutOption[0]); for (int i = 0; i < this.Samples.Count; i++) { this.DrawSample(this.Samples[i]); } GUILayout.EndScrollView(); }); if (SampleSelector.SelectedSample != null) { this.DrawSampleDetails(SampleSelector.SelectedSample); } } else if (SampleSelector.SelectedSample != null && SampleSelector.SelectedSample.IsRunning) { GUILayout.BeginArea(new Rect(0f, (float)(Screen.height - 50), (float)Screen.width, 50f), string.Empty); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Back", new GUILayoutOption[] { GUILayout.MinWidth(100f) })) { SampleSelector.SelectedSample.DestroyUnityObject(); } GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.EndArea(); } }