private static IEnumerator DowndLoadFile(string downLoadUrl, string storageLocaPath, Action <float> progress) { WWW downloadOperation = new WWW(downLoadUrl); CoroutineMgr.StartCoroutinee(DowndLoadFileProg(downloadOperation, progress)); yield return(downloadOperation); if (downloadOperation.isDone && string.IsNullOrEmpty(downloadOperation.error)) { //生成文件 Byte[] b = downloadOperation.bytes; Log.Debug("下载完成:" + storageLocaPath); File.WriteAllBytes(storageLocaPath, b); progress.Invoke(1); } else { progress.Invoke(-1); } }
} //将json化的字符串可视化显示 static public void Update() { float lasttime = TimeHelper.time; while (true) { try { TimeHelper.deltaTime = TimeHelper.time - lasttime; lasttime = TimeHelper.time; Thread.Sleep(1); OneThreadSynchronizationContext.Instance.Update(); Entity.Root.Update(); CoroutineMgr.UpdateCoroutine(); } catch (Exception e) { Log.Error(e); } } }
public void Awake() { Ins = this; }
public static void DowndLoadProgress(string downLoadUrl, string storageLocaPath, Action <float> progress) { CoroutineMgr.StartCoroutinee(DowndLoadFile(downLoadUrl, storageLocaPath, progress)); }
//微信分享截屏 public void WeChatShareScreen() { CoroutineMgr.StartCoroutinee(CaptureScreen(ScreenFinsh)); }