mirror of
https://gitee.com/dgflash/oops-plugin-framework.git
synced 2026-05-30 18:39:18 +08:00
修改ResLoader.loadBundle加载失败时返回null,而不报错提示
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { __private, AnimationClip, Asset, AssetManager, assetManager, AudioClip, error, Font, ImageAsset, js, JsonAsset, Material, Mesh, Prefab, resources, sp, SpriteFrame, Texture2D, warn } from "cc";
|
||||
import { __private, AnimationClip, Asset, AssetManager, assetManager, AudioClip, Font, ImageAsset, js, JsonAsset, Material, Mesh, Prefab, resources, sp, SpriteFrame, Texture2D, warn } from "cc";
|
||||
|
||||
export type AssetType<T = Asset> = __private.__types_globals__Constructor<T> | null;
|
||||
export type Paths = string | string[];
|
||||
@@ -120,11 +120,12 @@ oops.res.loadRemote<ImageAsset>(this.url, opt, onComplete);
|
||||
* @example
|
||||
await oops.res.loadBundle(name);
|
||||
*/
|
||||
loadBundle(name: string) {
|
||||
loadBundle(name: string): Promise<AssetManager.Bundle> {
|
||||
return new Promise<AssetManager.Bundle>((resolve, reject) => {
|
||||
assetManager.loadBundle(name, (err, bundle: AssetManager.Bundle) => {
|
||||
if (err) {
|
||||
return error(err);
|
||||
resolve(null!);
|
||||
return;
|
||||
}
|
||||
resolve(bundle);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user