功能性卡牌功能继续

This commit is contained in:
2025-06-18 17:17:29 +08:00
parent b6a2ab2921
commit ab9ff70f77
4 changed files with 69 additions and 38 deletions

View File

@@ -19,7 +19,7 @@ const { ccclass, property } = _decorator;
@ecs.register('Card', false)
export class CardComp extends CCComp {
c_uuid:number=0;
c_type:number=0; //0英雄,1 技能.2 装备
c_type:number=0; //1英雄,2 技能.3 装备 4.功能卡牌
is_used:boolean=false;
onLoad(){
@@ -37,7 +37,7 @@ export class CardComp extends CCComp {
this.node.getChildByName("show").active=false
}
hero_select(args: any){
this.c_type=0
this.c_type=cardType.HERO
this.c_uuid=args.uuid
console.log("card hero_select c_uuid:"+this.c_uuid)
this.show_hero(this.c_uuid)
@@ -49,7 +49,7 @@ export class CardComp extends CCComp {
}, 0.1);
}
hero_skill_select(args: any){
this.c_type=1
this.c_type=cardType.SKILL
console.log("card hero_skill_select",args)
this.c_uuid=args.uuid
this.node.getChildByName("show").active=false
@@ -61,7 +61,7 @@ export class CardComp extends CCComp {
}, 0.1);
}
equip_select(args: any){
this.c_type=2
this.c_type=cardType.EQUIP
this.c_uuid=args.uuid
this.node.getChildByName("show").active=false
this.node.getChildByName("anim").getChildByName("up").getComponent(Animation).play('carsup')
@@ -73,7 +73,17 @@ export class CardComp extends CCComp {
}
func_select(args: any){
console.log("card func_select",args)
this.c_type=cardType.SPECIAL
this.c_uuid=args.uuid
this.node.getChildByName("show").active=false
this.node.getChildByName("anim").getChildByName("up").getComponent(Animation).play('carsup')
this.show_func(this.c_uuid)
this.scheduleOnce(() => {
this.node.getChildByName("show").active=true
this.node.getChildByName("Button").active=true
}, 0.1);
}
random_select(){
let card =getRandomCardUUID() //随机获取卡牌类型
console.log("rad 开始请求卡牌",card)
@@ -87,8 +97,12 @@ export class CardComp extends CCComp {
case cardType.EQUIP:
this.equip_select(card)
break
case cardType.SPECIAL:
this.func_select(card)
break
}
}
show_skill(uuid:number){
let show=this.node.getChildByName("show")
show.getChildByName("name").getComponent(Label).string=SkillSet[uuid].name
@@ -149,6 +163,15 @@ export class CardComp extends CCComp {
});
this.node.getChildByName("Button").getChildByName("Label").getComponent(Label).string=this.check_heros()
}
show_func(uuid:number){
let show=this.node.getChildByName("show")
show.getChildByName("ap").active=false
show.getChildByName("hp").active=false
show.getChildByName("mask").getChildByName("skill").active=false
show.getChildByName("mask").getChildByName("s_bg").active=false
show.getChildByName("mask").getChildByName("equip").active=false
show.getChildByName("mask").getChildByName("e_bg").active=false
}
check_heros(){
// let heros=ecs.query(ecs.allOf(HeroModelComp))
// for(let hero of heros){