技能卡槽 需要测试确认

This commit is contained in:
2025-06-26 16:57:55 +08:00
parent b00cc9536f
commit 0a25259cf4
4 changed files with 56 additions and 61 deletions

View File

@@ -23,6 +23,7 @@ export class CardComp extends CCComp {
c_type:number=0; //1英雄,2 技能.3 装备 4.功能卡牌
is_used:boolean=false;
cost_gold:number=0;
skill_slot:string="skill1"
onLoad(){
// this.on(GameEvent.HeroSelect,this.hero_select,this)
}
@@ -47,13 +48,13 @@ export class CardComp extends CCComp {
this.node.getChildByName("Button").active=true
}, 0.1);
}
hero_skill_select(args: any){
hero_skill_select(args: any,data:any){
this.c_type=cardType.SKILL
console.log("[cardcomp]:card hero_skill_select",args)
this.c_uuid=args.uuid
this.node.getChildByName("show").active=false
this.node.getChildByName("anim").getChildByName("up").getComponent(Animation).play('carsup')
this.show_skill(this.c_uuid)
this.show_skill(this.c_uuid,data)
this.scheduleOnce(() => {
this.node.getChildByName("show").active=true
this.node.getChildByName("Button").active=true
@@ -87,12 +88,6 @@ export class CardComp extends CCComp {
let card =getRandomCardUUID() //随机获取卡牌类型
console.log("[cardcomp]:rad 开始请求卡牌",card)
switch(card.type){
case cardType.HERO:
this.hero_select(card)
break
case cardType.SKILL:
this.hero_skill_select(card)
break
case cardType.EQUIP:
this.equip_select(card)
break
@@ -102,11 +97,12 @@ export class CardComp extends CCComp {
}
}
show_skill(uuid:number){
show_skill(uuid:number,data:any){
let show=this.node.getChildByName("show")
show.getChildByName("name").getChildByName("name").getComponent(Label).string=SkillSet[uuid].name
this.do_card_bg_show(SkillSet[uuid].quality)
this.node.getChildByName("show").getChildByName("coins").active=false
this.skill_slot=data.slot
var icon_path = "game/skills/skill_icon"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = show.getChildByName("mask").getChildByName("skill").getComponent(Sprite);
@@ -246,8 +242,9 @@ export class CardComp extends CCComp {
break
case cardType.SKILL:
console.log("[cardcomp]:use_card 技能卡")
oops.message.dispatchEvent(GameEvent.UseSkillCard,{uuid:this.c_uuid})
oops.message.dispatchEvent(GameEvent.UseSkillCard,{uuid:this.c_uuid,slot:this.skill_slot})
oops.message.dispatchEvent(GameEvent.CardsClose)
this.skill_slot="skill1"
break
case cardType.EQUIP:
console.log("[cardcomp]:use_card 装备卡")