fix: 在重置组件时取消事件监听以防止内存泄漏
This commit is contained in:
@@ -280,6 +280,8 @@ export class TalComp extends ecs.Comp {
|
|||||||
* 重置组件状态
|
* 重置组件状态
|
||||||
*/
|
*/
|
||||||
reset() {
|
reset() {
|
||||||
|
oops.message.off(GameEvent.CanUpdateLv, this.onLevelUp, this);
|
||||||
|
oops.message.off(GameEvent.UseTalentCard, this.onUseTalentCard, this);
|
||||||
this.Tals = {};
|
this.Tals = {};
|
||||||
this.heroUuid = 0;
|
this.heroUuid = 0;
|
||||||
this.heroView = null;
|
this.heroView = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user