修复PVP 切换地图重置数据

This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2023-12-05 01:43:43 +08:00
parent cebe7cc9d3
commit 1e76e420b1
12 changed files with 74 additions and 35 deletions

View File

@@ -24,6 +24,8 @@ export class MainSreepsList extends Component {
app.event.on(GOnHookManagerEvent.ADD_KILL_SREEP,this.onAddSreep,this);
//监听 野怪删除
app.event.on(GOnHookManagerEvent.DEL_KILL_SREEP,this.onDelSreep,this);
//监听 野怪数据重置
app.event.on(GOnHookManagerEvent.RESET_DATA,this.onResetData,this);
//添加子节点事件
this.views.addItemEvent(NodeEventType.TOUCH_END,this.onClickItem.bind(this));
@@ -34,9 +36,14 @@ export class MainSreepsList extends Component {
//取消监听
app.event.off(GOnHookManagerEvent.ADD_KILL_SREEP,this.onAddSreep,this);
app.event.on(GOnHookManagerEvent.DEL_KILL_SREEP,this.onDelSreep,this);
app.event.off(GOnHookManagerEvent.DEL_KILL_SREEP,this.onDelSreep,this);
app.event.off(GOnHookManagerEvent.RESET_DATA,this.onResetData,this);
}
//重置数据
onResetData(){
this.views.refreshData([]);
}
//添加野怪
onAddSreep(sreep:GOnHookPet){