fix: 在重置组件时取消事件监听以防止内存泄漏

This commit is contained in:
panw
2026-01-05 11:00:56 +08:00
parent 9cf75a0d96
commit a6b7abea54

View File

@@ -280,6 +280,8 @@ export class TalComp extends ecs.Comp {
* 重置组件状态
*/
reset() {
oops.message.off(GameEvent.CanUpdateLv, this.onLevelUp, this);
oops.message.off(GameEvent.UseTalentCard, this.onUseTalentCard, this);
this.Tals = {};
this.heroUuid = 0;
this.heroView = null;