技能卡槽 需要测试确认
This commit is contained in:
@@ -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 装备卡")
|
||||
|
||||
@@ -63,12 +63,12 @@ export class CardsCompComp extends CCComp {
|
||||
// this.card4c.hero_select(list[3])
|
||||
}
|
||||
|
||||
hero_skill_select(){
|
||||
hero_skill_select(data:any){
|
||||
let list=getRandomCardsByType(cardType.SKILL,3)
|
||||
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])
|
||||
this.card1c.hero_skill_select(list[0],data)
|
||||
this.card2c.hero_skill_select(list[1],data)
|
||||
this.card3c.hero_skill_select(list[2],data)
|
||||
// this.card4c.hero_skill_select(list[3])
|
||||
}
|
||||
equip_select(){
|
||||
@@ -122,7 +122,7 @@ export class CardsCompComp extends CCComp {
|
||||
break
|
||||
case GameEvent.HeroSkillSelect:
|
||||
console.log("[CardsComp]:显示技能选择卡牌")
|
||||
this.hero_skill_select()
|
||||
this.hero_skill_select(data)
|
||||
break
|
||||
case GameEvent.FuncSelect:
|
||||
console.log("[CardsComp]:显示功能卡牌")
|
||||
|
||||
@@ -130,37 +130,36 @@ export class EquipSkillComp extends CCComp {
|
||||
|
||||
get_skill(e:GameEvent,data:any){
|
||||
console.log("get_skill")
|
||||
if(this.skill1.uuid==0){
|
||||
switch(data.slot){
|
||||
case "skill1":
|
||||
this.skill1.uuid=data.uuid
|
||||
this.skill1.skill_name=SkillSet[data.uuid].name
|
||||
this.skill1.type=1
|
||||
this.skill1.cd=SkillSet[data.uuid].cd
|
||||
this.skill1.cd_time=SkillSet[data.uuid].cd
|
||||
let icon = this.node.getChildByName("boxs").getChildByName("skill1").getChildByName("icon")
|
||||
icon.active=true
|
||||
let icon1 = this.node.getChildByName("boxs").getChildByName("skill1").getChildByName("icon")
|
||||
icon1.active=true
|
||||
var icon_path = "game/skills/skill_icon"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = icon.getChildByName("skill").getComponent(Sprite);
|
||||
const sprite = icon1.getChildByName("skill").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[data.uuid].path);
|
||||
});
|
||||
return
|
||||
}
|
||||
if(this.skill2.uuid==0){
|
||||
break
|
||||
case "skill2":
|
||||
this.skill2.uuid=data.uuid
|
||||
this.skill2.skill_name=SkillSet[data.uuid].name
|
||||
this.skill2.type=1
|
||||
this.skill2.cd=SkillSet[data.uuid].cd
|
||||
this.skill2.cd_time=SkillSet[data.uuid].cd
|
||||
let icon = this.node.getChildByName("boxs").getChildByName("skill2").getChildByName("icon")
|
||||
icon.active=true
|
||||
let icon2 = this.node.getChildByName("boxs").getChildByName("skill2").getChildByName("icon")
|
||||
icon2.active=true
|
||||
var icon_path = "game/skills/skill_icon"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = icon.getChildByName("skill").getComponent(Sprite);
|
||||
const sprite = icon2.getChildByName("skill").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[data.uuid].path);
|
||||
});
|
||||
return
|
||||
}
|
||||
if(this.skill3.uuid==0){
|
||||
break
|
||||
case "skill3":
|
||||
this.skill3.uuid=data.uuid
|
||||
this.skill3.skill_name=SkillSet[data.uuid].name
|
||||
this.skill3.type=1
|
||||
@@ -173,9 +172,8 @@ export class EquipSkillComp extends CCComp {
|
||||
const sprite = icon.getChildByName("skill").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[data.uuid].path);
|
||||
});
|
||||
return
|
||||
break
|
||||
}
|
||||
console.log("技能栏满了")
|
||||
}
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
|
||||
@@ -201,7 +201,7 @@ export class MissionComp extends CCComp {
|
||||
|
||||
}
|
||||
call_skill_card(e:any){
|
||||
oops.message.dispatchEvent(GameEvent.HeroSkillSelect)
|
||||
oops.message.dispatchEvent(GameEvent.HeroSkillSelect,{slot:e})
|
||||
}
|
||||
private cleanComponents() {
|
||||
ecs.query(ecs.allOf(HeroViewComp)).forEach(entity => {entity.remove(HeroViewComp);entity.destroy()});
|
||||
|
||||
Reference in New Issue
Block a user