英雄出战选择 +英雄相关 ui 改变

This commit is contained in:
2025-08-17 20:40:03 +08:00
parent ba61724a08
commit 1a25a566c8
20 changed files with 6674 additions and 2240 deletions

View File

@@ -3,16 +3,20 @@ import { smc } from '../common/SingletonModuleComp';
import { HeroInfo } from '../common/config/heroSet';
import { GameEvent } from '../common/config/GameEvent';
import { oops } from 'db://oops-framework/core/Oops';
import { UIID } from '../common/config/GameUIConfig';
import { GameSet } from '../common/config/BoxSet';
const { ccclass, property } = _decorator;
@ccclass('HeroReadyCom')
export class HeroReadyCom extends Component {
@property(CCInteger)
slot: number=0;
protected onLoad(): void {
oops.message.on(GameEvent.UpdateHero,this.update_hero,this)
}
start() {
this.update_hero()
oops.message.on(GameEvent.UpdateHero,this.update_hero,this)
}
update(deltaTime: number) {
@@ -24,6 +28,7 @@ export class HeroReadyCom extends Component {
this.no_hero()
return
}
this.node.getChildByName("icon").active=true
this.node.getChildByName("add").active=false
let hero_data = HeroInfo[hero]
console.log("[HeroReadyCom]hero_data",smc.fight_heros,hero,smc.fight_heros[this.slot],this.slot,hero_data)
@@ -32,6 +37,7 @@ export class HeroReadyCom extends Component {
this.node.getChildByName("icon").getComponent(Animation).addClip(clip);
this.node.getChildByName("icon").getComponent(Animation).play("idle");
});
this.node.getChildByName("lv").active=true
this.node.getChildByName("lv").getChildByName("num").getComponent(Label).string=smc.heros[hero].lv.toString()
// console.log("[HeroReadyCom]clip",this.node.getChildByName("icon").getComponent(Animation))
@@ -39,7 +45,13 @@ export class HeroReadyCom extends Component {
no_hero(){
this.node.getChildByName("lv").active=false
this.node.getChildByName("add").active=true
this.node.getChildByName("icon").active=false
}
select_hero(){
if(oops.gui.has(UIID.HeroSelect)) return
oops.gui.open(UIID.HeroSelect,{slot:this.slot})
}
}