游戏流程控制通过节点间 通信完成

This commit is contained in:
2025-05-29 16:45:43 +08:00
parent 8cb3fe192d
commit e695b9bdac
7 changed files with 75 additions and 82 deletions

View File

@@ -20,6 +20,7 @@ export class MissionHomeComp extends CCComp {
{uuid:0,px:-300},
]
protected onLoad(): void {
this.on(GameEvent.MissionEnd,this.mission_end,this)
}
/** 视图层逻辑代码分离演示 */
start() {
@@ -28,9 +29,11 @@ export class MissionHomeComp extends CCComp {
this.load_ui_heros()
}
to_start(){
}
start_mission() {
for(let i=0;i<this.heros.length;i++){
this.heros[i].to_destroy()
@@ -42,14 +45,11 @@ export class MissionHomeComp extends CCComp {
{uuid:0,px:-300},
]
oops.message.dispatchEvent(GameEvent.MissionStart, {})
let mission=this.node.parent.getChildByName("mission").getComponent(MissionComp)
mission.node.active = true;
mission.mission_start()
smc.mission.play = true;
this.node.active=false;
}
mission_end(){
this.node.active=true
}
load_ui_heros(){