延迟弹出结束

This commit is contained in:
2025-05-29 09:21:19 +08:00
parent cb1ac100da
commit b7a05c2c24
2 changed files with 10 additions and 7 deletions

View File

@@ -262,9 +262,9 @@ export class HeroViewComp extends CCComp {
do_dead(){ do_dead(){
console.log("dead",this.hero_uuid) console.log("角色死亡",this.hero_uuid)
if(this.hero_uuid == 9999){ if(this.hero_uuid == 9999){
console.log("mission_loss") console.log("任务失败")
oops.message.dispatchEvent(GameEvent.MissionLoss,this) oops.message.dispatchEvent(GameEvent.MissionLoss,this)
} }
} }

View File

@@ -60,25 +60,28 @@ export class MissionComp extends CCComp {
} }
call_hero(event: string, args: any){ call_hero(event: string, args: any){
console.log("call_hero",args) console.log("召唤英雄",args)
oops.message.dispatchEvent(GameEvent.CallHero,{uuid:this.hero_args.uuid,pos:args}) oops.message.dispatchEvent(GameEvent.CallHero,{uuid:this.hero_args.uuid,pos:args})
this.hero_args=null this.hero_args=null
} }
mission_start(){ mission_start(){
/* todo 关卡设定完善*/ /* todo 关卡设定完善*/
console.log("战斗开始 Missions mons:",Missions[smc.mission.lv]) console.log("战斗开始 关卡怪物:",Missions[smc.mission.lv])
smc.mission.status=1 smc.mission.status=1
this.colose_victory() this.colose_victory()
this.mission_init() this.mission_init()
} }
mission_end(){ mission_end(){
oops.message.dispatchEvent(GameEvent.MissionEnd) // 延迟0.5秒后执行任务结束逻辑
smc.mission.play=false this.scheduleOnce(() => {
smc.mission.pause=false oops.message.dispatchEvent(GameEvent.MissionEnd)
smc.mission.play=false
smc.mission.pause=false
this.cleanComponents() this.cleanComponents()
// this.to_mission_home() // this.to_mission_home()
this.open_victory() this.open_victory()
}, 0.5)
} }
private cleanComponents() { private cleanComponents() {
ecs.query(ecs.allOf(HeroSkillsComp)).forEach(entity => {entity.remove(HeroSkillsComp);entity.destroy()}); ecs.query(ecs.allOf(HeroSkillsComp)).forEach(entity => {entity.remove(HeroSkillsComp);entity.destroy()});