修复特效模块发布时提示的交叉引用警告

This commit is contained in:
dgflash
2022-08-21 14:12:32 +08:00
parent cdf6b51a63
commit 06a4eb1256
4 changed files with 30 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
/** 特效管理模块事件 */
export enum EffectEvent {
/** 回收节点 */
Put = "EffectEvent_Put"
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "44587e42-cf24-4a68-b892-5d3607eba966",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -6,7 +6,9 @@
*/
import { Animation, Component, ParticleSystem, _decorator } from 'cc';
import { EffectSingleCase } from './EffectSingleCase';
import { oops } from '../../core/Oops';
import { EffectEvent } from './EffectEvent';
const { ccclass, property } = _decorator;
/** 动画播放完释放特效 */
@@ -44,6 +46,6 @@ export class EffectFinishedRelease extends Component {
}
private onRecovery() {
if (this.node.parent) EffectSingleCase.instance.put(this.node);
if (this.node.parent) oops.message.dispatchEvent(EffectEvent.Put, this.node);
}
}

View File

@@ -7,7 +7,9 @@
import { Component, Node, NodePool, Prefab, Vec3 } from 'cc';
import { resLoader } from '../../core/common/loader/ResLoader';
import { oops } from '../../core/Oops';
import { ViewUtil } from '../../core/utils/ViewUtil';
import { EffectEvent } from './EffectEvent';
import { EffectFinishedRelease } from './EffectFinishedRelease';
/** 效果数据 */
@@ -35,6 +37,16 @@ export class EffectSingleCase {
private effects: Map<string, NodePool> = new Map();
constructor() {
oops.message.on(EffectEvent.Put, this.onHandler, this);
}
private onHandler(event: string, args: any) {
if (event == EffectEvent.Put) {
this.put(args as Node);
}
}
/** 加载资源并现实特效 */
loadAndShow(name: string, parent?: Node, params?: IEffectParams): Promise<Node> {
return new Promise((resolve, reject) => {