强化选项 完成

This commit is contained in:
panw
2025-07-16 10:38:47 +08:00
parent 6f2af2f395
commit 82127a81ba
9 changed files with 204 additions and 176 deletions

View File

@@ -96,6 +96,10 @@ export class CardComp extends CCComp {
this.node.getChildByName("show").active=false
this.node.getChildByName("anim").getChildByName("up").getComponent(Animation).play('carsup')
this.show_enhancement(args)
this.scheduleOnce(() => {
this.node.getChildByName("show").active=true
this.node.getChildByName("Button").active=true
}, 0.1);
}
random_select(){
@@ -176,6 +180,12 @@ export class CardComp extends CCComp {
let show=this.node.getChildByName("show")
show.getChildByName("name").getChildByName("name").getComponent(Label).string=data.name
this.do_card_bg_show(data.rarity)
var icon_path = "game/heros/cards"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = show.getChildByName("mask").getChildByName("func").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(data.icon);
});
show.getChildByName("info").getComponent(Label).string=data.description
}
do_card_bg_show(q:number=Quality.WHITE){
@@ -316,6 +326,11 @@ export class CardComp extends CCComp {
case cardType.ENHANCEMENT:
console.log("[cardcomp]:use_card 强化卡")
oops.message.dispatchEvent(GameEvent.UseEnhancement,this.enhancement_data)
if(this.enhancement_data.lv >=5){
smc.enhancements[this.enhancement_data.type]=this.enhancement_data.lv
}else{
smc.enhancements[this.enhancement_data.type]=this.enhancement_data.lv+1
}
oops.message.dispatchEvent(GameEvent.CardsClose)
break
}

View File

@@ -46,6 +46,7 @@ export class CardsCompComp extends CCComp {
this.on(GameEvent.HeroSkillSelectEnd, this.close_cards, this);
this.on(GameEvent.CardsClose, this.close_cards, this);
this.on(GameEvent.EquipSelect, this.addToQueue, this);
this.on(GameEvent.EnhancementSelect, this.addToQueue, this);
this.card1=this.node.getChildByName("cards").getChildByName("card1")
this.card2=this.node.getChildByName("cards").getChildByName("card2")
this.card3=this.node.getChildByName("cards").getChildByName("card3")
@@ -89,19 +90,19 @@ export class CardsCompComp extends CCComp {
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)
this.enhancement_select()
break
}
if(!is_refresh) this.show()
}
enhancement_select(data:any){
let list=getEnhancement([0,0,0,0],3)
enhancement_select(){
let list=getEnhancement(smc.enhancements,3)
console.log("[CardsComp]:强化选择卡牌列表",list)
this.card1c.enhancement_select(data[0])
this.card2c.enhancement_select(data[1])
this.card3c.enhancement_select(data[2])
this.card1c.enhancement_select(list[0])
this.card2c.enhancement_select(list[1])
this.card3c.enhancement_select(list[2])
}
hero_select(data:any){
let list=[]

View File

@@ -8,6 +8,7 @@ import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/
import { GameEvent } from "../common/config/GameEvent";
import { HeroViewComp } from "../hero/HeroViewComp";
import { Hero } from "../hero/Hero";
import { defaultEnhancements, EnhancementOptions } from "../common/config/LevelUp";
const { ccclass, property } = _decorator;
@@ -24,6 +25,7 @@ export class MissionComp extends CCComp {
waveTimer:Timer = new Timer(10);
normal_max_wave:number = 10;
is_fight:boolean = false;
enhancements:any=[0,0,0,0,0]
onLoad(){
this.on(GameEvent.MissionStart,this.mission_start,this)
this.on(GameEvent.FightEnd,this.fight_end,this)
@@ -105,7 +107,7 @@ export class MissionComp extends CCComp {
smc.vmdata.hero = JSON.parse(JSON.stringify(VmInfo));
smc.vmdata.boss = JSON.parse(JSON.stringify(VmInfo));
this.GlodAddTimer=new Timer(smc.vmdata.mission_data.refrsh_time)
smc.enhancements=defaultEnhancements()
}