hero 界面调整 局内英雄不再升级,改为升级局内技能

This commit is contained in:
2024-11-19 15:15:05 +08:00
parent e89f590979
commit e6f4a8085b
10 changed files with 188 additions and 151 deletions

View File

@@ -19,6 +19,7 @@ export class HCardComp extends CCComp {
ap:any=[]
hp:any=[]
life:any=[]
pw:any=[]
protected onLoad(): void {
@@ -26,10 +27,11 @@ export class HCardComp extends CCComp {
start() {
this.heros= ecs.query(ecs.allOf(HeroModelComp));
this.hc_name=this.node.getChildByName("name").getComponent(Label)!
this.icon=this.node.getChildByName("icon").getComponent(Sprite)!
// this.icon=this.node.getChildByName("icon").getComponent(Sprite)!
this.hp=this.node.getChildByName("hp").getChildByName("num").getComponent(Label)!
this.ap=this.node.getChildByName("ap").getChildByName("num").getComponent(Label)!
this.life=this.node.getChildByName("life").getComponent(ProgressBar)!
this.life=this.node.getChildByName("life").getComponent(ProgressBar)!
this.pw=this.node.getChildByName("pow").getComponent(ProgressBar)!
this.hc_name.string= this.heros[this.hi].HeroView.hero_name
console.log("hcard start")
}
@@ -37,6 +39,7 @@ export class HCardComp extends CCComp {
this.hp.string=this.heros[this.hi].HeroView.hp_max
this.ap.string=this.heros[this.hi].HeroView.ap
this.life.progress=this.heros[this.hi].HeroView.hp/this.heros[this.hi].HeroView.hp_max
this.pw.progress=this.heros[this.hi].HeroView.pw/this.heros[this.hi].HeroView.pwm
}
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */

View File

@@ -58,18 +58,10 @@ export class MissionComp extends CCComp {
mon_index:number = 0
onLoad(){
// 监听全局事件
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("mon_dead", this.on_mon_dead, this);
}
start() {
this.hcard_call()
}
protected update(dt: number): void {
@@ -174,18 +166,6 @@ export class MissionComp extends CCComp {
oops.message.dispatchEvent("do_reward");
}
private on_other_add_monster(event: string, args: any) {
var scene = smc.map.MapView.scene;
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
let monster_layer = scene.entityLayer!.node!
this.addMonster(args.uuid)
}
check_mon_count(){
let count = 0;
let list = ecs.query(ecs.allOf(MonModelComp));
count = list.length
return count;
}
count_mon_pos(){
let monsters:any= ecs.query(ecs.allOf(MonModelComp));
for(let i=0;i<monsters.length;i++){
@@ -203,9 +183,7 @@ export class MissionComp extends CCComp {
}
}
private on_do_add_hero(event: string, args: any) {
this.addHero(args.uuid)
}
heros_call(){
let hero:any =RandomManager.instance.getRandomByObjectList(smc.cards, 1);
this.addHero(hero[0].uuid)