英雄信息弹窗

This commit is contained in:
2025-08-15 09:25:09 +08:00
parent cbac432bb6
commit 94231cb3b1
21 changed files with 28571 additions and 26919 deletions

View File

@@ -1,6 +1,8 @@
import { _decorator, Animation, AnimationClip, Component, Label, Node, resources } from 'cc';
import { HeroInfo, HQuality, HType } from '../common/config/heroSet';
import { smc } from '../common/SingletonModuleComp';
import { oops } from 'db://oops-framework/core/Oops';
import { UIID } from '../common/config/GameUIConfig';
const { ccclass, property } = _decorator;
@ccclass('HCardUICom')
@@ -25,11 +27,11 @@ export class HCardUICom extends Component {
});
this.node.getChildByName("name").getComponent(Label).string=hero_data.name
this.node.getChildByName("lv").getChildByName("num").getComponent(Label).string=smc.heros[uuid].lv.toString()
this.node.getChildByName("slv").getChildByName("lv1").active=smc.heros[uuid].slv>=1
this.node.getChildByName("slv").getChildByName("lv2").active=smc.heros[uuid].slv>=2
this.node.getChildByName("slv").getChildByName("lv3").active=smc.heros[uuid].slv>=3
this.node.getChildByName("slv").getChildByName("lv4").active=smc.heros[uuid].slv>=4
this.node.getChildByName("slv").getChildByName("lv5").active=smc.heros[uuid].slv>=5
// this.node.getChildByName("slv").getChildByName("lv1").active=smc.heros[uuid].slv>=1
// this.node.getChildByName("slv").getChildByName("lv2").active=smc.heros[uuid].slv>=2
// this.node.getChildByName("slv").getChildByName("lv3").active=smc.heros[uuid].slv>=3
// this.node.getChildByName("slv").getChildByName("lv4").active=smc.heros[uuid].slv>=4
// this.node.getChildByName("slv").getChildByName("lv5").active=smc.heros[uuid].slv>=5
this.node.getChildByName("g").active=hero_data.quality==HQuality.GREEN
this.node.getChildByName("gg").active=hero_data.quality==HQuality.GREEN
this.node.getChildByName("b").active=hero_data.quality==HQuality.BLUE
@@ -42,6 +44,9 @@ export class HCardUICom extends Component {
this.node.getChildByName("type").getChildByName("r").active=hero_data.type==HType.remote
this.node.getChildByName("type").getChildByName("m").active=hero_data.type==HType.mage
}
show_info(){
oops.gui.open(UIID.HeroInfo,this.h_uuid)
}
}

View File

@@ -0,0 +1,45 @@
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, HeroInfo } from '../common/config/heroSet';
import { smc } from '../common/SingletonModuleComp';
const { ccclass, property } = _decorator;
@ccclass('HInfoComp')
export class HInfoComp extends Component {
h_uuid:number=0
start() {
}
onAdded(args: any) {
console.log("[HInfoComp]:onAdded",args)
this.update_data(args)
}
update(deltaTime: number) {
}
update_data(uuid:number){
console.log("[HInfoComp]:update_data",uuid)
console.log("[HCardUICom]:update_data",uuid)
this.h_uuid=uuid
let hero_data = HeroInfo[uuid]
let hero= this.node.getChildByName("hero")
let anm_path=hero_data.path
resources.load("game/heros/hero/"+anm_path+"/idle", AnimationClip, (err, clip) => {
hero.getComponent(Animation).addClip(clip);
hero.getComponent(Animation).play("idle");
});
this.node.getChildByName("name").getComponent(Label).string=hero_data.name
this.node.getChildByName("lv").getChildByName("num").getComponent(Label).string=smc.heros[uuid].lv.toString()
let {hp,ap,def}=getHeroStatsByLevel(uuid,smc.heros[uuid].lv)
this.node.getChildByName("info").getChildByName("hp").getChildByName("num").getComponent(Label).string=hp.toString()
this.node.getChildByName("info").getChildByName("ap").getChildByName("num").getComponent(Label).string=ap.toString()
this.node.getChildByName("info").getChildByName("def").getChildByName("num").getComponent(Label).string=def.toString()
}
close(){
oops.gui.removeByNode(this.node)
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "f8dd2383-61ab-4cf9-9879-0d0fe2cd6c2f",
"files": [],
"subMetas": {},
"userData": {}
}