From 4e83d61af272e440137acc6cba909f995bab72f4 Mon Sep 17 00:00:00 2001 From: dgflash Date: Sat, 8 Apr 2023 21:08:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=A9=E5=B1=95oops.res.loadAsync?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/core/common/loader/ResLoader.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/assets/core/common/loader/ResLoader.ts b/assets/core/common/loader/ResLoader.ts index 6cf0ebf..6854f8d 100644 --- a/assets/core/common/loader/ResLoader.ts +++ b/assets/core/common/loader/ResLoader.ts @@ -118,6 +118,29 @@ oops.res.load("spine_path", sp.SkeletonData, (err: Error | null, sd: sp.Skeleton this.loadByArgs(args); } + loadAsync(bundleName: string, paths: string | string[], type: AssetType | null, onProgress: ProgressCallback | null, onComplete: CompleteCallback | null): void; + loadAsync(bundleName: string, paths: string | string[], onProgress: ProgressCallback | null, onComplete: CompleteCallback | null): void; + loadAsync(bundleName: string, paths: string | string[], onComplete?: CompleteCallback | null): void; + loadAsync(bundleName: string, paths: string | string[], type: AssetType | null, onComplete?: CompleteCallback | null): void; + loadAsync(paths: string | string[], type: AssetType | null, onProgress: ProgressCallback | null, onComplete: CompleteCallback | null): void; + loadAsync(paths: string | string[], onProgress: ProgressCallback | null, onComplete: CompleteCallback | null): void; + loadAsync(paths: string | string[], onComplete?: CompleteCallback | null): void; + loadAsync(paths: string | string[], type: AssetType | null, onComplete?: CompleteCallback | null): void; + loadAsync( + bundleName: string, + paths?: string | string[] | AssetType | ProgressCallback | CompleteCallback | null, + type?: AssetType | ProgressCallback | CompleteCallback | null, + ) { + return new Promise((resolve, reject) => { + this.load(bundleName, paths, type, (err: Error | null, asset: Asset) => { + if (err) { + error(err.message); + } + resolve(asset) + }); + }); + } + /** * 加载文件夹中的资源 * @param bundleName 远程包名