升级初步完成

This commit is contained in:
2024-12-06 16:34:17 +08:00
parent 4bac3c6d86
commit a968281bdc
9 changed files with 54 additions and 67 deletions

View File

@@ -3,6 +3,7 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { HeroCardComp } from "./HeroCardComp";
import { smc } from "../common/SingletonModuleComp";
import { HeroInfo } from "../common/config/heroSet";
/** HeroCard 模块 */
@ecs.register(`HeroCard`)
@@ -18,17 +19,17 @@ export class HeroCard extends ecs.Entity {
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.parent = parent;
node.getChildByName("name").getComponent(Label).string = smc.heros[uuid].name
node.getChildByName("name").getComponent(Label).string = HeroInfo[uuid].name
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = node.getChildByName("Mask").getChildByName("hero").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(smc.heros[uuid].path);
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
});
node.getChildByName("lv").getComponent(Label).string = smc.vmdata.heros[uuid].lv.toString();
if(smc.vmdata.heros[uuid].slv>=1) node.getChildByName("slv").getChildByName("s1").active=true;
if(smc.vmdata.heros[uuid].slv>=2) node.getChildByName("slv").getChildByName("s2").active=true;
if(smc.vmdata.heros[uuid].slv>=3) node.getChildByName("slv").getChildByName("s3").active=true;
if(smc.vmdata.heros[uuid].slv>=4) node.getChildByName("slv").getChildByName("s4").active=true;
if(smc.vmdata.heros[uuid].slv>=5) node.getChildByName("slv").getChildByName("s5").active=true;
node.getChildByName("lv").getComponent(Label).string = smc.heros[uuid].lv.toString();
if(smc.heros[uuid].slv>=1) node.getChildByName("slv").getChildByName("s1").active=true;
if(smc.heros[uuid].slv>=2) node.getChildByName("slv").getChildByName("s2").active=true;
if(smc.heros[uuid].slv>=3) node.getChildByName("slv").getChildByName("s3").active=true;
if(smc.heros[uuid].slv>=4) node.getChildByName("slv").getChildByName("s4").active=true;
if(smc.heros[uuid].slv>=5) node.getChildByName("slv").getChildByName("s5").active=true;
let hcc = node.getComponent(HeroCardComp)!;
hcc.hcc_uuid = uuid;
this.add(hcc);