fix(assets): 优化精灵图集布局并修复技能系统内存泄漏
- 重构精灵图集(aui.plist)布局,调整纹理坐标与旋转状态,提升图集空间利用率 - 在SCastSystem中添加onDestroy方法,注销全局事件监听,防止内存泄漏
This commit is contained in:
@@ -35,6 +35,11 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
oops.message.on(GameEvent.TriggerSkill, this.onTriggerSkill, this);
|
||||
}
|
||||
|
||||
/** 系统被销毁或重置时,必须注销全局事件监听,避免内存泄漏与重复触发 */
|
||||
onDestroy() {
|
||||
oops.message.off(GameEvent.TriggerSkill, this.onTriggerSkill, this);
|
||||
}
|
||||
|
||||
private onTriggerSkill(event: string, args: { s_uuid: number, heroAttrs: HeroAttrsComp, heroView: HeroViewComp }) {
|
||||
if (!args || !args.s_uuid || !args.heroAttrs || !args.heroView) return;
|
||||
this.forceCastTriggerSkill(args.s_uuid, args.heroAttrs, args.heroView);
|
||||
|
||||
Reference in New Issue
Block a user