添加了结束战斗按钮

This commit is contained in:
2024-11-13 23:36:34 +08:00
parent 9d0ee7e7b5
commit 2a07f4718a
7 changed files with 966 additions and 383 deletions

View File

@@ -122,7 +122,7 @@ export class HeroViewComp extends CCComp {
this.sprite = this.node.getChildByName("anm").getComponent(Sprite);
this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
// this.node.getChildByName("top").getChildByName("shield").active = false;
// this.node.getChildByName("shielded").active = false;
// this.node.getChildByName("top").setScale(this.scale,1);
// this.node.getChildByName("atk").setScale(this.scale,1);
// this.node.getChildByName("atk").getComponent(Label).string = this.atk.toString();
@@ -160,6 +160,10 @@ export class HeroViewComp extends CCComp {
}
if(this.shield > 0){
this.shield -= 1
if(this.shield <= 0){
this.shield = 0
this.node.getChildByName("shielded").active = false
}
return
}
let dodge = RandomManager.instance.getRandomInt(0,100,3)
@@ -576,10 +580,13 @@ export class HeroViewComp extends CCComp {
// this.node.getChildByName("top").getChildByName("buff").getChildByName(icon).active=value
}
add_shield(shield:number){
this.shield =shield
if(this.shield > 0){
this.node.getChildByName("shielded").active=true
}
}
tooltip(type:number=1,value:string="",s_uuid:number=1001,y:number=60){

View File

@@ -190,6 +190,7 @@ export class CardControllerComp extends CCComp {
}
}
to_mission(){
oops.message.dispatchEvent("mission_end")
this.node.getChildByName("mission_home").active=true
this.node.getChildByName("mission").active=false
this.node.getChildByName("bar").active=true;

View File

@@ -16,6 +16,7 @@ import { MonModelComp } from "../mon/MonModelComp";
import { Boss} from "../Boss/Boss";
import { UIID } from "../common/config/GameUIConfig";
import { Talents } from "../common/config/TalentSet";
import { HeroViewComp } from "../hero/HeroViewComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -59,6 +60,7 @@ export class MapMonsterComp extends CCComp {
oops.message.on("other_add_monster", this.on_other_add_monster, this);
oops.message.on("do_add_hero", this.on_do_add_hero, this);
oops.message.on("mission_start", this.mission_start, this);
oops.message.on("mission_end", this.mission_end, this);
oops.message.on("normal_call", this.on_normal_call, this);
oops.message.on("better_call", this.on_better_call, this);
oops.message.on("mon_dead", this.on_mon_dead, this);
@@ -123,6 +125,13 @@ export class MapMonsterComp extends CCComp {
this.hero_index=0
smc.vm_data.mission.coin = 0
}
mission_end(){
smc.vm_data.mission.play=false
let heros:any= ecs.query(ecs.allOf(HeroViewComp));
for(let i=0;i<heros.length;i++){
heros[i].HeroView.ent.destroy()
}
}
on_mon_dead(){
let coin =(GameSet.MON_COIN_ADD*smc.vm_data.mission.coin_reward_add*(1+Talents[1006].bonus*smc.vm_data.talent[1006].lv)).toFixed(0)
smc.vm_data.mission.coin += parseFloat(coin)