refactor(map): 为所有组件的onDestroy添加父类调用
统一修复组件销毁时未调用父类生命周期方法的问题,确保资源正确释放
This commit is contained in:
@@ -174,6 +174,7 @@ export class MissionCardComp extends CCComp {
|
||||
|
||||
/** 组件销毁时解绑所有事件并清理英雄信息面板 */
|
||||
onDestroy() {
|
||||
super.onDestroy();
|
||||
if (this.cards_chou && this.cards_chou.isValid) {
|
||||
this.cards_chou.off(NodeEventType.TOUCH_START, this.onDrawTouchStart, this);
|
||||
this.cards_chou.off(NodeEventType.TOUCH_END, this.onDrawTouchEnd, this);
|
||||
|
||||
Reference in New Issue
Block a user