async UniTask <BaseAbManifest> LoadRemoteManifestAsync() { if (string.IsNullOrEmpty(_remoteUrl)) { return(_localManifest); } int localVersion = version; int remoteVersion = localVersion; try { remoteVersion = await LoadRemoteVersionAsync(); } catch (Exception) { } if (remoteVersion <= _runtimeSettings.version) { return(_localManifest); } BaseAbManifest remoteManifest = null; try { remoteManifest = await LoadManifestAsync(GetRemoteAbUrl(_manifestName), Mathf.Max(localVersion, remoteVersion)); } catch (Exception) { } // 如果发生错误加载远程manifest失败,直接将其设置为localmanifest if (remoteManifest == null) { remoteManifest = _localManifest; } else if (remoteVersion > localVersion) { // 只有成功加载远端manifest时才更新本地version值 SaveVersion(remoteVersion); } return(remoteManifest); }
public override async UniTask InitAsync() { _localManifest = await LoadLocalManifestAsync(GetLocalPath(_manifestName)); _remoteManifest = await LoadRemoteManifestAsync(); }