再来一局 完善, todo : mission 添加自定义的 定时运行队列 方便销毁
This commit is contained in:
@@ -3,7 +3,7 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { FightSet, MissionData, VmInfo} from "../common/config/Mission";
|
||||
import { FightSet, HeroUI, MissionData, VmInfo} from "../common/config/Mission";
|
||||
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
@@ -233,6 +233,12 @@ export class MissionComp extends CCComp {
|
||||
|
||||
|
||||
async mission_start(){
|
||||
console.log("[MissionComp] ** 1 ** mission_start")
|
||||
|
||||
// 撤销所有正在运行的scheduleOnce函数
|
||||
this.unscheduleAllCallbacks()
|
||||
|
||||
this.node.getChildByName("ending").getComponent(Animation).play("startFight")
|
||||
oops.message.dispatchEvent(GameEvent.FightReady)
|
||||
this.node.active=true
|
||||
this.data_init()
|
||||
@@ -240,15 +246,18 @@ export class MissionComp extends CCComp {
|
||||
loading.active=true
|
||||
this.scheduleOnce(()=>{
|
||||
loading.active=false
|
||||
this.node.getChildByName("ending").active=false
|
||||
},1)
|
||||
this.to_ready()
|
||||
|
||||
|
||||
}
|
||||
to_ready(){
|
||||
console.log("[MissionComp] ** 2 ** to_ready")
|
||||
oops.message.dispatchEvent(GameEvent.HeroSelect)
|
||||
}
|
||||
ready_to_fight(){
|
||||
console.log("[MissionComp] ** 3 ** ready_to_fight")
|
||||
this.time_num=5
|
||||
this.show_time(this.to_fight.bind(this))
|
||||
}
|
||||
@@ -269,7 +278,7 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
|
||||
to_fight(){
|
||||
console.log("[MissionComp] to_fight")
|
||||
console.log("[MissionComp] ** 4 ** to_fight")
|
||||
smc.vmdata.mission_data.in_fight=true
|
||||
oops.message.dispatchEvent(GameEvent.FightStart) //MissionMonComp 监听刷怪
|
||||
this.do_next_wave()
|
||||
@@ -283,6 +292,8 @@ export class MissionComp extends CCComp {
|
||||
|
||||
fight_end(){
|
||||
console.log("任务结束")
|
||||
this.node.getChildByName("ending").active=true
|
||||
this.node.getChildByName("ending").getComponent(Animation).play("endFight")
|
||||
// 延迟0.5秒后执行任务结束逻辑
|
||||
this.scheduleOnce(() => {
|
||||
smc.mission.play=false
|
||||
@@ -292,6 +303,7 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
|
||||
mission_end(){
|
||||
this.node.getChildByName("ending").active=false
|
||||
this.node.active=false
|
||||
}
|
||||
|
||||
@@ -304,6 +316,11 @@ export class MissionComp extends CCComp {
|
||||
this.update_count=0
|
||||
this.GlodAddTimer=new Timer(smc.vmdata.mission_data.refrsh_time)
|
||||
smc.enhancements=defaultEnhancements()
|
||||
this.heros={
|
||||
0:{uuid:0,count:0},
|
||||
1:{uuid:0,count:0},
|
||||
2:{uuid:0,count:0},
|
||||
}
|
||||
this.hide_time()
|
||||
this.hide_wave_time()
|
||||
this.tals={
|
||||
@@ -374,6 +391,9 @@ export class MissionComp extends CCComp {
|
||||
|
||||
}
|
||||
private cleanComponents() {
|
||||
smc.vmdata.hero1=JSON.parse(JSON.stringify(HeroUI))
|
||||
smc.vmdata.hero2=JSON.parse(JSON.stringify(HeroUI))
|
||||
smc.vmdata.hero3=JSON.parse(JSON.stringify(HeroUI))
|
||||
ecs.query(ecs.allOf(HeroViewComp)).forEach(entity => {entity.remove(HeroViewComp);entity.destroy()});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user