From dcfa6a3ebb8def0a344896dc3730a8844aa52bcb Mon Sep 17 00:00:00 2001 From: dgflash Date: Tue, 16 Jul 2024 23:52:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../libs/animator-effect/EffectSingleCase.ts | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/assets/libs/animator-effect/EffectSingleCase.ts b/assets/libs/animator-effect/EffectSingleCase.ts index 29e17cf..28d79d8 100644 --- a/assets/libs/animator-effect/EffectSingleCase.ts +++ b/assets/libs/animator-effect/EffectSingleCase.ts @@ -69,6 +69,18 @@ export class EffectSingleCase { this.put(node); } + /** + * 获取指定资源池中对象数量 + * @param path 预制资源路径 + */ + getCount(path: string): number { + var np = this.effects.get(path); + if (np) { + return np.size(); + } + return 0; + } + /** * 加载资源并生成节点对象 * @param path 预制资源路径 @@ -79,8 +91,6 @@ export class EffectSingleCase { return new Promise(async (resolve, reject) => { var np = this.effects.get(path); if (np == undefined) { - // 记录显示对象资源 - if (params && params.bundleName) { this.res.set(path, params.bundleName); await resLoader.loadAsync(params.bundleName, path, Prefab); @@ -100,25 +110,13 @@ export class EffectSingleCase { }); } - /** - * 获取指定资源池中对象数量 - * @param path 预制资源路径 - */ - getCount(path: string): number { - var np = this.effects.get(path); - if (np) { - return np.size(); - } - return 0; - } - /** * 显示预制对象 * @param path 预制资源路径 * @param parent 父节点 * @param pos 位置 */ - show(path: string, parent?: Node, params?: IEffectParams): Node { + private show(path: string, parent?: Node, params?: IEffectParams): Node { var np = this.effects.get(path); if (np == null) { np = new NodePool();