private IEnumerator UpdateResourceLocatorsAsync() { Addressables.ClearResourceLocators(); string[] catalogs = null; if (Directory.Exists(addressablesDir)) { catalogs = GetCatalogs(addressablesDir, "json", SearchOption.TopDirectoryOnly); for (int i = 0; i < catalogs.Length; i++) { var catalogHandle = Addressables.LoadContentCatalogAsync(catalogs[i]); yield return(catalogHandle); Addressables.AddResourceLocator(catalogHandle.Result); Addressables.Release(catalogHandle); } } if (catalogs == null || catalogs.Length == 0) { catalogs = GetCatalogs(Addressables.RuntimePath, "json", SearchOption.TopDirectoryOnly); for (int i = 0; i < catalogs.Length; i++) { var catalogHandle = Addressables.LoadContentCatalogAsync(catalogs[i]); yield return(catalogHandle); Addressables.AddResourceLocator(catalogHandle.Result); Addressables.Release(catalogHandle); } } }
public async UniTask Load(string domain, string catalogName) { var uri = $"{domain}/{PlatformMappingService.GetPlatform()}/{catalogName}"; while (true) { var operation = Addressables.LoadContentCatalogAsync(uri); await operation.Task; if (operation.OperationException != null) { var errorResult = await errorRequester.Request(ErrorMessage.Create(ErrorStatus.Fatal, operation.OperationException)); if (errorResult == ErrorResult.Retry) { continue; } else if (errorResult == ErrorResult.Error) { throw operation.OperationException; } } Addressables.AddResourceLocator(operation.Result); } }
public IEnumerator Start() { //Load a catalog and automatically release the operation handle. AsyncOperationHandle<IResourceLocator> handle = Addressables.LoadContentCatalogAsync("path_to_secondary_catalog", true); yield return handle; //... }
private static async void LoadCatalogue(List <string> LoadCatalogues, bool RegisterComplete = true) { Instance.ToloadeCount = LoadCatalogues.Count; foreach (var Catalogue in LoadCatalogues) { var Task = Addressables.LoadContentCatalogAsync(Catalogue); await Task.Task; Instance.AssetBundleDownloadDependencies(Task, RegisterComplete); } }
private static async void LoadCatalogue(List <string> LoadCatalogues, bool RegisterComplete = true) { Instance.ToloadeCount = LoadCatalogues.Count; foreach (var Catalogue in LoadCatalogues) { if (Catalogue.Contains("http")) { HttpClient client = new HttpClient(); string result = await client.GetStringAsync(Catalogue); var Task = Addressables.LoadContentCatalogAsync(result); await Task.Task; Instance.AssetBundleDownloadDependencies(Task, RegisterComplete); } else { var Task = Addressables.LoadContentCatalogAsync(Catalogue); await Task.Task; Instance.AssetBundleDownloadDependencies(Task, RegisterComplete); } } }
public static async UniTask <IResourceLocator> LoadContentCatalogAsync(string catalogPath, string providerSuffix = null, IProgress <float> progress = null, PlayerLoopTiming playerLoopTiming = PlayerLoopTiming.Update, CancellationToken cancellationToken = default) { return(await Addressables.LoadContentCatalogAsync(catalogPath, providerSuffix).ConfigureAwait(progress, playerLoopTiming, cancellationToken)); }
internal static void PopulateAssets() { //if (mainAssetBundle == null) //{ //using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TTGL_Survivor.ttglsurvivorbundle")) //{ //mainAssetBundle = AssetBundle.LoadFromStream(assetStream); //} //} var test = System.IO.Path.Combine(ResourcesPath, "catalog_2022.04.20.04.13.04.json"); Addressables.LoadContentCatalogAsync(test, true, "ror2_ttgl_mod").WaitForCompletion(); using (Stream manifestResourceStream3 = Assembly.GetExecutingAssembly().GetManifestResourceStream("TTGL_Survivor.TTGLSoundbank.bnk")) { byte[] array = new byte[manifestResourceStream3.Length]; manifestResourceStream3.Read(array, 0, array.Length); soundBankId = SoundAPI.SoundBanks.Add(array); //MusicTrackOverride } fullBuffPlaySoundEvent = CreateNetworkSoundEventDef("TTGLFullBuffPlay"); genericHitSoundEvent = CreateNetworkSoundEventDef("TTGLGenericHit"); lagannImpactFireSoundEvent = CreateNetworkSoundEventDef("TTGLLagannImpactFire"); drillRushHitSoundEvent = CreateNetworkSoundEventDef("TTGLDrillRushHit"); fullBuffResumeSoundEvent = CreateNetworkSoundEventDef("TTGLFullBuffResume"); fullBuffPauseSoundEvent = CreateNetworkSoundEventDef("TTGLFullBuffPause"); fullBuffStopSoundEvent = CreateNetworkSoundEventDef("TTGLFullBuffStop"); tokoRifleFireSoundEvent = CreateNetworkSoundEventDef("TTGLTokoRifleFire"); tokoRifleCritSoundEvent = CreateNetworkSoundEventDef("TTGLTokoRifleCrit"); gigaDrillBreakSoundEvent = CreateNetworkSoundEventDef("TTGLGigaDrillBreak"); var omniImpactVFXLoader = LegacyResourcesAPI.Load <GameObject>("Prefabs/Effects/OmniEffect/OmniImpactVFXLoader"); if (omniImpactVFXLoader == null) { TTGL_SurvivorPlugin.instance.Logger.LogError("Could not load Prefabs/Effects/OmniEffect/OmniImpactVFXLoader"); } punchImpactEffect = PrefabAPI.InstantiateClone(omniImpactVFXLoader, "TTGLImpactPunch"); punchImpactEffect.AddComponent <NetworkIdentity>(); TTGL_SurvivorPlugin.effectDefs.Add(new EffectDef() { prefab = punchImpactEffect, prefabEffectComponent = punchImpactEffect.GetComponent <EffectComponent>(), prefabVfxAttributes = punchImpactEffect.GetComponent <VFXAttributes>(), prefabName = punchImpactEffect.name, spawnSoundEventName = punchImpactEffect.GetComponent <EffectComponent>().soundName }); var tracerHuntressSnipe = LegacyResourcesAPI.Load <GameObject>("Prefabs/Effects/Tracers/TracerHuntressSnipe"); if (tracerHuntressSnipe == null) { TTGL_SurvivorPlugin.instance.Logger.LogError("Could not load Prefabs/Effects/Tracers/TracerHuntressSnipe"); } yokoRifleBeamEffect = PrefabAPI.InstantiateClone(tracerHuntressSnipe, "TTGLYokoRifleBeamEffect"); yokoRifleBeamEffect.AddComponent <NetworkIdentity>(); yokoRifleBeamEffect.AddComponent <VFXAttributes>().vfxPriority = VFXAttributes.VFXPriority.Always; TTGL_SurvivorPlugin.effectDefs.Add(new EffectDef() { prefab = yokoRifleBeamEffect, prefabEffectComponent = yokoRifleBeamEffect.GetComponent <EffectComponent>(), prefabVfxAttributes = yokoRifleBeamEffect.GetComponent <VFXAttributes>(), prefabName = yokoRifleBeamEffect.name, spawnSoundEventName = yokoRifleBeamEffect.GetComponent <EffectComponent>().soundName }); yokoRifleHitSmallEffect = Assets.LoadEffect("YokoRifleHitSmallEffect", 1.0f); yokoRifleMuzzleBigEffect = Assets.LoadEffect("YokoRifleMuzzleBigEffect", 1.0f); yokoRifleMuzzleSmallEffect = Assets.LoadEffect("YokoRifleMuzzleSmallEffect", 1.0f); yokoRifleExplosiveRoundExplosion = Assets.LoadEffect("YokoRifleExplosiveRoundExplosion", 1.0f); gurrenBrokenBoulderEffect = Assets.LoadEffect("BigBoulderBrokenPrefab", 5.0f); specialExplosion = Assets.LoadEffect("SpecialExplosion", 5.0f); drillPopEffect = Assets.LoadEffect("DrillPopEffect", 2.0f, true); earthMoundEffect = Assets.LoadEffect("EarthMoundEffect", 2.0f); }
IEnumerator Process() { Addressables.InitializeAsync().Completed += InitDone; while (isCloudInit != true) { yield return(new WaitForFixedUpdate()); } Addressables.ClearResourceLocators(); Addressables.LoadContentCatalogAsync("https://storage.googleapis.com/cloud_patching_sample/Android/catalog_" + catalogKeyname + ".json").Completed += Cloud_Completed; while (contentCatalogLoaded != true) { yield return(frequencyshort); } Addressables.CheckForCatalogUpdates(false).Completed += (AsyncOperationHandle <List <string> > cb_checkforupdates) => StartCoroutine(CheckCatalogVersion(cb_checkforupdates)); //StartCoroutine(CheckCatalogVersion()); while (isCheckedPatch != true) { yield return(new WaitForFixedUpdate()); } Debug.Log("Patch checked!"); if (requireDownloadPatch) { Debug.Log("Pending download..."); while (pendingDownload != true) { yield return(new WaitForFixedUpdate()); if (proceedDownloadingPatch) { pendingDownload = proceedDownloadingPatch; Debug.Log("patch responded"); } } if (agreedDownload) { Debug.Log("Downloading patch..."); AsyncOperationHandle cb_downloads = Addressables.DownloadDependenciesAsync(downloadKey, false); while (cb_downloads.PercentComplete < 1) { yield return(new WaitForFixedUpdate()); Debug.Log(cb_downloads.PercentComplete); UI_MANAGER.UpdateDynamicContent(cb_downloads.PercentComplete.ToString()); } Debug.Log("Download done" + cb_downloads.Status); yield return(new WaitForSeconds(5f)); UI_MANAGER.RemoveAndClear(); Addressables.UpdateCatalogs().Completed += OnUpdateCatalogs; while (downloadDone != true) { yield return(new WaitForSeconds(0.25f)); } InitialiseAssetsSpawn(); } else { Debug.Log("No downloading..."); } } else { Debug.Log("No patch to update..."); InitialiseAssetsSpawn(); } }
/// <summary> /// Additively load catalogs from runtime data. /// The settings are not used. /// </summary> /// <param name="catalogPath">The path to the runtime data.</param> /// <param name="providerSuffix">This value, if not null or empty, will be appended to all provider ids loaded from this data.</param> /// <returns>The operation handle for the request.</returns> public static AsyncOperationHandle <IResourceLocator> LoadContentCatalogAsync(string catalogPath, string providerSuffix = null) { return(Addressables.LoadContentCatalogAsync(catalogPath, providerSuffix)); }