修复bug和ui调整,下一步,达到特定等级才激活技能

This commit is contained in:
2025-07-23 10:41:09 +08:00
parent 1611b5d3b5
commit f805bbcd4a
138 changed files with 12897 additions and 56084 deletions

View File

@@ -37,7 +37,7 @@ export const getHeroList = (is_master:number=0)=>{
}
}
export const HeroList = [5021,5022,5023,5024,5025,5026,5027,5028]
export const MonList = [5201,5202,5203,5204,5205,5206,5216,5217,5218,5219,5220,5221,5222,5223,5224,5225,5226,5227]
export const MonList = [5201,5202,5203,5204,5205,5206,5219,5220,5221,5222,5223,5224,5225,5226,5227]
export const Masters = [5001,5002,5003,5004]
export const HeroPos={
@@ -227,92 +227,72 @@ export const HeroInfo = {
//主将
5001:{uuid:5001,name:"刺心.艾吉斯",path:"k1", quality:HQuality.BLUE,lv:1,kind:1,
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6005],
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6005,6022,6022],
buff:[
{buff_type:BuffAttr.PUNCTURE,value:1},
],info:"剑类专精,穿刺伤害额外+10%"},
5002:{uuid:5002,name:"飓风.格罗姆",path:"k2", quality:HQuality.BLUE,lv:1,kind:1,
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6006],
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6006,6022,6022],
buff:[
{buff_type:BuffAttr.WFUNY,value:10},
],info:"斧类专精,风怒概率增加10%"},
5003:{uuid:5003,name:"碎颅.赫克托",path:"k4", quality:HQuality.BLUE,lv:1,kind:1,
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6007],
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6007,6022,6022],
buff:[
{buff_type:BuffAttr.CRITICAL,value:10},
],info:"锤类专精,暴击概率增加10%"},
5004:{uuid:5004,name:"裂伤.塔米拉",path:"k3", quality:HQuality.BLUE,lv:1,kind:1,
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6008],
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6008,6022,6022],
buff:[
{buff_type:BuffAttr.BURN_COUNT,value:1},
],info:"刀类专精,易伤效果额外持续1次"},
5005:{uuid:5005,name:"烈焰.艾尔文",path:"zh1", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.mage,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6005],
5005:{uuid:5005,name:"幽灵射手",path:"a4", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.remote,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6002,6022,6022],
buff:[
],info:"说明"},
5006:{uuid:5006,name:"风暴.艾尔文",path:"zh2", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.mage,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6005],
buff:[
],info:"说明"},
5007:{uuid:5007,name:"战争.艾尔文",path:"zh3", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.mage,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6005],
buff:[
],info:"说明"},
//伙伴
5021:{uuid:5021,name:"幽灵射手",path:"a4", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.remote,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6002],
buff:[
],info:"说明"},
5022:{uuid:5022,name:"战争领主",path:"k5", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6001],
5006:{uuid:5006,name:"战争领主",path:"k5", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6001,6022,6022],
buff:[
],info:"说明"},
5023:{uuid:5023,name:"混沌法师",path:"zh1", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.mage,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6001],
5007:{uuid:5007,name:"混沌法师",path:"zh1", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.mage,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6001,6022,6022],
buff:[
],info:"说明"},
5024:{uuid:5024,name:"火焰法师",path:"zh2", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.mage,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6001],
5008:{uuid:5008,name:"火焰法师",path:"zh2", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.mage,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6001,6022,6022],
buff:[
],info:"说明"},
5025:{uuid:5025,name:"风暴精灵",path:"m4", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.mage,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6001],
5009:{uuid:5009,name:"风暴精灵",path:"m4", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.mage,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6001,6022,6022],
buff:[
],info:"说明"},
5026:{uuid:5026,name:"战争祭祀",path:"d2", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.mage,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6001],
5010:{uuid:5010,name:"战争祭祀",path:"d2", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.mage,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6001,6022,6022],
buff:[
],info:"说明"},
5027:{uuid:5027,name:"暴风射手",path:"a5", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.remote,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6002],
5011:{uuid:5011,name:"暴风射手",path:"a5", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.remote,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6002,6022,6022],
buff:[
],info:"说明"},
5028:{uuid:5028,name:"苍穹射手",path:"a3", quality:HQuality.BLUE,lv:1,kind:1,
type:HType.remote,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6002],
5012:{uuid:5012,name:"苍穹射手",path:"a3", quality:HQuality.BLUE,lv:1,kind:1,
type:HType.remote,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6002,6022,6022],
buff:[
],info:"说明"},
@@ -343,17 +323,7 @@ export const HeroInfo = {
type:HType.mage,hp:18,ap:15,dis:350,cd:2.5,speed:45,skills:[6007],
buff:[ ],info:"法师怪物-高伤害脆弱"},
5216:{uuid:5216,name:"元素1", path:"my1", quality:HQuality.GREEN,lv:2,kind:1,
type:HType.mage,hp:18,ap:15,dis:350,cd:2.5,speed:40,skills:[6007],
buff:[ ],info:"法师怪物-高伤害脆弱"},
5217:{uuid:5217,name:"元素2", path:"my2", quality:HQuality.GREEN,lv:2,kind:1,
type:HType.mage,hp:18,ap:15,dis:350,cd:2.5,speed:40,skills:[6007],
buff:[ ],info:"法师怪物-高伤害脆弱"},
5218:{uuid:5218,name:"元素3", path:"my3", quality:HQuality.GREEN,lv:2,kind:1,
type:HType.mage,hp:18,ap:15,dis:350,cd:2.5,speed:40,skills:[6007],
buff:[ ],info:"法师怪物-高伤害脆弱"},
5219:{uuid:5219,name:"牛头战士",path:"mn1", quality:HQuality.GREEN,lv:2,kind:1,
type:HType.warrior,hp:25,ap:8,dis:200,cd:2,speed:45,skills:[6007],
@@ -390,9 +360,7 @@ export const HeroInfo = {
5227:{uuid:5227,name:"精英兽人",path:"mor4", quality:HQuality.BLUE,lv:1,kind:1,
type:HType.warrior,hp:45,ap:12,dis:200,cd:2,speed:25,skills:[6007],
buff:[ ],info:"精英怪物-战士型"},
5231:{uuid:5231,name:"龙1",path:"bosswd", quality:HQuality.BLUE,lv:1,kind:1,
type:HType.warrior,hp:450,ap:12,dis:200,cd:2,speed:25,skills:[6007],
buff:[ ],info:"精英怪物-战士型"},
};
// ==================== 怪物系列分类配置 ====================
@@ -403,7 +371,6 @@ export enum MonsterSeriesType {
CYCLOPS = "CYCLOPS", // 独眼系列
MINOTAUR = "MINOTAUR", // 牛头系列
NATURE = "NATURE", // 自然系列
ELEMENTAL = "ELEMENTAL" // 元素系列
}
// 怪物系列配置
@@ -413,8 +380,8 @@ export const MonsterSeriesConfig = {
name: "兽人系列",
description: "来自荒野的兽人族群",
monsters: {
warrior: [5201, 5203, 5227,5231], // 兽人战士、兽人护卫、精英兽人
remote: [5202], // 兽人刺客
warrior: [5201, 5203], // 兽人战士、兽人护卫、精英兽人
remote: [5202, 5227], // 兽人刺客
mage: [] // 无法师
},
allMonsters: [5201, 5202, 5203, 5227]
@@ -425,8 +392,8 @@ export const MonsterSeriesConfig = {
name: "独眼系列",
description: "古老的独眼巨人族群",
monsters: {
warrior: [5222, 5223, 5225,5231], // 独眼巨人x2、精英独眼
remote: [5224], // 独眼巨人(远程)
warrior: [5222, 5223], // 独眼巨人x2、精英独眼
remote: [5224, 5225], // 独眼巨人(远程)
mage: [] // 无法师
},
allMonsters: [5222, 5223, 5224, 5225]
@@ -437,8 +404,8 @@ export const MonsterSeriesConfig = {
name: "牛头系列",
description: "迷宫中的牛头怪族群",
monsters: {
warrior: [5219, 5220, 5226,5231], // 牛头战士x2、精英牛头
remote: [5221], // 牛头战士(远程)
warrior: [5219, 5220], // 牛头战士x2、精英牛头
remote: [5221, 5226], // 牛头战士(远程)
mage: [] // 无法师
},
allMonsters: [5219, 5220, 5221, 5226]
@@ -451,22 +418,11 @@ export const MonsterSeriesConfig = {
monsters: {
warrior: [], // 无战士
remote: [], // 无远程
mage: [5204, 5205, 5206,5231] // 石卫、土卫、树卫
mage: [5204, 5205, 5206] // 石卫、土卫、树卫
},
allMonsters: [5204, 5205, 5206]
},
// 元素系列 (my开头)
[MonsterSeriesType.ELEMENTAL]: {
name: "元素系列",
description: "纯粹的元素力量化身",
monsters: {
warrior: [], // 无战士
remote: [], // 无远程
mage: [5216, 5217, 5218,5231] // 元素1、元素2、元素3
},
allMonsters: [5216, 5217, 5218]
}
};
// 获取指定系列的怪物列表
@@ -510,7 +466,7 @@ export const getAllMonsterSeries = (): MonsterSeriesType[] => {
export const MonstersByType = {
warrior: [5201, 5203, 5219, 5220, 5222, 5223, 5225, 5226, 5227], // 所有战士类型怪物
remote: [5202, 5221, 5224], // 所有远程类型怪物
mage: [5204, 5205, 5206, 5216, 5217, 5218] // 所有法师类型怪物
mage: [5204, 5205, 5206,] // 所有法师类型怪物
};
// 随机从指定系列获取怪物

View File

@@ -34,7 +34,6 @@ export class BuffComp extends Component {
HeroView:HeroViewComp=null!
hp_bar:any=null
protected onLoad(): void {
oops.message.on(GameEvent.UpdateVMData,this.to_update_vmdata,this)
}
start() {
this.info_init()
@@ -50,8 +49,8 @@ export class BuffComp extends Component {
this.vmdata_update()
}
to_update_vmdata(){
this.vmdata_update(false)
}
update(deltaTime: number) {

View File

@@ -7,7 +7,6 @@ import { HeroViewComp } from "./HeroViewComp";
import { BoxSet, FacSet } from "../common/config/BoxSet";
import { HeroInfo, HeroPos } from "../common/config/heroSet";
import { BattleMoveComp } from "../common/ecs/position/BattleMoveComp";
import { SkillConComp } from "./SkillConComp";
import { FriendModelComp } from "./FriendModel";
import { MasterModelComp } from "./MasterModel";
import { GameEvent } from "../common/config/GameEvent";

View File

@@ -6,32 +6,36 @@ import { GameEvent } from "../common/config/GameEvent";
import { EquipAttrTarget, EquipInfo } from "../common/config/Equips";
import { HeroViewComp } from "./HeroViewComp";
import { BuffAttr } from "../common/config/SkillSet";
import { EnhancementType } from "../common/config/LevelUp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('HeroConCompComp')
@ecs.register('HeroConComp', false)
export class HeroConCompComp extends CCComp {
@ccclass('HeroConComp')
@ecs.register('HeroCon')
export class HeroConComp extends CCComp {
/** 视图层逻辑代码分离演示 */
heroView:HeroViewComp=null
protected onLoad(): void {
oops.message.on(GameEvent.EquipAdd,this.equip_add,this)
oops.message.on(GameEvent.EquipChange,this.equip_change,this)
oops.message.on(GameEvent.FightReady,this.fight_ready,this)
oops.message.on(GameEvent.UseSpecialCard,this.use_special_card,this)
this.on(GameEvent.EquipAdd,this.equip_add,this)
this.on(GameEvent.EquipChange,this.equip_change,this)
this.on(GameEvent.FightReady,this.fight_ready,this)
this.on(GameEvent.UseSpecialCard,this.use_special_card,this)
this.on(GameEvent.UseEnhancement,this.use_enhancement,this)
this.heroView=this.node.getComponent(HeroViewComp)
console.log("[HeroConCompComp]:onLoad",this.heroView)
}
start() {
this.heroView=this.node.getComponent(HeroViewComp)
console.log("[HeroConCompComp]:start",this.heroView)
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
}
equip_add(e:GameEvent,data:any){
console.log("[HeroConCompComp]:equip_add",data)
console.log("[HeroConCompComp]:equip_add",data,this.heroView)
let equip=EquipInfo[data.uuid]
let buffs=equip.buff
let special_attr=equip.special_attr
console.log("[HeroConCompComp]:equip_add",buffs)
for(let i=0;i<buffs.length;i++){
let buff=buffs[i]
if(buff.target==EquipAttrTarget.HERO){
@@ -40,6 +44,7 @@ export class HeroConCompComp extends CCComp {
this.heroView.add_ap(buff.value,true)
break
case BuffAttr.ATK:
console.log("[HeroConCompComp]:equip_add ,buff.value",buff.value,this.heroView)
this.heroView.add_ap(buff.value,false)
break
case BuffAttr.ATK_CD:
@@ -58,6 +63,7 @@ export class HeroConCompComp extends CCComp {
}
}
}
equip_change(e:GameEvent,data:any){
console.log("[HeroConCompComp]:equip_change",data)
}
@@ -67,7 +73,23 @@ export class HeroConCompComp extends CCComp {
use_special_card(e:GameEvent,data:any){
console.log("[HeroConCompComp]:use_special_card",data)
}
use_enhancement(e:GameEvent,data:any){
// console.log("[HeroViewComp]:use_enhancement",data)
switch(data.type){
case EnhancementType.ATTACK:
this.heroView.add_ap(data.value)
break
case EnhancementType.ATTACK_SPEED:
this.heroView.add_speed(data.value)
break
case EnhancementType.HEALTH:
this.heroView.add_hp_max(data.value,true)
break
case EnhancementType.DEF:
this.heroView.add_def(data.value)
break
}
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {

View File

@@ -127,7 +127,6 @@ export class HeroViewComp extends CCComp {
//console.log("[HeroViewComp]:hero view comp ",this.FIGHTCON)
this.on(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,this.change_atk,this)
this.on(GameEvent.EXPUP,this.exp_up,this)
this.on(GameEvent.UseEnhancement,this.use_enhancement,this)
const collider = this.node.getComponent(BoxCollider2D);
this.scheduleOnce(()=>{
if (collider) collider.enabled = true; // 先禁用
@@ -223,7 +222,7 @@ export class HeroViewComp extends CCComp {
// this.BUFFCOMP.tooltip(TooltipTypes.speedup,speed.toFixed(0));
}
add_ap(ap: number,is_num:boolean=true){
console.log("[HeroViewComp]:add_ap add:",ap,this.ap)
// console.log("[HeroViewComp]:add_ap add:",ap,this.ap)
if(is_num){
this.ap_base += Math.floor(ap);
}else{
@@ -232,7 +231,7 @@ export class HeroViewComp extends CCComp {
let diff=Math.floor(this.ap_base*(100+this.buff_ap)/100)-this.ap
this.ap = Math.floor(this.ap_base*(100+this.buff_ap)/100)
this.BUFFCOMP.tooltip(TooltipTypes.apup,diff.toFixed(0));
// this.BUFFCOMP.tooltip(TooltipTypes.apup,diff.toFixed(0));
if(this.is_master) {
this.BUFFCOMP.vmdata_update();
@@ -250,13 +249,13 @@ export class HeroViewComp extends CCComp {
let diff=Math.floor(this.ap_base*(100+this.buff_ap)/100)-this.ap
this.ap = Math.floor(this.ap_base*(100+this.buff_ap)/100)
this.BUFFCOMP.tooltip(TooltipTypes.apup,diff.toFixed(0));
// this.BUFFCOMP.tooltip(TooltipTypes.apup,diff.toFixed(0));
if(this.is_master) this.BUFFCOMP.vmdata_update()
}
add_hp_max(hp: number=0,is_num:boolean=false){
console.log("[HeroViewComp]:add_hp_max add:",hp,this.hp_max)
// console.log("[HeroViewComp]:add_hp_max add:",hp,this.hp_max)
if(is_num){
this.hp_base += Math.floor(hp) ;
}else{
@@ -266,7 +265,7 @@ export class HeroViewComp extends CCComp {
this.hp_max =Math.floor(this.hp_base*(100+this.buff_hp)/100)
this.hp+=diff
if(this.is_master) this.BUFFCOMP.vmdata_update(true)
this.BUFFCOMP.tooltip(TooltipTypes.hpup,diff.toFixed(0));
// this.BUFFCOMP.tooltip(TooltipTypes.hpup,diff.toFixed(0));
}
de_hp_max(hp: number=0,is_num:boolean=true){ //最大值 只存在数值添加, 比例通过buff_hp处理
@@ -343,7 +342,7 @@ export class HeroViewComp extends CCComp {
//console.log("[HeroViewComp]:角色死亡",this.hero_uuid)
if(this.fac==FacSet.MON){
let exp=getExpDrops(HeroInfo[this.hero_uuid].quality,this.lv)
let exp=getExpDrops(HeroInfo[this.hero_uuid].quality,this.lv)*10
oops.message.dispatchEvent(GameEvent.EXPUP,{exp:exp})
}
@@ -625,44 +624,26 @@ export class HeroViewComp extends CCComp {
exp_up(e:any,data:any){
if(this.fac==FacSet.MON) return
//console.log("[HeroViewComp]:经验提高",data.exp)
// console.log("[HeroViewComp]:经验提高",data.exp)
smc.vmdata.hero.exp+=data.exp
// smc.vmdata.hero.next_exp=getUpExp(this.lv)
if(smc.vmdata.hero.exp >= smc.vmdata.hero.next_exp){
// console.log("[HeroViewComp]:升级")
this.to_update()
oops.message.dispatchEvent(GameEvent.CanUpdateLv)
}
}
use_enhancement(e:GameEvent,data:any){
//console.log("[HeroViewComp]:use_enhancement",data)
if(!this.is_master) return
switch(data.type){
case EnhancementType.ATTACK:
this.add_ap(data.value)
break
case EnhancementType.ATTACK_SPEED:
this.add_speed(data.value)
break
case EnhancementType.HEALTH:
this.add_hp_max(data.value,true)
break
case EnhancementType.DEF:
this.add_def(data.value)
break
}
this.to_update()
}
to_update(){
// console.log("[HeroViewComp]:to_update",this.is_master)
if(!this.is_master) return
smc.vmdata.hero.exp = smc.vmdata.hero.exp-smc.vmdata.hero.next_exp
smc.vmdata.hero.lv = smc.vmdata.hero.lv+1
smc.vmdata.hero.next_exp=getUpExp(smc.vmdata.hero.lv)
oops.message.dispatchEvent(GameEvent.HeroLvUp,{lv:smc.vmdata.hero.lv})
this.BUFFCOMP.lv_up()
this.BUFFCOMP.tooltip(TooltipTypes.lvup)
//@todo 需要添加 升级动画
// this.BUFFCOMP.tooltip(TooltipTypes.lvup)
}
/** 显示伤害数字 */

View File

@@ -30,13 +30,14 @@ export class SkillConComp extends CCComp {
init(): void {
oops.message.on(GameEvent.FightEnd, this.clear_timer, this);
this.on(GameEvent.FightEnd, this.clear_timer, this);
}
onLoad(){
this.HeroView=this.node.getComponent(HeroViewComp)
// //console.log(this.HeroView.uuid+"=>"+this.HeroView.hero_name+"=> SkillConComp onLoad")
// //console.log(this.HeroView.uid+"=>"+this.HeroView.hero_name+"=> SkillConComp onLoad")
this.on(GameEvent.CastHeroSkill,this.cast_master_skill,this)
oops.message.on(GameEvent.MaxSkill,this.use_max_skill,this)
this.on(GameEvent.MaxSkill,this.use_max_skill,this)
}
start() {
@@ -279,7 +280,8 @@ export class SkillConComp extends CCComp {
public clear_timer() {
// //console.log("clear_timer");
// console.log("[SkillConComp]:clear_timer",this.HeroView);
Object.values(this._timers).forEach(clearTimeout);
}
count_cd(cd:number,view:HeroViewComp){

View File

@@ -20,6 +20,7 @@ export class BarCompComp extends CCComp {
hero:HeroViewComp = null;
friend:HeroViewComp = null;
boss:HeroViewComp = null;
update_count:number=0
/** 视图层逻辑代码分离演示 */
protected onLoad(): void {
this.on(GameEvent.FightReady,this.readay,this)
@@ -38,6 +39,7 @@ export class BarCompComp extends CCComp {
this.node.getChildByName("bar").active = true
this.node.getChildByName("bar").getChildByName("more").active=false
this.node.getChildByName("bar").getChildByName("uplv").active=false
this.update_count=0
}
private master_called(e:any,data:any){
this.node.getChildByName("bar").active = true
@@ -62,9 +64,12 @@ export class BarCompComp extends CCComp {
}
}
show_uplv_button(){
this.update_count++
this.node.getChildByName("bar").getChildByName("uplv").active=true
}
hide_uplv_button(){
this.update_count--
if(this.update_count > 0) return
this.node.getChildByName("bar").getChildByName("uplv").active=false
}
show_master_more(){

View File

@@ -6,6 +6,7 @@ import { SkillSet } from "../common/config/SkillSet";
import { smc } from "../common/SingletonModuleComp";
import { oops } from "db://oops-framework/core/Oops";
import { MissionEvent } from "../common/config/MissionEvent";
import { HeroInfo } from "../common/config/heroSet";
const { ccclass, property } = _decorator;
@@ -24,6 +25,7 @@ export class EquipSkillComp extends CCComp {
onLoad() {
this.on(GameEvent.UseSkillCard, this.get_skill, this);
this.on(GameEvent.FightReady,this.fight_ready,this)
this.on(GameEvent.MasterCalled,this.master_called,this)
this.boxs=this.node.getChildByName("boxs")
this.skill1_cd_bar_progress=this.boxs.getChildByName("skill1").getChildByName("icon").getChildByName("cd").getComponent(ProgressBar)
this.skill2_cd_bar_progress=this.boxs.getChildByName("skill2").getChildByName("icon").getChildByName("cd").getComponent(ProgressBar)
@@ -32,6 +34,14 @@ export class EquipSkillComp extends CCComp {
start(){
this.fight_ready()
}
private master_called(e:any,data:any){
console.log("[EquipSkillComp]: master_called",data)
let hero=HeroInfo[data.uuid]
if(hero.skills.length>0){
this.get_skill(null,{slot:"skill1",uuid:hero.skills[1]})
this.get_skill(null,{slot:"skill2",uuid:hero.skills[2]})
}
}
skill_stone_up(e:GameEvent,data:any){
console.log("[EquipSkillComp]: skill_stone_up",data)
smc.vmdata.mission_data.skill_stone+=data

View File

@@ -14,10 +14,10 @@ export class EquipsComp extends Component {
armor:any=null
accessory:any=null
boxs:Node=null
attrs:any={
hero_buff:getBuffNum(),
enemy_buff:getBuffNum(),
}
// attrs:any={
// hero_buff:getBuffNum(),
// enemy_buff:getBuffNum(),
// }
/** 视图层逻辑代码分离演示 */
onLoad() {
oops.message.on(GameEvent.FightReady,this.fight_ready,this)
@@ -28,6 +28,7 @@ export class EquipsComp extends Component {
}
hero_lv_up(e:GameEvent,data:any){
console.log("[EquipsComp]:hero_lv_up",data)
switch(data.lv){
case FightSet.WEAPON_LV:
this.show_equip_get("weapon")
@@ -83,7 +84,6 @@ export class EquipsComp extends Component {
type:"accessory",
level:0,
}
this.count_attrs()
}
equip_add(e:GameEvent,data:any){
console.log("equip_add",data)
@@ -159,100 +159,100 @@ export class EquipsComp extends Component {
}
count_attrs(){
// 重置所有属性
this.reset_attrs();
console.log("[EquipsComp]:重置后的属性", this.attrs);
// count_attrs(){
// // 重置所有属性
// this.reset_attrs();
// console.log("[EquipsComp]:重置后的属性", this.attrs);
// 获取所有装备的属性
let weapon_buffs = this.weapon.uuid ? EquipInfo[this.weapon.uuid]?.buff || [] : [];
let armor_buffs = this.armor.uuid ? EquipInfo[this.armor.uuid]?.buff || [] : [];
let accessory_buffs = this.accessory.uuid ? EquipInfo[this.accessory.uuid]?.buff || [] : [];
let weapon_special_attr = this.weapon.uuid ? EquipInfo[this.weapon.uuid]?.special_attr : [];
let armor_special_attr = this.armor.uuid ? EquipInfo[this.armor.uuid]?.special_attr : [];
let accessory_special_attr = this.accessory.uuid ? EquipInfo[this.accessory.uuid]?.special_attr : [];
// // 获取所有装备的属性
// let weapon_buffs = this.weapon.uuid ? EquipInfo[this.weapon.uuid]?.buff || [] : [];
// let armor_buffs = this.armor.uuid ? EquipInfo[this.armor.uuid]?.buff || [] : [];
// let accessory_buffs = this.accessory.uuid ? EquipInfo[this.accessory.uuid]?.buff || [] : [];
// let weapon_special_attr = this.weapon.uuid ? EquipInfo[this.weapon.uuid]?.special_attr : [];
// let armor_special_attr = this.armor.uuid ? EquipInfo[this.armor.uuid]?.special_attr : [];
// let accessory_special_attr = this.accessory.uuid ? EquipInfo[this.accessory.uuid]?.special_attr : [];
console.log("[EquipsComp]:weapon_special_attr", weapon_special_attr);
console.log("[EquipsComp]:armor_special_attr", armor_special_attr);
console.log("[EquipsComp]:accessory_special_attr", accessory_special_attr);
console.log("[EquipsComp]:weapon_buffs", weapon_buffs);
console.log("[EquipsComp]:防具属性", armor_buffs);
console.log("[EquipsComp]:饰品属性", accessory_buffs);
const all_special_attr=[...weapon_special_attr,...armor_special_attr,...accessory_special_attr]
// console.log("[EquipsComp]:weapon_special_attr", weapon_special_attr);
// console.log("[EquipsComp]:armor_special_attr", armor_special_attr);
// console.log("[EquipsComp]:accessory_special_attr", accessory_special_attr);
// console.log("[EquipsComp]:weapon_buffs", weapon_buffs);
// console.log("[EquipsComp]:防具属性", armor_buffs);
// console.log("[EquipsComp]:饰品属性", accessory_buffs);
// const all_special_attr=[...weapon_special_attr,...armor_special_attr,...accessory_special_attr]
let equip_special_attr=this.count_equip_special_attr(all_special_attr)
oops.message.dispatchEvent(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,equip_special_attr)
// let equip_special_attr=this.count_equip_special_attr(all_special_attr)
// oops.message.dispatchEvent(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,equip_special_attr)
// 合并所有装备属性
const allBuff = [...weapon_buffs, ...armor_buffs, ...accessory_buffs];
console.log("[EquipsComp]:合并后的所有属性", allBuff);
// 计算每个目标的属性加成
allBuff.forEach(attr => {
const target = attr.target || EquipAttrTarget.HERO;
let targetKey = null;
// 根据目标类型获取对应的key
switch (target) {
case EquipAttrTarget.HERO:
targetKey = 'hero_buff';
break;
}
this.add_attr(targetKey,attr)
});
// // 合并所有装备属性
// const allBuff = [...weapon_buffs, ...armor_buffs, ...accessory_buffs];
// console.log("[EquipsComp]:合并后的所有属性", allBuff);
// // 计算每个目标的属性加成
// allBuff.forEach(attr => {
// const target = attr.target || EquipAttrTarget.HERO;
// let targetKey = null;
// // 根据目标类型获取对应的key
// switch (target) {
// case EquipAttrTarget.HERO:
// targetKey = 'hero_buff';
// break;
// }
// this.add_attr(targetKey,attr)
// });
console.log("[EquipsComp]:debuff buff attrs ", this.attrs);
oops.message.dispatchEvent(GameEvent.EquipChange, this.attrs);
}
// console.log("[EquipsComp]:debuff buff attrs ", this.attrs);
// oops.message.dispatchEvent(GameEvent.EquipChange, this.attrs);
// }
count_equip_special_attr(all_special_attr:any[]){
//特殊属性附加 - 直接使用枚举值作为属性名
let equip_special_attr = {
[EquipSpecialAttr.ICE]: 0,
[EquipSpecialAttr.FIRE]: 0,
[EquipSpecialAttr.WIND]: 0,
[EquipSpecialAttr.ATK_ADD_GLOD]: 0,
[EquipSpecialAttr.ATK_ADD_MASTER_ATK]: 0,
[EquipSpecialAttr.ATK_ADD_MASTER_HP]: 0,
[EquipSpecialAttr.DOUBLE_ATKED]: 0,
[EquipSpecialAttr.ATKED_ADD_SKILL_STONE]: 0,
[EquipSpecialAttr.ATK_ADD_VALUE]: 0,
};
// count_equip_special_attr(all_special_attr:any[]){
// //特殊属性附加 - 直接使用枚举值作为属性名
// let equip_special_attr = {
// [EquipSpecialAttr.ICE]: 0,
// [EquipSpecialAttr.FIRE]: 0,
// [EquipSpecialAttr.WIND]: 0,
// [EquipSpecialAttr.ATK_ADD_GLOD]: 0,
// [EquipSpecialAttr.ATK_ADD_MASTER_ATK]: 0,
// [EquipSpecialAttr.ATK_ADD_MASTER_HP]: 0,
// [EquipSpecialAttr.DOUBLE_ATKED]: 0,
// [EquipSpecialAttr.ATKED_ADD_SKILL_STONE]: 0,
// [EquipSpecialAttr.ATK_ADD_VALUE]: 0,
// };
console.log("[EquipsComp]:all_special_attr",all_special_attr)
// console.log("[EquipsComp]:all_special_attr",all_special_attr)
// 直接使用枚举值累加属性
all_special_attr.forEach(special_attr => {
if (special_attr && equip_special_attr.hasOwnProperty(special_attr.special_attr)) {
equip_special_attr[special_attr.special_attr] += special_attr.special_attr_value;
}
});
// // 直接使用枚举值累加属性
// all_special_attr.forEach(special_attr => {
// if (special_attr && equip_special_attr.hasOwnProperty(special_attr.special_attr)) {
// equip_special_attr[special_attr.special_attr] += special_attr.special_attr_value;
// }
// });
console.log("[EquipsComp]:equip_special_attr",equip_special_attr)
return equip_special_attr
}
// console.log("[EquipsComp]:equip_special_attr",equip_special_attr)
// return equip_special_attr
// }
add_attr(targetKey:string,attr:any){
if(targetKey){
this.attrs[targetKey][BuffAttr[attr.type]] += attr.value;
}
}
// add_attr(targetKey:string,attr:any){
// if(targetKey){
// this.attrs[targetKey][BuffAttr[attr.type]] += attr.value;
// }
// }
// 重置所有属性为0
private reset_attrs() {
// 创建新的属性对象
const newAttrs = {
hero_buff: getBuffNum(),
enemy_buff: getBuffNum(),
};
// const newAttrs = {
// hero_buff: getBuffNum(),
// enemy_buff: getBuffNum(),
// };
// 替换整个 attrs 对象
this.attrs = newAttrs;
// // 替换整个 attrs 对象
// this.attrs = newAttrs;
console.log("重置属性", {
hero_buff: this.attrs.hero_buff,
enemy_buff: this.attrs.enemy_buff,
});
// console.log("重置属性", {
// hero_buff: this.attrs.hero_buff,
// enemy_buff: this.attrs.enemy_buff,
// });
}
equip_remove(e:GameEvent,data:any){

View File

@@ -1,43 +0,0 @@
import { instantiate, Label, Prefab, resources, Sprite, SpriteAtlas } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { MSCardComp } from "./MSCardComp";
import { SkillSet } from "../common/config/SkillSet";
/** MSCard 模块 */
@ecs.register(`MSCard`)
export class MSCard extends ecs.Entity {
/** 实始添加的数据层组件 */
protected init() {
// this.addComponents<ecs.Comp>();
}
load(uuid:number=1001,parent:any,zone:number=0) {
var path = "game/gui/MSCard";
var icon_path = "game/heros/cards"
var prefab: Prefab = oops.res.get(path, Prefab)!;
console.log("load_hcard",prefab)
var node = instantiate(prefab);
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = node.getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[uuid].path);
});
node.getChildByName("name").getComponent(Label).string = SkillSet[uuid].name
node.parent = parent
var msc = node.getComponent(MSCardComp)!;
msc.s_uuid= uuid
msc.update_data()
if(zone==1) {msc.is_update=true }else{msc.is_update=false}
if(zone==2) {msc.is_select=true}else{msc.is_select=false}
this.add(msc)
}
/** 模块资源释放 */
destroy() {
// 注: 自定义释放逻辑,视图层实现 ecs.IComp 接口的 ecs 组件需要手动释放
super.destroy();
}
}

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "b808913f-7dc0-4dbf-9e74-12b5338a39ee",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,75 +0,0 @@
import { _decorator, Label } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { smc } from "../common/SingletonModuleComp";
import { MissionHomeComp } from "./MissionHomeComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { GameEvent } from "../common/config/GameEvent";
import { SkillSet } from "../common/config/SkillSet";
import { SChipComp } from "../hero/SChipComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('MSCardComp')
@ecs.register('MSCardComp', false)
export class MSCardComp extends CCComp {
mhc:MissionHomeComp
s_uuid: number = 0;
is_update: boolean = false;
is_select: boolean = false;
is_selected: boolean = false;
/** 视图层逻辑代码分离演示 */
start() {
oops.message.on(GameEvent.MSSelected, this.update_select, this);
this.mhc=this.node.parent.parent.parent.parent.getComponent(MissionHomeComp)
this.change()
}
change_set(){
this.is_update=!this.is_update
this.is_select=!this.is_select
this.change()
}
change(){
if(this.is_update){
this.node.getChildByName("update").active=true
}else{
this.node.getChildByName("update").active=false
}
if(this.is_select){
this.node.getChildByName("set").active=true
this.update_select()
}else{
this.node.getChildByName("set").active=false
}
}
update_data(){
}
select(){
smc.mission.mskill=this.s_uuid
oops.message.dispatchEvent(GameEvent.MSSelected,{uuid:this.s_uuid})
}
update_select(){
console.log("update_select",smc.mission.mskill,this.s_uuid)
if(smc.mission.mskill ==this.s_uuid){
this.node.getChildByName("set").getChildByName("btn").active=false
}else{
this.node.getChildByName("set").getChildByName("btn").active=true
}
}
update_lv(){
let mscards:any= ecs.query(ecs.allOf(MSCardComp));
for(let i=0;i<mscards.length;i++){
mscards[i].MSCardComp.update_data()
}
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "f7a30834-31c8-405a-9f9d-70555981d611",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -74,7 +74,7 @@ export class SkillCom extends CCComp {
}else{
this.anim=this.node.getComponent(Animation)
}
oops.message.on(GameEvent.MissionEnd, this.doDestroy, this);
this.on(GameEvent.MissionEnd, this.doDestroy, this);
this.node.active = true;
//console.log("[SkillCom]:caster",this.caster)