mirror of
https://gitee.com/dgflash/oops-plugin-framework.git
synced 2026-05-09 22:02:45 +08:00
修复特效模块发布时提示的交叉引用警告
This commit is contained in:
5
assets/libs/animator-effect/EffectEvent.ts
Normal file
5
assets/libs/animator-effect/EffectEvent.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
/** 特效管理模块事件 */
|
||||
export enum EffectEvent {
|
||||
/** 回收节点 */
|
||||
Put = "EffectEvent_Put"
|
||||
}
|
||||
9
assets/libs/animator-effect/EffectEvent.ts.meta
Normal file
9
assets/libs/animator-effect/EffectEvent.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "44587e42-cf24-4a68-b892-5d3607eba966",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user