功能性卡牌功能继续

This commit is contained in:
panw
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){

View File

@@ -49,7 +49,7 @@ export class CardsCompComp extends CCComp {
}
hero_select(){
let list=getRandomCardsByType(cardType.HERO,4)
console.log("英雄选择卡牌列表",list)
console.log("[CardsComp]:英雄选择卡牌列表",list)
this.card1c.hero_select(list[0])
this.card2c.hero_select(list[1])
this.card3c.hero_select(list[2])
@@ -57,9 +57,8 @@ export class CardsCompComp extends CCComp {
}
hero_skill_select(){
let list=getRandomCardsByType(cardType.SKILL,4)
console.log("技能选择卡牌列表",list)
console.log("[CardsComp]:技能选择卡牌列表",list)
this.card1c.hero_skill_select(list[0])
this.card2c.hero_skill_select(list[1])
this.card3c.hero_skill_select(list[2])
@@ -67,14 +66,19 @@ export class CardsCompComp extends CCComp {
}
equip_select(){
let list=getRandomCardsByType(cardType.EQUIP,4)
console.log("装备选择卡牌列表",list)
console.log("[CardsComp]:装备选择卡牌列表",list)
this.card1c.equip_select(list[0])
this.card2c.equip_select(list[1])
this.card3c.equip_select(list[2])
this.card4c.equip_select(list[3])
}
func_select(){
console.log("功能选择卡牌")
let list=getRandomCardsByType(cardType.SPECIAL,4)
console.log("[CardsComp]:功能选择卡牌列表",list)
this.card1c.func_select(list[0])
this.card2c.func_select(list[1])
this.card3c.func_select(list[2])
this.card4c.func_select(list[3])
}
random_select(){
this.card1c.random_select()
@@ -85,7 +89,7 @@ export class CardsCompComp extends CCComp {
/** 添加卡牌展示到队列 */
private addToQueue(e: GameEvent, data?: any) {
console.log("添加卡牌到队列", e);
console.log("[CardsComp]:添加卡牌到队列", e);
this.cardQueue.push({type: e, data: data});
this.processQueue();
}
@@ -105,15 +109,15 @@ export class CardsCompComp extends CCComp {
this.node.getChildByName("Button").active=false
switch(e){
case GameEvent.HeroSelect:
console.log("显示英雄选择卡牌")
console.log("[CardsComp]:显示英雄选择卡牌")
this.hero_select()
break
case GameEvent.HeroSkillSelect:
console.log("显示技能选择卡牌")
console.log("[CardsComp]:显示技能选择卡牌")
this.hero_skill_select()
break
case GameEvent.CardRefresh:
console.log("显示随机刷新卡牌")
console.log("[CardsComp]:显示随机刷新卡牌")
this.node.getChildByName("Button").active=true
this.random_select()
break
@@ -123,16 +127,16 @@ export class CardsCompComp extends CCComp {
close_cards(e:GameEvent,data:any){
switch(e){
case GameEvent.HeroSelect:
console.log("关闭英雄选择卡牌")
console.log("[CardsComp]:关闭英雄选择卡牌")
break
case GameEvent.HeroSkillSelect:
console.log("关闭技能选择卡牌")
console.log("[CardsComp]:关闭技能选择卡牌")
break
case GameEvent.CardRefresh:
console.log("关闭随机刷新卡牌")
console.log("[CardsComp]:关闭随机刷新卡牌")
break
case GameEvent.CardsClose:
console.log("关闭所有卡牌")
console.log("[CardsComp]:关闭所有卡牌")
break
}
this.hide()