天赋 初步, 倒计时 添加

This commit is contained in:
2025-07-28 17:12:43 +08:00
parent b3ea965c46
commit d081695725
10 changed files with 36958 additions and 5179 deletions

View File

@@ -27,6 +27,10 @@ export class MissionComp extends CCComp {
is_fight:boolean = false;
enhancements:any=[0,0,0,0,0]
update_count:number = 0;
is_show_time:boolean = false;
time_num:number = 0;
time_cd:Timer=new Timer(1);
next_func?:Function;
onLoad(){
this.on(GameEvent.MissionStart,this.mission_start,this)
this.on(GameEvent.FightEnd,this.fight_end,this)
@@ -48,8 +52,36 @@ export class MissionComp extends CCComp {
smc.vmdata.mission_data.gold+=(smc.vmdata.mission_data.add_gold+smc.vmdata.mission_data.buff_add_gold)
}
}
if(this.is_show_time){
if(this.time_cd.update(dt)){
this.run_time()
}
}
}
show_time(onHide?:Function){
this.node.getChildByName("time").active=true
this.is_show_time=true
this.next_func=onHide
}
hide_time(){
if(this.next_func){
this.next_func()
}
this.node.getChildByName("time").active=false
this.is_show_time=false
this.next_func=undefined
}
run_time(){
tween(this.node.getChildByName("time")).to(0.2, {scale:v3(1.5,1.5,1.5)}, {easing:"backOut"}).start()
tween(this.node.getChildByName("time")).to(0.2, {scale:v3(1,1,1)}, {easing:"backIn"}).start()
tween(this.node.getChildByName("time")).to(0.2, {scale:v3(1.5,1.5,1.5)}, {easing:"backOut"}).start()
this.time_num--
this.node.getChildByName("time").getChildByName("time").getComponent(Label).string=this.time_num.toString()
if(this.time_num<=0){
this.hide_time()
}
}
private on_mon_wave_update(){
smc.vmdata.mission_data.current_wave++
@@ -68,7 +100,9 @@ export class MissionComp extends CCComp {
loading.active=false
},0.5)
this.to_ready()
this.to_fight()
this.time_num=5
this.show_time(this.to_fight.bind(this))
}
to_ready(){
oops.message.dispatchEvent(GameEvent.HeroSelect,{is_master:true})
@@ -90,6 +124,7 @@ export class MissionComp extends CCComp {
}
to_fight(){
console.log("[MissionComp] to_fight")
smc.vmdata.mission_data.in_fight=true
oops.message.dispatchEvent(GameEvent.FightStart) //MissionMonComp 监听刷怪
}