From 08a549bcc0a98e2ad1ad7490c492a0bb3c235b42 Mon Sep 17 00:00:00 2001 From: donggang <> Date: Wed, 26 Jun 2024 18:37:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9GameComponent.loadAsync?= =?UTF-8?q?=E4=B8=8EResLoader..loadAsync=E7=9A=84=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=80=BC=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/module/common/GameComponent.ts | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/assets/module/common/GameComponent.ts b/assets/module/common/GameComponent.ts index a2088dd..ac7845e 100644 --- a/assets/module/common/GameComponent.ts +++ b/assets/module/common/GameComponent.ts @@ -123,19 +123,15 @@ export class GameComponent extends Component { } /** 异步加载资源 */ - 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, - ) { + loadAsync(bundleName: string, paths: string | string[], type: AssetType | null): Promise; + loadAsync(bundleName: string, paths: string | string[]): Promise; + loadAsync(bundleName: string, paths: string | string[]): Promise; + loadAsync(bundleName: string, paths: string | string[], type: AssetType | null): Promise; + loadAsync(paths: string | string[], type: AssetType | null): Promise; + loadAsync(paths: string | string[]): Promise; + loadAsync(paths: string | string[]): Promise; + loadAsync(paths: string | string[], type: AssetType | null): Promise; + loadAsync(bundleName: string, paths?: string | string[] | AssetType | ProgressCallback | CompleteCallback | null, type?: AssetType | ProgressCallback | CompleteCallback | null): Promise { if (this.resPaths == null) this.resPaths = new Map(); if (paths instanceof Array) {