/// <summary> /// 点击手动下载 /// </summary> public void OnManualUpdate() { AssetUpdater updater = AssetUpdater.Instance; AssetVerInfo verInfo = updater.svrVerInfo; BLogger.Assert(verInfo != null); ReleaseUtil.StartManualDownLoadProg(verInfo.m_progUrl); }
private static void RemoteVersionDownloadFinished(AssetUpdater updater, int assetIndex) { AssetVersion remote = updater.GetRemoteVersion(0); AssetVersion local = updater.GetLocalVersion(0); AssetUpdater.Instance.remoteVersionDownloadFinished -= RemoteVersionDownloadFinished; AssetUpdater.Instance.remoteVersionDownloadFailed -= RemoteVersionDownloadFailed; if (remote.Version.ToString() != local.Version.ToString()) { AssetUpdateWindow.Init(); } }
/// <summary> /// 更新点击确定 /// </summary> private void OnUpdateConfirmOK() { AssetUpdater updater = AssetUpdater.Instance; AssetVerInfo verInfo = updater.svrVerInfo; BLogger.Assert(verInfo != null); SDKCallback.OnUpgrade(); if (verInfo.m_updateType == AssetUpdateType.UPDATE_ASSET || verInfo.m_updateType == AssetUpdateType.UPDATE_REPAIR_CLIENT) { StartCoroutine(ContinueDownloadAb(verInfo)); } else { StartCoroutine(ContinueDownloadProg(verInfo)); } }
public override void Initialize() { base.Initialize(); TypeFactory = new TypeDescriptorFactory(); var assetDesc = TypeFactory.Find(typeof(TestAssetUpdate)); memberMyClass = assetDesc.Members.FirstOrDefault(member => member.Name == "MyClass"); if (session != null) { session.Dispose(); dependencyManager.Dispose(); } package = new Package(); session = new PackageSession(package); dependencyManager = new AssetDependencyManager(session); assetUpdater = new AssetUpdater(dependencyManager); }
IEnumerator CrtUpdateFromRepairClient() { AssetUpdater updater = AssetUpdater.Instance; yield return(StartCoroutine(updater.CheckUpdate(true, this))); StopTickTitle(); AssetVerInfo svrVerInfo = updater.svrVerInfo; if (svrVerInfo == null) { ShowConfirm( StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_CHECK_VERSION_FAILED, AssetVersionMgr.Instance.error), false, RetryUpdate); yield break; } ///读取本地 AssetVersionMgr.Instance.LoadLocalAllAssetMd5(); //获取更新的大小 StartTickTitle(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_CHECK_UPDATE_CONTENT)); yield return(StartCoroutine(AssetVersionMgr.Instance.DownloadLatestIndex(svrVerInfo.m_assetUrl))); //yield return StartCoroutine(AssetVersionMgr.Instance); StopTickTitle(); if (AssetVersionMgr.Instance.haveErr) { ShowConfirm(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_CHECK_UPDATE_CONTENT_FAILED, AssetVersionMgr.Instance.error), false, RetryUpdate); yield break; } ShowConfirm(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_ASSET_UPDATE_INFO, AssetVersionMgr.Instance.GetUpdateFileCount(), GetDataSize(AssetVersionMgr.Instance.GetToUpdateSize())), true, OnUpdateConfirmOK, OnUpdateConfirmCancel); }
private static void RemoteVersionDownloadFailed(AssetUpdater updater, int assetIndex) { AssetUpdater.Instance.remoteVersionDownloadFinished -= RemoteVersionDownloadFinished; AssetUpdater.Instance.remoteVersionDownloadFailed -= RemoteVersionDownloadFailed; //Debug.Log("Failed to get remote UMA version."); }
/// <summary> /// 准备预处理AB资源,从jar文件挪到data目录 /// </summary> /// <returns></returns> IEnumerator GameStartup() { //m_process.gameObject.SetActive(false); AssetBundlePrepare abPrepare = AssetBundlePrepare.Instance; ShowText(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_GAME_ETNERING)); m_labelVersion.text = ""; yield return(StartCoroutine(abPrepare.CheckNeedPrepare())); ShowText(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_GAME_ETNERING)); if (BaseConfigInfo.enableObbSplitMode) { if (ObbMgr.Instance.IsNeedDownloadObb()) { SceneManager.LoadScene("Scene_obbdownload"); yield break; } } var isReportPrepareEvent = false; var watchReport = new BTickWatcher(); if (!abPrepare.IsHaveErr() && abPrepare.NeedPrepare) { EventLogReport.Instance.ReportEvent(EventLogType.event_start_unpack); isReportPrepareEvent = true; } yield return(StartCoroutine(abPrepare.StartPrepareAb(this))); if (abPrepare.IsHaveErr()) { if (isReportPrepareEvent) { EventLogReport.Instance.ReportEvent(EventLogType.event_fail_unpack, abPrepare.error); } ShowConfirm(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_PREPARE_FAILED, abPrepare.error), false, DodLib.DoQuit); yield break; } if (isReportPrepareEvent) { EventLogReport.Instance.ReportEvent(EventLogType.event_end_unpack, watchReport.ElapseTime()); } ///开始检测版本 AssetVersionMgr.Instance.ReadBaseInfo(); if (AssetVersionMgr.Instance.haveErr) { ShowConfirm( StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_ASSETVER_INIT_FAILED, AssetVersionMgr.Instance.error), false, DodLib.DoQuit); yield break; } DBugly.Init(BaseConfigInfo.PlatformName, AssetVersionMgr.Instance.assetVersion); // //统计检查版本成功还是失败 // PlatformUtil.StatisticsEventBegin("boot_update"); //获取版本号 string version = AssetVersionMgr.Instance.assetVersion; m_labelVersion.text = StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_VERSION_INFO, version); StartTickTitle(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_CHECK_UPDATE)); AssetUpdater updater = AssetUpdater.Instance; yield return(StartCoroutine(updater.CheckUpdate(false, this))); StopTickTitle(); AssetVerInfo svrVerInfo = updater.svrVerInfo; if (svrVerInfo == null) { // PlatformUtil.StatisticsEventFailed("boot_update", "network"); ShowConfirm( StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_CHECK_VERSION_FAILED, AssetVersionMgr.Instance.error), false, RetryUpdate); yield break; } // PlatformUtil.StatisticsEventEnd("boot_update"); if (svrVerInfo.m_updateType == AssetUpdateType.UPDATE_NONE) { StartEnterGameScene(); } else if (svrVerInfo.m_updateType == AssetUpdateType.UPDATE_ASSET) { ///读取本地 AssetVersionMgr.Instance.LoadLocalAllAssetMd5(); //获取更新的大小 StartTickTitle(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_CHECK_UPDATE_CONTENT)); yield return(StartCoroutine(AssetVersionMgr.Instance.DownloadLatestIndex(svrVerInfo.m_assetUrl))); yield return(StartCoroutine(AssetVersionMgr.Instance.BeginUpdateIndex(svrVerInfo.m_assetUrl))); StopTickTitle(); if (AssetVersionMgr.Instance.haveErr) { ShowConfirm(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_CHECK_UPDATE_CONTENT_FAILED, AssetVersionMgr.Instance.error), false, RetryUpdate); yield break; } #if !UNITY_EDITOR if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork) { //直接下载 OnUpdateConfirmOK(); } else #endif ShowConfirm(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_ASSET_UPDATE_INFO, AssetVersionMgr.Instance.GetUpdateFileCount(), GetDataSize(AssetVersionMgr.Instance.GetToUpdateSize())), true, OnUpdateConfirmOK, OnUpdateConfirmCancel); } else if (svrVerInfo.m_updateType == AssetUpdateType.UPDATE_PROGRAME) { if (string.IsNullOrEmpty(svrVerInfo.m_help)) { ShowConfirm(svrVerInfo.m_err, true, OnUpdateConfirmOK, OnUpdateConfirmCancel); } else { ShowConfirmIos(svrVerInfo.m_err, OnUpdateConfirmOK, () => { Application.OpenURL(svrVerInfo.m_help); }); } } else if (svrVerInfo.m_updateType == AssetUpdateType.UPDATE_ERROR) { ShowText(svrVerInfo.m_err); } else { ShowText(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_CHECK_UPDATE_JSON_DETAIL, svrVerInfo.m_updateType)); } }