public static void Cancel() { RenderDownloader loader = GameObject.FindObjectOfType <RenderDownloader>(); if (loader != null) { loader.Stop(); } }
void Start() { ReportSegTime(3, "ToDownload"); var key = PlayerPrefs.GetString(Key_DataFile, String.Empty); if (string.IsNullOrEmpty(key)) { Debug.LogError("===>>>启动Unity传入参数不能为空"); Quit(); return; } var filepath = Path.GetFullPath(string.Format("./../renderserver/cache/{0}.json", key)); Debug.Log(filepath); mRenderFile = JsonUtility.FromJson <RenderFile>(File.ReadAllText(filepath)); if (mRenderFile == null) { Debug.LogError("===>>>渲染数据不能为空"); Quit(); return; } mMsg = string.Empty; RenderDownloader.Execute(mRenderFile, (success) => { if (success) { ReportSegTime(4, "ToRender"); Debug.Log("====>>>下载零件数据完成,开始渲染.."); Render(mRenderFile.info, (files, msg) => { if (!string.IsNullOrEmpty(msg)) { mMsg = msg; } OnFinish(files); }); } else { mMsg = "下载零件数据失败"; Debug.LogError("===>>>" + mMsg); OnFinish(null); } }); }