英雄卡牌ui修改,todo 抽卡修改
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
/** 显示角色血量 */
|
||||
|
||||
@@ -15,15 +15,19 @@ export class HCard extends ecs.Entity {
|
||||
}
|
||||
load(uuid:number=1001,index:number=-1,parent:any) {
|
||||
var path = "game/gui/hcard";
|
||||
var icon_path = "game/heros/herois"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = node.getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
|
||||
});
|
||||
// var icon_path = "game/heros/herois"
|
||||
// resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
// const sprite = node.getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
|
||||
// sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
|
||||
// });
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
console.log("load_hcard",prefab)
|
||||
var node = instantiate(prefab);
|
||||
node.parent = parent
|
||||
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")
|
||||
var hcc = node.getComponent(HCardComp)!;
|
||||
hcc.hi= index
|
||||
this.add(hcc)
|
||||
|
||||
@@ -61,8 +61,7 @@ export class HeroHomeComp extends CCComp {
|
||||
this.node.getChildByName("show").active=true
|
||||
this.h_uuid=uuid
|
||||
this.hero=HeroInfo[uuid]
|
||||
this.gold_need=(getUpGoldByRange(smc.heros[uuid].lv)*smc.heros[uuid].lv)
|
||||
this.chip_need=(getUpChipByLv(smc.heros[uuid].lv)-this.hero.lvexp)*smc.heros[uuid].lv
|
||||
|
||||
console.log("hero_show",uuid)
|
||||
let skill1 = SkillSet[this.hero.sk1[0]]
|
||||
let skill2 = SkillSet[this.hero.sk2[0]]
|
||||
@@ -101,6 +100,8 @@ export class HeroHomeComp extends CCComp {
|
||||
}
|
||||
update_data(){
|
||||
this.slv = Math.floor((smc.heros[this.h_uuid].lv) / 5);
|
||||
this.gold_need=(getUpGoldByRange(smc.heros[this.h_uuid].lv)*smc.heros[this.h_uuid].lv)
|
||||
this.chip_need=getUpChipByLv(smc.heros[this.h_uuid].lv)-this.hero.lvexp
|
||||
// let slv_node=this.node.getChildByName("show").getChildByName("name").getChildByName("slv");
|
||||
let lvup=this.node.getChildByName("show").getChildByName("lvup");
|
||||
// let slvup=this.node.getChildByName("show").getChildByName("slvup");
|
||||
|
||||
Reference in New Issue
Block a user