static void LogCallback(string condition, string stackTrace, LogType type) { if (_sent) { return; } if (type == LogType.Exception) { _sent = true; AddData("type", "exception"); AddData("condition", condition); AddData("stack", stackTrace); Coroutines.Run(SendBugReport()); } }
public static UnityWebRequest LoadFromCacheOrDownload(string url, out bool disposable) { disposable = true; if (url.StartsWith("jar:") == true) { return(UnityWebRequest.Get(url)); } var uri = new Uri(); if (!uri.Parse(url)) { EB.Debug.LogError("LoadFromCacheOrDownload Parse Failed {0}", url); return(null); } if (uri.Scheme == "file") { return(UnityWebRequest.Get(url)); } // assume network var fileName = GetCacheFile(url); if (File.Exists(fileName)) { var cachedPath = "file://" + fileName; return(UnityWebRequest.Get(cachedPath)); } // load it and save it to the cache var www = UnityWebRequest.Get(url); disposable = false; EB.Debug.Log("Loading to Cache {0}", url); _ActivelyLoading.Add(www); Coroutines.Run(SaveToCache(url, www)); return(www); }
static void UnhandledExceptionCallback(object sender, System.UnhandledExceptionEventArgs args) { if (_sent) { return; } if (args == null || args.ExceptionObject == null) { return; } System.Exception e = args.ExceptionObject as System.Exception; if (e != null) { _sent = true; AddData("type", "crash"); AddData("name", e.GetType().ToString()); AddData("message", e.Message); AddData("sender", "UnhandledExceptionCallback" + sender.ToString()); AddData("stack", StackTrace(e)); Coroutines.Run(SendBugReport()); } }
public static Coroutine Precache(string url, System.Action <string> cb) { return(Coroutines.Run(DoPreCache(url, cb))); }
/// <summary> /// 开启协程 /// </summary> /// <param name="co"></param> /// <returns></returns> private static Coroutine StartCoroutine(IEnumerator co) { return(Coroutines.Run(co)); }