From cac739c52be4f91757ef2ff98665e90457bb4f22 Mon Sep 17 00:00:00 2001 From: panfudan Date: Thu, 31 Jul 2025 22:56:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A9=E8=B5=8B=E6=9B=BF=E6=8D=A2=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/resources/gui/role_controller.prefab | 6 ++-- assets/script/game/common/config/GameEvent.ts | 2 ++ assets/script/game/hero/HeroConComp.ts | 6 +++- assets/script/game/hero/HeroViewComp.ts | 2 +- assets/script/game/map/TalsComp.ts | 29 +++++++++++++++++++ 5 files changed, 39 insertions(+), 6 deletions(-) diff --git a/assets/resources/gui/role_controller.prefab b/assets/resources/gui/role_controller.prefab index a0aeb54b..be4f6ddb 100644 --- a/assets/resources/gui/role_controller.prefab +++ b/assets/resources/gui/role_controller.prefab @@ -89820,8 +89820,8 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -0.635, - "y": 286.977, + "x": -935.629, + "y": 311.495, "z": 0 }, "_lrot": { @@ -90566,8 +90566,6 @@ "__id__": 0 }, "fileId": "76F7i9gP5GG63KTqOpSJQ6", - "instance": null, - "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { diff --git a/assets/script/game/common/config/GameEvent.ts b/assets/script/game/common/config/GameEvent.ts index 58a09ea4..35ae9e86 100644 --- a/assets/script/game/common/config/GameEvent.ts +++ b/assets/script/game/common/config/GameEvent.ts @@ -48,6 +48,8 @@ export enum GameEvent { FuncSelect = "FuncSelect", TalentSelect = "TalentSelect", UseTalentCard = "UseTalentCard", + RemoveTalent = "RemoveTalent", + ChangeTalent = "ChangeTalent", RefreshCard = "RefreshCard", NewWave = "NewWave", ChangeATK = "ChangeATK", diff --git a/assets/script/game/hero/HeroConComp.ts b/assets/script/game/hero/HeroConComp.ts index 4b7a6892..1dd749ba 100644 --- a/assets/script/game/hero/HeroConComp.ts +++ b/assets/script/game/hero/HeroConComp.ts @@ -25,6 +25,7 @@ export class HeroConComp extends CCComp { this.on(GameEvent.UseSpecialCard,this.use_special_card,this) this.on(GameEvent.UseEnhancement,this.use_enhancement,this) this.on(GameEvent.UseTalentCard,this.use_talent_card,this) + this.on(GameEvent.RemoveTalent,this.remove_talent_card,this) this.heroView=this.node.getComponent(HeroViewComp) console.log("[HeroConCompComp]:onLoad",this.heroView) @@ -155,12 +156,15 @@ export class HeroConComp extends CCComp { } } remove_talent_card(e:GameEvent,data:any){ - console.log("[HeroConCompComp]:remove_talent_card",data) + let tal=TalentList[data.uuid] + console.log("[HeroConCompComp]:remove_talent_card",data,tal) switch(tal.buffType){ case BuffAttr.ATK: + console.log("[HeroConCompComp]:atk",this.heroView.TALENT[BuffAttr.ATK],tal.value) this.heroView.TALENT[BuffAttr.ATK]-=tal.value this.heroView.count_atrr(BuffAttr.ATK) + console.log("[HeroConCompComp]ed:atk",this.heroView.TALENT[BuffAttr.ATK],tal.value) break case BuffAttr.ATK_CD: this.heroView.TALENT[BuffAttr.ATK_CD]-=tal.value diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 32dca185..8d9558f6 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -305,7 +305,7 @@ export class HeroViewComp extends CCComp { check_atrr(buff:BuffAttr){ switch(buff){ case BuffAttr.ATK: - return Math.floor(this.ap*(100+this.ap+this.TALENT[BuffAttr.ATK])/100) + return Math.floor(this.ap_base*(100+this.ap_buff+this.TALENT[BuffAttr.ATK])/100) case BuffAttr.ATK_CD: return this.cd_base/((this.cd_buff+this.TALENT[BuffAttr.ATK_CD])/100+1) case BuffAttr.HP: diff --git a/assets/script/game/map/TalsComp.ts b/assets/script/game/map/TalsComp.ts index f1f89bd3..3bb320a7 100644 --- a/assets/script/game/map/TalsComp.ts +++ b/assets/script/game/map/TalsComp.ts @@ -18,6 +18,7 @@ export class TalsComp extends Component { tal5:any=null tal6:any=null boxs:Node=null + cur_tal:string="" // attrs:any={ // hero_buff:getBuffNum(), // enemy_buff:getBuffNum(), @@ -52,31 +53,49 @@ export class TalsComp extends Component { console.log("[TalsComp]:tal_add",data) switch(data.slot){ case TalentSlot[0]: + if(this.tal1.uuid!=0) { + oops.message.dispatchEvent(GameEvent.RemoveTalent,{uuid:this.tal1.uuid}) + } this.tal1.uuid=data.uuid this.tal1.name=data.name this.show_tal(data.uuid,TalentSlot[0]) break case TalentSlot[1]: + if(this.tal2.uuid!=0) { + oops.message.dispatchEvent(GameEvent.RemoveTalent,{uuid:this.tal2.uuid}) + } this.tal2.uuid=data.uuid this.tal2.name=data.name this.show_tal(data.uuid,TalentSlot[1]) break case TalentSlot[2]: + if(this.tal3.uuid!=0) { + oops.message.dispatchEvent(GameEvent.RemoveTalent,{uuid:this.tal3.uuid}) + } this.tal3.uuid=data.uuid this.tal3.name=data.name this.show_tal(data.uuid,TalentSlot[2]) break case TalentSlot[3]: + if(this.tal4.uuid!=0) { + oops.message.dispatchEvent(GameEvent.RemoveTalent,{uuid:this.tal4.uuid}) + } this.tal4.uuid=data.uuid this.tal4.name=data.name this.show_tal(data.uuid,TalentSlot[3]) break case TalentSlot[4]: + if(this.tal5.uuid!=0) { + oops.message.dispatchEvent(GameEvent.RemoveTalent,{uuid:this.tal5.uuid}) + } this.tal5.uuid=data.uuid this.tal5.name=data.name this.show_tal(data.uuid,TalentSlot[4]) break case TalentSlot[5]: + if(this.tal6.uuid!=0) { + oops.message.dispatchEvent(GameEvent.RemoveTalent,{uuid:this.tal6.uuid}) + } this.tal6.uuid=data.uuid this.tal6.name=data.name this.show_tal(data.uuid,TalentSlot[5]) @@ -100,11 +119,15 @@ export class TalsComp extends Component { } to_change_tal(){ console.log("[TalsComp]:to_change_tal") + if(this.cur_tal=="") return + oops.message.dispatchEvent(GameEvent.TalentSelect,{slot:this.cur_tal}) + this.close_tal_info() } close_tal_info(){ console.log("[TalsComp]:close_tal_info") let node= this.node.getChildByName("info") tween(node).to(0.1,{position:v3(-1000,node.position.y,0)}).start() + this.cur_tal="" } show_tal_info(e:any,data:any){ console.log("[TalsComp]:show_tal_info",e,data) @@ -113,26 +136,32 @@ export class TalsComp extends Component { case TalentSlot[0]: if(this.tal1.uuid==0) return uuid=this.tal1.uuid + this.cur_tal=TalentSlot[0] break case TalentSlot[1]: if(this.tal2.uuid==0) return uuid=this.tal2.uuid + this.cur_tal=TalentSlot[1] break case TalentSlot[2]: if(this.tal3.uuid==0) return uuid=this.tal3.uuid + this.cur_tal=TalentSlot[2] break case TalentSlot[3]: if(this.tal4.uuid==0) return uuid=this.tal4.uuid + this.cur_tal=TalentSlot[3] break case TalentSlot[4]: if(this.tal5.uuid==0) return uuid=this.tal5.uuid + this.cur_tal=TalentSlot[4] break case TalentSlot[5]: if(this.tal6.uuid==0) return uuid=this.tal6.uuid + this.cur_tal=TalentSlot[5] break } let node= this.node.getChildByName("info")