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

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

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) {