英雄卡牌ui修改,todo 抽卡修改

This commit is contained in:
walkpan
2025-01-18 23:53:34 +08:00
parent 55061ec37c
commit cebf09a58c
16 changed files with 4544 additions and 1714 deletions

View File

@@ -34,7 +34,7 @@ export class BuffComp extends Component {
start() {
this.heroView = this.node.getComponent(HeroViewComp);
this.buff_get("dodge")
// this.buff_get("dodge")
// this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").active = false;
// this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").active = false;
// this.node.getChildByName("top").getChildByName("buff").getChildByName("def").active = false;

View File

@@ -15,17 +15,20 @@ export class HeroCard extends ecs.Entity {
load(uuid:number=101,parent:any) {
// var path = "game/monster/"+prefab_path;
var path = "game/gui/hero_card";
var icon_path = "game/heros/herois"
// var icon_path = "game/heros/herois"
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
let slv = node.getChildByName("slv");
node.parent = parent;
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(HeroInfo[uuid].path);
});
// resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
// const sprite = node.getChildByName("Mask").getChildByName("hero").getComponent(Sprite);
// sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
// });
var path = "game/heros/uiheros/"+HeroInfo[uuid].path;
var prefab: Prefab = oops.res.get(path, Prefab)!;
var snode = instantiate(prefab);
snode.parent = node.getChildByName("Mask")
let hcc = node.getComponent(HeroCardComp)!;
hcc.h_uuid = uuid;
hcc.update_data();

View File

@@ -1,4 +1,4 @@
import { _decorator, Color, Label, ProgressBar, Sprite } from "cc";
import { _decorator, Color, instantiate, Label, Prefab, ProgressBar, Sprite } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { HeroHomeComp } from "../map/HeroHomeComp";
@@ -41,7 +41,6 @@ export class HeroCardComp extends CCComp {
this.node.getChildByName("show").active=val
}
update_data(){
let slv = this.node.getChildByName("slv")
this.node.getChildByName("lv").getComponent(Label).string=smc.heros[this.h_uuid].lv.toString()+"级"
// if(smc.heros[this.h_uuid].slv==0){
@@ -70,14 +69,16 @@ export class HeroCardComp extends CCComp {
// break;
// }
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {
// case ModuleEvent.Cmd:
// break;
// }
// }
call_hero(uuid:number){
var path = "game/heros/uiheros/"+HeroInfo[uuid].path;
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.parent = this.node.getChildByName("Mask")
}
clear_hero(){
this.node.getChildByName("Mask").destroyAllChildren()
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();

View File

@@ -15,16 +15,20 @@ export class HeroSelect extends ecs.Entity {
load(uuid:number=101,parent:any) {
// var path = "game/monster/"+prefab_path;
var path = "game/gui/hero_set";
var icon_path = "game/heros/herois"
// var icon_path = "game/heros/herois"
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
let slv = node.getChildByName("slv");
node.parent = parent;
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(HeroInfo[uuid].path);
});
// resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
// const sprite = node.getChildByName("Mask").getChildByName("hero").getComponent(Sprite);
// sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
// });
var path = "game/heros/uiheros/"+HeroInfo[uuid].path;
var prefab: Prefab = oops.res.get(path, Prefab)!;
var snode = instantiate(prefab);
snode.parent = node.getChildByName("Mask")
let hcc = node.getComponent(HeroSelectComp)!;
hcc.h_uuid = uuid;
hcc.update_data();

View File

@@ -136,7 +136,7 @@ export class HeroViewComp extends CCComp {
this.node.setScale(this.scale,1);
this.node.getChildByName("top").setScale(this.scale,1);
if(this.is_boss){
this.node.setScale(this.node.scale.x*1.2,this.node.scale.y*1.2);
this.node.setScale(this.node.scale.x*1.5,this.node.scale.y*1.5);
this.node.getChildByName("top").getChildByName("sboss").active = true;
}
/** 显示角色血量 */