protected override void OnBegin() { base.OnBegin(); var tempFile = mRequestPackageData.Name + ".unitypackage"; Debug.Log(mRequestPackageData.DownloadUrl + ">>>>>>:"); EditorUtility.DisplayProgressBar("插件更新", "插件下载中 ...", 0.5f); var client = new WebClient(); client.DownloadProgressChanged += OnProgressChanged; client.DownloadFile(new Uri(mRequestPackageData.DownloadUrl), tempFile); client.DownloadProgressChanged -= OnProgressChanged; EditorUtility.ClearProgressBar(); AssetDatabase.ImportPackage(tempFile, true); File.Delete(tempFile); mRequestPackageData.SaveVersionFile(); AssetDatabase.Refresh(); InstalledPackageVersions.Reload(); }
protected override void OnBegin() { base.OnBegin(); var tempFile = "Assets/" + mRequestPackageData.Name + ".unitypackage"; Debug.Log(mRequestPackageData.DownloadUrl + ">>>>>>:"); EditorUtility.DisplayProgressBar("插件更新", "插件下载中 ...", 0.1f); var progressListener = new ScheduledNotifier <float>(); ObservableWWW.GetAndGetBytes(mRequestPackageData.DownloadUrl, null, progressListener) .Subscribe(bytes => { File.WriteAllBytes(tempFile, bytes); EditorUtility.ClearProgressBar(); AssetDatabase.ImportPackage(tempFile, true); File.Delete(tempFile); mRequestPackageData.SaveVersionFile(); AssetDatabase.Refresh(); InstalledPackageVersions.Reload(); }); progressListener.Subscribe(OnProgressChanged); }
public void Init(PreferencesWindow window) { mMainWindow = window; mPackageDatas = PackageInfosRequestCache.Get().PackageDatas; InstalledPackageVersions.Reload(); EditorActionKit.ExecuteNode(new GetAllRemotePackageInfo(packageDatas => { mPackageDatas = packageDatas; })); }
public void Init(EditorWindow window) { FrameworkLocalVersion = FrameworkLocalVersion.Get(); mPackageDatas = PackageInfosRequestCache.Get().PackageDatas; InstalledPackageVersions.Reload(); EditorActionKit.ExecuteNode(new GetAllRemotePackageInfo(packageDatas => { mPackageDatas = packageDatas; })); }
protected override void OnBegin() { base.OnBegin(); var tempFile = "Assets/" + mRequestPackageData.Name + ".unitypackage"; Debug.Log(mRequestPackageData.DownloadUrl + ">>>>>>:"); EditorUtility.DisplayProgressBar("插件更新", "插件下载中 ...", 0.1f); var progressListener = new ScheduledNotifier <float>(); ObservableWWW.GetAndGetBytes(mRequestPackageData.DownloadUrl, null, progressListener) .Subscribe(bytes => { File.WriteAllBytes(tempFile, bytes); EditorUtility.ClearProgressBar(); AssetDatabase.ImportPackage(tempFile, false); File.Delete(tempFile); mRequestPackageData.SaveVersionFile(); AssetDatabase.Refresh(); EditorUtility.DisplayDialog(mRequestPackageData.Name, "插件下载成功", "OK"); InstalledPackageVersions.Reload(); // EditorApplication.ExecuteMenuItem(FrameworkMenuItems.Preferences); }, e => { EditorUtility.ClearProgressBar(); EditorUtility.DisplayDialog(mRequestPackageData.Name, "插件安装失败,请联系 [email protected] 或者加入 QQ 群:623597263" + e.ToString() + ";", "OK"); }); progressListener.Subscribe(OnProgressChanged); }