marineparkclient/.templates/Mediator.ts
2023-08-15 11:09:12 +08:00

33 lines
844 B
TypeScript

export default class xxMediator extends Mediator {
static NAME: string = "!! Input your Mediator Name";
constructor(view: cc.Node) {
super(Mediator.NAME, view);
}
onRegister() {
this.addUIListener();
}
private addUIListener(){
(this.getViewComponent() as cc.Node).on("_node_enable_",()=>{
this.refershView();
})
}
private refershView(){}
listNotificationInterests(): string[] {
return [
]
}
handleNotification(notification: Notification) {
let _msgName: string = notification.name;
let _data: string = notification.getBody();
if (this[_msgName]) this[_msgName](_data);
}
getViewClass(): ViewClass {
return this.getViewComponent().getComponent("ViewClass") as ViewClass;
}
onRemove() {}
}