英雄出战选择 +英雄相关 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

@@ -1,7 +1,7 @@
import { _decorator, Animation, AnimationClip, Component, Label, Node, resources } from 'cc';
import { oops } from 'db://oops-framework/core/Oops';
import { UIID } from '../common/config/GameUIConfig';
import { getHeroStatsByLevel, getUpgradeResources, HeroInfo, HType } from '../common/config/heroSet';
import { getHeroList, getHeroStatsByLevel, getUpgradeResources, HeroInfo, HType } from '../common/config/heroSet';
import { smc } from '../common/SingletonModuleComp';
import { GameEvent } from '../common/config/GameEvent';
const { ccclass, property } = _decorator;
@@ -26,7 +26,7 @@ export class HInfoComp extends Component {
this.h_uuid=uuid
let hero_data = HeroInfo[uuid]
let hero= this.node.getChildByName("hero")
let lv=smc.heros[uuid].lv
let lv=smc.heros[uuid]?.lv??1
let anm_path=hero_data.path
resources.load("game/heros/hero/"+anm_path+"/idle", AnimationClip, (err, clip) => {
hero.getComponent(Animation).addClip(clip);
@@ -48,6 +48,12 @@ export class HInfoComp extends Component {
this.node.getChildByName("type").getChildByName("w").active=hero_data.type==HType.warrior
this.node.getChildByName("type").getChildByName("r").active=hero_data.type==HType.remote
this.node.getChildByName("type").getChildByName("m").active=hero_data.type==HType.mage
this.show_luck(smc.heros[uuid]?.lv??0)
}
show_luck(lv:number){
this.node.getChildByName("upBtn").active=lv > 0
this.node.getChildByName("upNeed").active=lv > 0
this.node.getChildByName("luck").active=lv == 0
}
uplevel(){
let hero_data = HeroInfo[this.h_uuid]
@@ -64,7 +70,7 @@ export class HInfoComp extends Component {
oops.message.dispatchEvent(GameEvent.UpdateHero, {})
}
next_hero(){
let heros=smc.getHasHeroUUID()
let heros=getHeroList()
let index = heros.indexOf(this.h_uuid);
index++
if(index==heros.length) index=0
@@ -72,7 +78,7 @@ export class HInfoComp extends Component {
this.update_data(nextHero)
}
prev_hero(){
let heros=smc.getHasHeroUUID()
let heros=getHeroList()
let index = heros.indexOf(this.h_uuid);
index--
if(index==-1) index=heros.length-1