天赋触发和 ui制作完成

This commit is contained in:
2025-07-29 17:08:42 +08:00
parent 3fe8edf88a
commit 16195f4cb4
9 changed files with 16800 additions and 20478 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -47,6 +47,7 @@ export enum GameEvent {
EquipSelect = "EquipSelect",
FuncSelect = "FuncSelect",
TalentSelect = "TalentSelect",
UseTalentCard = "UseTalentCard",
RefreshCard = "RefreshCard",
NewWave = "NewWave",
ChangeATK = "ChangeATK",

View File

@@ -37,7 +37,14 @@ export interface TalentConfig {
info: string;
icon?: string;
}
export const TalentSlot = {
0:"tal1",
1:"tal2",
2:"tal3",
3:"tal4",
4:"tal5",
5:"tal6",
}
// 天赋列表配置
export const TalentList: { [key: number]: TalentConfig } = {
// ==================== 蓝色品质天赋 ====================

View File

@@ -27,6 +27,7 @@ export class CardComp extends CCComp {
cost_gold:number=0;
skill_slot:string="skill1"
equip_slot:string="weapon"
talent_slot:string="tal1"
is_master:boolean=false;
enhancement_data:any=null;
onLoad(){
@@ -41,18 +42,21 @@ export class CardComp extends CCComp {
this.node.getChildByName("Button").active=false
this.node.getChildByName("show").active=false
}
talent_select(args: any){
talent_select(args: any,data:any){
this.c_type=cardType.TALENT
this.c_uuid=args.uuid
this.talent_slot=data.slot
this.show_talent(this.c_uuid)
this.node.getChildByName("show").active=false
this.node.getChildByName("anim").getChildByName("up").getComponent(Animation).play('carsup')
this.show_talent(this.c_uuid)
this.scheduleOnce(() => {
this.node.getChildByName("show").active=true
this.node.getChildByName("Button").active=true
}, 0.1);
}
hero_select(args: any,is_master:boolean=false){
console.log("[cardcomp]:card hero_select",args,is_master)
this.c_type=cardType.HERO
this.c_uuid=args.uuid
console.log("[cardcomp]:card hero_select c_uuid:"+this.c_uuid)
this.is_master=is_master
this.show_hero(this.c_uuid,is_master)
this.node.getChildByName("show").active=false
@@ -64,11 +68,12 @@ export class CardComp extends CCComp {
}
hero_skill_select(args: any,data:any){
this.c_type=cardType.SKILL
console.log("[cardcomp]:card hero_skill_select",args)
// console.log("[cardcomp]:card hero_skill_select",args)
this.c_uuid=args.uuid
this.skill_slot=data.slot
this.node.getChildByName("show").active=false
this.node.getChildByName("anim").getChildByName("up").getComponent(Animation).play('carsup')
this.show_skill(this.c_uuid,data)
this.show_skill(this.c_uuid)
this.scheduleOnce(() => {
this.node.getChildByName("show").active=true
this.node.getChildByName("Button").active=true
@@ -122,7 +127,7 @@ export class CardComp extends CCComp {
break
}
}
show_talent(uuid:number){
show_talent(uuid:number,){
let show=this.node.getChildByName("show")
show.getChildByName("name").getChildByName("name").getComponent(Label).string=TalentList[uuid].name
this.do_card_bg_show(TalentList[uuid].quality)
@@ -133,13 +138,13 @@ export class CardComp extends CCComp {
sprite.spriteFrame = atlas.getSpriteFrame(TalentList[uuid].path);
});
show.getChildByName("info").getComponent(Label).string=TalentList[uuid].info
console.log("[cardcomp]:show_talent",TalentList[uuid],show)
}
show_skill(uuid:number,data:any){
show_skill(uuid:number){
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/heros/cards"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = show.getChildByName("mask").getChildByName("skill").getComponent(Sprite);
@@ -338,6 +343,11 @@ export class CardComp extends CCComp {
console.log("[cardcomp]:use_card 强化卡",this.enhancement_data,smc.enhancements)
oops.message.dispatchEvent(GameEvent.CardsClose)
break
case cardType.TALENT:
console.log("[cardcomp]:use_card 天赋卡",this.c_uuid)
oops.message.dispatchEvent(GameEvent.UseTalentCard,{uuid:this.c_uuid,slot:this.talent_slot})
oops.message.dispatchEvent(GameEvent.CardsClose)
break
}
this.reset_card()
}

View File

@@ -47,6 +47,7 @@ export class CardsCompComp extends CCComp {
this.on(GameEvent.CardsClose, this.close_cards, this);
this.on(GameEvent.EquipSelect, this.addToQueue, this);
this.on(GameEvent.EnhancementSelect, this.addToQueue, this);
this.on(GameEvent.TalentSelect, 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")
@@ -96,19 +97,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.talent_select()
this.talent_select(data)
break
}
if(!is_refresh) this.show()
}
talent_select(){
talent_select(data:any){
let list=getRandomCardsByType(cardType.TALENT,3,Quality.GREEN)
console.log("[CardsComp]:天赋选择卡牌列表",list)
this.card1c.talent_select(list[0])
this.card2c.talent_select(list[1])
this.card3c.talent_select(list[2])
this.card1c.talent_select(list[0],data)
this.card2c.talent_select(list[1],data)
this.card3c.talent_select(list[2],data)
}
enhancement_select(){
let list=getEnhancement(smc.enhancements,3)

View File

@@ -10,6 +10,8 @@ import { HeroViewComp } from "../hero/HeroViewComp";
import { Hero } from "../hero/Hero";
import { defaultEnhancements, EnhancementOptions } from "../common/config/LevelUp";
import { MonModelComp } from "../hero/MonModelComp";
import { TalentSlot } from "../common/config/TalentSet";
import { RogueTalWave } from "./RogueConfig";
const { ccclass, property } = _decorator;
@@ -35,6 +37,15 @@ export class MissionComp extends CCComp {
wave_time_num:number = 0;
wave_time_cd:Timer=new Timer(1);
is_in_wave:boolean = false;
tals:{
0:false,
1:false,
2:false,
3:false,
4:false,
5:false,
}
onLoad(){
this.on(GameEvent.MissionStart,this.mission_start,this)
this.on(GameEvent.MasterCalled,this.ready_to_fight,this)
@@ -79,23 +90,30 @@ export class MissionComp extends CCComp {
// 奖励发放
}
count_tal(){
let count=0
for(let i=0;i<6;i++){
if(this.tals[i]){
count++
}
}
return count
}
do_mon_dead(){
smc.vmdata.mission_data.mon_num--
if(smc.vmdata.mission_data.mon_num<=0) {
switch(smc.vmdata.mission_data.current_wave){
case 1:
this.do_next_wave()
break
case 2:
this.do_next_wave()
break
if(smc.vmdata.mission_data.current_wave == RogueTalWave[this.count_tal()].wave){
console.log("[MissionComp] 怪物全死亡后触发天赋奖励",RogueTalWave[this.count_tal()].tal_slot_key)
oops.message.dispatchEvent(GameEvent.TalentSelect,{slot:TalentSlot[this.count_tal()]})
this.tals[this.count_tal()]=true
}
this.show_time(this.do_next_wave.bind(this))
}
}
do_next_wave(){ //怪物死亡后,重置时间
smc.vmdata.mission_data.current_wave++
oops.message.dispatchEvent(GameEvent.NewWave)
@@ -218,6 +236,14 @@ export class MissionComp extends CCComp {
smc.enhancements=defaultEnhancements()
this.hide_time()
this.hide_wave_time()
this.tals={
0:false,
1:false,
2:false,
3:false,
4:false,
5:false,
}
smc.vmdata.mission_data.wave_time_num=FightSet.ONE_WAVE_TIME
console.log("局内数据初始化",smc.enhancements,defaultEnhancements())

View File

@@ -33,8 +33,15 @@ export enum RogueWaveType {
FINAL_BOSS = "final_boss" // 最终Boss波次9波
}
//奖励天赋波次数
export const RewardTalWave = [1,2,3,4,5,6,7,8,9]
//波次和天赋对应关系
export const RogueTalWave = {
0:{tal_slot_key:0,wave:1},
1:{tal_slot_key:1,wave:2},
2:{tal_slot_key:2,wave:3},
3:{tal_slot_key:3,wave:4},
4:{tal_slot_key:4,wave:5},
5:{tal_slot_key:5,wave:6},
}
/**
* 固定数值配置(根据波次固定血量和攻击力)

View File

@@ -0,0 +1,147 @@
import { _decorator, Component, Label, Node, resources, Sprite, SpriteAtlas } from 'cc';
import { oops } from 'db://oops-framework/core/Oops';
import { GameEvent } from '../common/config/GameEvent';
import { smc } from '../common/SingletonModuleComp';
import { EquipInfo, EquipType, EquipAttrTarget, EquipSpecialAttr} from '../common/config/Equips';
import { BuffAttr, DebuffAttr, geDebuffNum, getBuffNum } from '../common/config/SkillSet';
import { FightSet } from '../common/config/Mission';
import { Quality } from '../common/config/CardSet';
import { TalentList, TalentSlot } from '../common/config/TalentSet';
const { ccclass, property } = _decorator;
@ccclass('TalsComp')
export class TalsComp extends Component {
tal1:any=null
tal2:any=null
tal3:any=null
tal4:any=null
tal5:any=null
tal6:any=null
boxs:Node=null
// attrs:any={
// hero_buff:getBuffNum(),
// enemy_buff:getBuffNum(),
// }
/** 视图层逻辑代码分离演示 */
onLoad() {
oops.message.on(GameEvent.FightReady,this.fight_ready,this)
oops.message.on(GameEvent.UseTalentCard,this.tal_add,this)
this.boxs=this.node.getChildByName("boxs")
}
start(){
this.fight_ready()
}
fight_ready(){
this.boxs.getChildByName("tal1").getChildByName("icon").active=false
this.boxs.getChildByName("tal2").getChildByName("icon").active=false
this.boxs.getChildByName("tal3").getChildByName("icon").active=false
this.boxs.getChildByName("tal4").getChildByName("icon").active=false
this.boxs.getChildByName("tal5").getChildByName("icon").active=false
this.boxs.getChildByName("tal6").getChildByName("icon").active=false
this.boxs.getChildByName("tal1").getChildByName("light").active=false
this.boxs.getChildByName("tal2").getChildByName("light").active=false
this.boxs.getChildByName("tal3").getChildByName("light").active=false
this.boxs.getChildByName("tal4").getChildByName("light").active=false
this.boxs.getChildByName("tal5").getChildByName("light").active=false
this.boxs.getChildByName("tal6").getChildByName("light").active=false
this.reset_attrs()
}
tal_add(e:GameEvent,data:any){
console.log("[TalsComp]:tal_add",data)
switch(data.slot){
case TalentSlot[0]:
this.tal1.uuid=data.uuid
this.tal1.name=data.name
this.show_tal(data.uuid,TalentSlot[0])
break
case TalentSlot[1]:
this.tal2.uuid=data.uuid
this.tal2.name=data.name
this.show_tal(data.uuid,TalentSlot[1])
break
case TalentSlot[2]:
this.tal3.uuid=data.uuid
this.tal3.name=data.name
this.show_tal(data.uuid,TalentSlot[2])
break
case TalentSlot[3]:
this.tal4.uuid=data.uuid
this.tal4.name=data.name
this.show_tal(data.uuid,TalentSlot[3])
break
case TalentSlot[4]:
this.tal5.uuid=data.uuid
this.tal5.name=data.name
this.show_tal(data.uuid,TalentSlot[4])
break
case TalentSlot[5]:
this.tal6.uuid=data.uuid
this.tal6.name=data.name
this.show_tal(data.uuid,TalentSlot[5])
break
}
}
show_tal(uuid:number,slot:string="tal1"){
let icon = this.boxs.getChildByName(slot).getChildByName("icon")
icon.active=true
var icon_path = "game/heros/cards"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = icon.getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(TalentList[uuid].path);
});
icon.getChildByName("q1").active=TalentList[uuid].quality==Quality.WHITE
icon.getChildByName("q2").active=TalentList[uuid].quality==Quality.GREEN
icon.getChildByName("q3").active=TalentList[uuid].quality==Quality.BLUE
icon.getChildByName("q4").active=TalentList[uuid].quality==Quality.PURPLE
icon.getChildByName("q5").active=TalentList[uuid].quality==Quality.ORANGE
}
// 重置所有属性为0
private reset_attrs() {
this.tal1={
uuid:0,
name:"tal1",
slot:TalentSlot[0],
}
this.tal2={
uuid:0,
name:"tal2",
slot:TalentSlot[1],
}
this.tal3={
uuid:0,
name:"tal3",
slot:TalentSlot[2],
}
this.tal4={
uuid:0,
name:"tal4",
slot:TalentSlot[3],
}
this.tal5={
uuid:0,
name:"tal5",
slot:TalentSlot[4],
}
this.tal6={
uuid:0,
name:"tal6",
slot:TalentSlot[5],
}
}
update(dt: number): void {
if(!smc.mission.play||smc.mission.pause) return
}
}

View File

@@ -0,0 +1 @@
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"da5d321d-c73e-40d4-beac-6f5141ef0ac3","files":[],"subMetas":{},"userData":{}}