public override Future <AssetBundleImageKey> obtainKey(ImageConfiguration configuration) { AssetImageConfiguration assetConfig = new AssetImageConfiguration(configuration, assetName); AssetBundleImageKey key; var cache = AssetBundleCache.instance.get(configuration.bundle); if (cache.TryGetValue(assetConfig, out key)) { return(new SynchronousFuture <AssetBundleImageKey>(key)); } AssetBundle chosenBundle = bundle ? bundle : configuration.bundle; var devicePixelRatio = configuration.devicePixelRatio ?? Window.instance.devicePixelRatio; key = _loadAsset(chosenBundle, devicePixelRatio); cache[assetConfig] = key; return(new SynchronousFuture <AssetBundleImageKey>(key)); }
protected override IPromise <AssetBundleImageKey> obtainKey(ImageConfiguration configuration) { AssetImageConfiguration assetConfig = new AssetImageConfiguration(configuration, this.assetName); AssetBundleImageKey key; var cache = AssetBundleCache.instance.get(configuration.bundle); if (cache.TryGetValue(assetConfig, out key)) { return(Promise <AssetBundleImageKey> .Resolved(key)); } AssetBundle chosenBundle = this.bundle ? this.bundle : configuration.bundle; var devicePixelRatio = configuration.devicePixelRatio ?? Window.instance.devicePixelRatio; key = this._loadAsset(chosenBundle, devicePixelRatio); cache[assetConfig] = key; return(Promise <AssetBundleImageKey> .Resolved(key)); }
IPromise <AssetBundleImageKey> obtainKey(ImageConfiguration configuration) { AssetImageConfiguration assetConfig = new AssetImageConfiguration(configuration, this.assetName); AssetBundleImageKey key; var cache = AssetBundleCache.instance.get(configuration.bundle); if (cache.TryGetValue(assetConfig, out key)) { return(Promise <AssetBundleImageKey> .Resolved(key)); } AssetBundle chosenBundle = this.bundle ? this.bundle : configuration.bundle; var devicePixelRatio = configuration.devicePixelRatio ?? Window.instance.devicePixelRatio; var coroutine = Window.instance.startCoroutine(this._loadAssetAsync(chosenBundle, devicePixelRatio)); return(coroutine.promise.Then(result => { D.assert(result != null); key = (AssetBundleImageKey)result; cache[assetConfig] = key; return key; })); }