From d56b4293d7041e0c15bc14113fe20f9a7b722a23 Mon Sep 17 00:00:00 2001 From: panw Date: Thu, 31 Jul 2025 15:46:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=89=E8=A1=80=E7=8B=AC=E7=AB=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/script/game/hero/BuffComp.ts | 7 +++++++ assets/script/game/hero/HeroViewComp.ts | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/assets/script/game/hero/BuffComp.ts b/assets/script/game/hero/BuffComp.ts index 36522e1e..4b7b3d0f 100644 --- a/assets/script/game/hero/BuffComp.ts +++ b/assets/script/game/hero/BuffComp.ts @@ -225,6 +225,13 @@ export class BuffComp extends Component { pos.y=pos.y+y; tip.load(pos,type,value,s_uuid,this.node); } + hp_tip(type:number=1,value:string="",s_uuid:number=1001,y:number=90){ + let tip =ecs.getEntity(Tooltip); + let x=this.node.position.x; + let ny=this.node.getComponent(UITransform).height-20; + let pos = v3(x,ny,0); + tip.load(pos,type,value,s_uuid,this.node.parent); + } heathed(){ var path = "game/skills/heathed"; var prefab: Prefab = oops.res.get(path, Prefab)!; diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 0e1c86a2..6777c23c 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -842,10 +842,10 @@ export class HeroViewComp extends CCComp { // this.BUFFCOMP.in_atked() this.atked_count++; if (isCrit) { - this.BUFFCOMP.tooltip(TooltipTypes.crit, damage.toFixed(0), damage); + this.BUFFCOMP.hp_tip(TooltipTypes.crit, damage.toFixed(0), damage); // //console.log("暴击伤害:" + damage); } else { - this.BUFFCOMP.tooltip(TooltipTypes.life, damage.toFixed(0), damage); + this.BUFFCOMP.hp_tip(TooltipTypes.life, damage.toFixed(0), damage); // //console.log("普通伤害:" + damage); } }