diff --git a/assets/script/game/common/config/CardSet.ts b/assets/script/game/common/config/CardSet.ts index 35937733..cec38d8a 100644 --- a/assets/script/game/common/config/CardSet.ts +++ b/assets/script/game/common/config/CardSet.ts @@ -5,6 +5,7 @@ import { getHeroList, HeroList } from "./heroSet" import { getSkills, HeroSkillList, SkillSet } from "./SkillSet" import { equip_list, weapons, armors, accessorys, getEquipUUIDsByTypeAndLevel } from "./Equips" +import { getEnhancement } from "./LevelUp" //1:伙伴 2:技能 3:装备的出现概率配置 export const CardProbability={ @@ -17,6 +18,7 @@ export const cardType={ SKILL:2, EQUIP:3, SPECIAL:4, + ENHANCEMENT:5, } // 获取随机卡牌UUID export function getRandomCardUUID( @@ -65,6 +67,7 @@ export function getRandomCardUUID( case cardType.SPECIAL: // 功能卡牌 cardList = SuperCardsList; break; + } // 从对应类型的卡牌列表中随机选择一个 diff --git a/assets/script/game/common/config/GameEvent.ts b/assets/script/game/common/config/GameEvent.ts index 0c8c119b..632b59b3 100644 --- a/assets/script/game/common/config/GameEvent.ts +++ b/assets/script/game/common/config/GameEvent.ts @@ -30,7 +30,8 @@ export enum GameEvent { HeroSkillSelect = "HeroSkillSelect", HeroSkillSelectEnd = "HeroSkillSelectEnd", HeroSelect = "HeroSelect", - + EnhancementSelect = "EnhancementSelect", + UseEnhancement = "UseEnhancement", MasterCalled = "MasterCalled", FightStart = "FightStart", FightPause = "FightPause", diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index b5fc62c6..20a00d45 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -119,6 +119,7 @@ export class HeroViewComp extends CCComp { this.on(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,this.change_atk,this) this.on(GameEvent.UpdateHP,this.update_hp,this) this.on(GameEvent.EXPUP,this.exp_up,this) + this.on(GameEvent.UseEnhancement,this.use_enhancement,this) // let anm = this.node.getChildByName("anm") // anm.setScale(anm.scale.x*0.8,anm.scale.y*0.8); } @@ -156,7 +157,10 @@ export class HeroViewComp extends CCComp { // 处理伤害队列 this.processDamageQueue(); } - + use_enhancement(e:GameEvent,data:any){ + console.log("[HeroViewComp]:use_enhancement",data) + + } change_atk(e:GameEvent,data:any){ if(!this.is_master) return diff --git a/assets/script/game/map/CardComp.ts b/assets/script/game/map/CardComp.ts index ab787d2b..bb41ba1d 100644 --- a/assets/script/game/map/CardComp.ts +++ b/assets/script/game/map/CardComp.ts @@ -12,6 +12,7 @@ import { HeroSkillList, SkillSet } from "../common/config/SkillSet"; import { cardType, getRandomCardUUID, Quality, SuperCards } from "../common/config/CardSet"; import { EquipInfo, EquipType } from "../common/config/Equips"; import { FightSet } from "../common/config/Mission"; +import { EnhancementOptions } from "../common/config/LevelUp"; const { ccclass, property } = _decorator; @@ -26,6 +27,7 @@ export class CardComp extends CCComp { skill_slot:string="skill1" equip_slot:string="weapon" is_master:boolean=false; + enhancement_data:any=null; onLoad(){ // this.on(GameEvent.HeroSelect,this.hero_select,this) } @@ -88,6 +90,13 @@ export class CardComp extends CCComp { this.node.getChildByName("Button").active=true }, 0.1); } + enhancement_select(args: any){ + this.c_type=cardType.ENHANCEMENT + this.enhancement_data=args + this.node.getChildByName("show").active=false + this.node.getChildByName("anim").getChildByName("up").getComponent(Animation).play('carsup') + this.show_enhancement(args) + } random_select(){ let card =getRandomCardUUID() //随机获取卡牌类型 @@ -163,6 +172,12 @@ export class CardComp extends CCComp { show.getChildByName("info").getComponent(Label).string=SuperCards[uuid].info } + show_enhancement(data:any){ + let show=this.node.getChildByName("show") + show.getChildByName("name").getChildByName("name").getComponent(Label).string=data.name + this.do_card_bg_show(data.rarity) + } + do_card_bg_show(q:number=Quality.WHITE){ this.node.getChildByName("Button").getChildByName("Label").getComponent(Label).string=this.check_heros() let show=this.node.getChildByName("show") @@ -298,6 +313,11 @@ export class CardComp extends CCComp { oops.message.dispatchEvent(GameEvent.UseSpecialCard,{uuid:this.c_uuid}) oops.message.dispatchEvent(GameEvent.CardsClose) break + case cardType.ENHANCEMENT: + console.log("[cardcomp]:use_card 强化卡") + oops.message.dispatchEvent(GameEvent.UseEnhancement,this.enhancement_data) + oops.message.dispatchEvent(GameEvent.CardsClose) + break } this.reset_card() } diff --git a/assets/script/game/map/CardsComp.ts b/assets/script/game/map/CardsComp.ts index d2b4a2b4..9e9dbde3 100644 --- a/assets/script/game/map/CardsComp.ts +++ b/assets/script/game/map/CardsComp.ts @@ -8,6 +8,7 @@ import { smc } from "../common/SingletonModuleComp"; import { RandomManager } from "db://oops-framework/core/common/random/RandomManager"; import { EquipType } from "../common/config/Equips"; import { getSkills, Quality } from "../common/config/SkillSet"; +import { getEnhancement } from "../common/config/LevelUp"; const { ccclass, property } = _decorator; @@ -84,12 +85,24 @@ export class CardsCompComp extends CCComp { this.node.getChildByName("top").getChildByName("title").getChildByName("Label").getComponent(Label).string="选择装备" this.equip_select(data) break + case GameEvent.EnhancementSelect: + console.log("[CardsComp]:显示强化选择卡牌") + this.node.getChildByName("btns").getChildByName("cancel").active=true + this.node.getChildByName("top").getChildByName("title").getChildByName("Label").getComponent(Label).string="选择强化" + this.enhancement_select(data) + break } if(!is_refresh) this.show() } - + enhancement_select(data:any){ + let list=getEnhancement([0,0,0,0],3) + console.log("[CardsComp]:强化选择卡牌列表",list) + this.card1c.enhancement_select(data[0]) + this.card2c.enhancement_select(data[1]) + this.card3c.enhancement_select(data[2]) + } hero_select(data:any){ let list=[] if(data.is_master){ //1是主将,0 是伙伴