public void StartUpdate() { DebugLog("StartUpdate++++"); Common.ULogFile.sharedInstance.LogEx("update", "StartUpdate++++"); if (UpdateManager.Instance.Running()) { DebugLog("running!!! return"); return; } string localXmlPath = _localXmlAbsPath; string storeDir = _storePath; //进入测试流程用到的数据 string imeiOrMacOrIdfa = HardwareManager.GetMacOrImeiOrIdfa(); //打包的时候写在代码里面的版本 string inAppClientVersion = BuildVersion.AppVer; //打包的时候写在代码里面的分段版本,固定为1 string inAppBaseVersion = "1"; //apk或者ipa所在路径,安装路径。Unity中通过Application.streamingAssetsPath获取 string installedPath = ""; //IOS需要读取包内xml的地址 string inAppLocalXmlPath = localXmlPath.Replace(storeDir, Application.streamingAssetsPath); if (_pType == PlatformType.IOS || _pType == PlatformType.Windows) { //Application/xxxxx/xxx.app/Data/Raw installedPath = Application.streamingAssetsPath; } else if (_pType == PlatformType.Android) { ///data/app/xxx.xxx.xxx.apk installedPath = Application.dataPath; } DebugLog(string.Format("localXmlPath={0} \ninAppLocalXmlPath={1} \nstoreDir={2}", localXmlPath, inAppLocalXmlPath, storeDir)); string[] backupCdnArray = null; int cpuCoreCount = SystemInfo.processorCount; if (cpuCoreCount <= 0) { cpuCoreCount = 4; } cpuCoreCount = cpuCoreCount / 2; UpdateManager.Instance.Initialize(localXmlPath, inAppLocalXmlPath, installedPath, storeDir, _pType, cpuCoreCount); //注册日志回调 UpdateManager.Instance.RegisterLog(DebugLog, WarnLog, ErrorLog); //设置进入测试流程的条件 UpdateManager.Instance.SetImeiOrMacOrIdfa(imeiOrMacOrIdfa); //设置资源转移的路径和版本信息 UpdateManager.Instance.SetTransData(inAppClientVersion, inAppBaseVersion, installedPath); //设置备份的cdn,主要是台湾版本要用 UpdateManager.Instance.SetBackupCdn(backupCdnArray); //设置客户端下载完成的回调 UpdateManager.Instance.SetClientDownClientFunc(OnClientDownloadFinish, null); //设置下载提示的回调 UpdateManager.Instance.SetDownloadNoticeFunc(OnDownloadNotice); //设置每个流程的回调 UpdateManager.Instance.SetOnFlowBeginCallback(onFlowBeginCallback); //设置更新流程结束的回调函数 UpdateManager.Instance.SetFinishCallback(FinishCallback); //场景关联资源列表的配置文件 UpdateManager.Instance.SetSceneReferenceResConfigPath(_sceneConfigPath); UpdateManager.Instance._Flow5DownloadBaseRes.SetEnableDownBase(UpdateCenter.bDownBaseRes); UpdateManager.Instance._Flow5DownloadBaseRes.SetBackDownload(UpdateCenter.bBackGround); //开始更新流程 UpdateManager.Instance.StartUpdate(); DebugLog("StartUpdate---"); }