灌水成绩
等级头衔
ID : 1
管理员
积分成就
威望 : 8
点
贡献 : 9 次
下载币 : 397 枚
在线时间 : 1837 小时
注册时间 : 2013-9-5
最后登录 : 2026-7-26
平常他是不显示的,默认的是只有血条,没有数字!
[1 \* r3 h& G5 e
& y% M, n* c& Z& a2 D R0 r
如果想让他这样显示按照下面方法做:
, M" |3 r4 G+ a U3 I- X( W - ~3 J' O* ~9 B0 l0 W2 m; [/ x
把下面的lua脚本复制到你服务端
. [* Q& H$ G6 R* B
" ?( n" q* @: Q) l
\龙途\Flying3D\scripts\模块\主界面\主逻辑.lua
5 u7 s2 O9 C/ ]5 l3 p5 s' t w; _
& A- B) i" x3 E1 ?7 U0 ]3 ~" V
里面全部覆盖,注意是全部覆盖!
: G1 g3 @8 n- b) ]
# V7 n+ N8 G, t# L" g$ _! d. E
然后重新打包pack
, `" A* Z( v( |
module(..., package.seeall)
' \- g5 C$ B: y local 实用工具 = require("公用.实用工具")* u4 C' V, w0 o* r! J
m_FlytextPool = {}1 b1 x% q; O8 M' r* _- H& }8 b: K
m_Flytexts = {}
# x+ R9 m& B7 z5 I function pushFlytext(flytext)
0 s' g" S0 b6 ?8 E7 j, I& V if flytext.minus then
0 [7 i+ i( }9 u4 j0 q J/ B$ f+ v" r flytext.minus:setVisible(false)2 v# r0 R$ X. a, D. S) B! n
end
1 |* V$ L1 M& A4 n, S4 D flytext:setAlpha(1)
5 \/ e+ p+ f. W6 U2 h/ U flytext:reset()+ m h' i3 E v, e6 G, O9 V
flytext:removeFromParent()0 d0 a" R- s* B8 ^
m_Flytexts[flytext] = nil
( J1 K. R: K1 F m_FlytextPool[#m_FlytextPool+1] = flytext
, F: m3 n7 |) {% y2 s& ?% @8 o- m end0 `$ y7 K# Z! u
function popFlytext()
( B8 J: M# z+ }" e if #m_FlytextPool > 0 then
( h: u/ x0 x# M; l& E5 e% c local flytext = m_FlytextPool[#m_FlytextPool]
! Z; k" ]& D, ~4 m( \1 u M table.remove(m_FlytextPool, #m_FlytextPool)
. A1 ~8 n* X7 O1 Y6 D return flytext% r7 X; R/ A! d; O' F9 U
end
4 I! G7 p5 M, i2 s end! q0 L4 q: B& f
function showFlytext(role, dechp, crit)2 J: \) T& [8 L, |4 o( T2 @
if 1 then0 P( n# p6 P+ o' z, Q; O/ Z9 x
return( N4 s5 K8 C/ J' a- _3 Q
end3 Z+ j* n$ a7 R) |! x
local flytext = popFlytext() or F3DImage3D:new()
6 X8 M. j- d! q! N" R* \% @# S' p if dechp == 0 then
P: M2 U# a: O$ W$ P# S9 ~% ?/ V flytext:setWidth(0)
2 L$ g* t# W) s0 R X4 { flytext:setTextureFile(UIPATH.."公用/fight/miss.png")
7 [' R1 \6 ?" S# U8 f flytext:setOffset(-52, -35)9 V4 B ?! z1 {, F E. c+ I
elseif dechp < 0 then
4 _' _+ h- {( }; h% ]3 i/ t dechp = -dechp+ L, B0 S! n6 F' c) Z0 L8 r
flytext:setTextureFile(UIPATH.."公用/fight/addHit.png")
, |6 m: @8 G2 j/ I4 q7 z% R6 J0 I( V flytext:setWidth(22)- Y! y! b n& H/ s- k* \$ k
if not flytext.clips then
9 d& U& {- \# [( y1 C# | flytext.clips = F3DPointVector:new()4 f2 ?+ F7 v W* L# a" f
end8 q) {, \/ F) g1 n
flytext.clips:clear()
% A5 a, @ P, v while dechp >= 1 do
9 J. _, T2 V V flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22)
5 m$ D+ |0 p9 ^* v2 i3 y* g3 z dechp = dechp / 10
2 B& D: b) n! M# r end
. A# j2 D. j% S9 Q flytext:setBatchClips(10, flytext.clips)4 p: S: s5 M7 K8 X
flytext:setOffset(-22+flytext.clips:size()*11, -50)* J0 Y- n* L9 Z8 d
if not flytext.minus then- O T k0 `$ }+ u
flytext.minus = F3DImage:new()
. V( ?9 D$ j" O, j- l flytext:addChild(flytext.minus). v# Y' A9 y; g+ u2 B
end. [, X2 W& @8 Y4 g/ ?( R( Y& B
flytext.minus:setTextureFile(UIPATH.."公用/fight/addFlag.png")4 q8 C4 [2 { F
flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-27)9 }( Q. d" q& m1 z) ~
flytext.minus:setPositionY(4)9 W2 D& J7 [4 e
flytext.minus:setVisible(true)4 x1 a/ k( u r% i+ n
elseif crit == 1 then: t2 v% j! d7 }2 f/ Q
flytext:setTextureFile(UIPATH.."公用/fight/criticalHit.png")9 R: g% ?, y/ T% j+ q' l
flytext:setWidth(28)
8 H! R4 v) ?4 @/ \ if not flytext.clips then
3 x1 D6 v4 o" i5 f. }$ |$ U$ H flytext.clips = F3DPointVector:new()
1 y* @( s* O6 C, ^4 g0 M end/ z7 @: i8 N7 G# ]% `$ B' g
flytext.clips:clear()( i. ~1 u) M- v
while dechp >= 1 do2 J( Q. W+ f5 |6 F7 U0 f
flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*28)' m c7 U! k( l
dechp = dechp / 108 p/ C. f. t( L% r6 L% f6 S
end
2 F# I- U' p9 K7 R8 ~% h flytext:setBatchClips(10, flytext.clips)
% ^: C5 i6 b6 Q; j/ b7 y flytext:setOffset(-28+flytext.clips:size()*14, -50)5 R0 f& e( `1 G' M) {
if not flytext.minus then
* Z0 x* u9 [" P4 _( q) |9 e5 ?; ` flytext.minus = F3DImage:new()6 i+ C( O5 a i
flytext:addChild(flytext.minus)
S0 y1 T" O1 F i+ R$ }! _ end1 A& Q9 N4 y( ~+ t
flytext.minus:setTextureFile(UIPATH.."公用/fight/criticalFlag.png")
7 s0 ]9 w9 b0 C6 E$ h flytext.minus:setPositionX(-(flytext.clips:size()-1)*28-55)- I, k1 Q1 Z6 X. O8 r. H% Y
flytext.minus:setPositionY(-5)8 Y* ] k, F; G1 N
flytext.minus:setVisible(true)4 @$ o1 W" q) N2 t" u: Y
else% j, @, B y# S Q7 j0 S
flytext:setTextureFile(UIPATH.."公用/fight/otherHit.png")3 t/ d4 n r/ F6 o) S, V9 F
flytext:setWidth(22)
$ O+ }) k* w( ]2 ^ if not flytext.clips then% x7 K0 x' S A1 K
flytext.clips = F3DPointVector:new()8 d( g% p- L/ y* L ^7 I
end! Q, l4 [0 s* `8 a; x' e
flytext.clips:clear()2 L* q, w* B* c0 t/ _
while dechp >= 1 do
1 H- G A. v( E% d8 C6 H! s flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22)1 N) }2 b+ B& b
dechp = dechp / 10" \7 P' I2 f9 o
end
% ]1 ?! n" s+ H2 ^0 s1 | flytext:setBatchClips(10, flytext.clips)" y0 u0 ?8 j/ A, r$ X, k: r
flytext:setOffset(-22+flytext.clips:size()*11, -50)$ V- s6 Z/ O% v; _& k8 v
if not flytext.minus then
0 j. M0 b X8 ]$ J# G+ n+ D flytext.minus = F3DImage:new()5 W# j5 \4 n% V
flytext:addChild(flytext.minus)+ L4 m0 v. Z. t& T
end
H: J1 a. j$ _; p5 @0 h flytext.minus:setTextureFile(UIPATH.."公用/fight/otherFlag.png")
F* P- d" n, ^! y, _9 z' ?" }' { flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-17)
$ y* ~$ B, ]" Y2 P flytext.minus:setPositionY(12)
$ f$ m8 {, Q8 I) n; \6 _ flytext.minus:setVisible(true)5 ?# C5 g4 S! y6 n7 C6 z
end! t+ M+ m3 m4 E ?( V
flytext:setPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 10)9 \& b f2 g( q- o) R* m" h+ i$ Q, `
dechpcont:addChild(flytext)& L4 U5 w3 n9 a6 g2 z3 W- k( c! ?
m_Flytexts[flytext] = 1
8 N$ F" _: f- b% e- B% C4 J, I local prop = F3DTweenProp:new()
. J+ |' t3 X- U prop:push("offsetY", -100, F3DTween.TYPE_SPEEDDOWN)% x0 d/ x. E* i% d0 [
prop:push("alpha", 0, F3DTween.TYPE_LINEAR)9 r) r$ _! u5 D* z/ a
F3DTween:fromPool():start(flytext, prop, 1, func_n(function()* `4 C9 T( H8 x7 Z
pushFlytext(flytext)--flytext:removeFromParent(true)
+ \: h+ L2 Y6 }& b2 {1 u; T ]0 }$ a end))
3 d3 p/ |4 n4 N# G" ] end1 p( v( a) W( }% B" R+ R
hpbarpool = {}9 N! M; s; w4 A/ s8 w, e7 ^; B
function removeMergeHP(hpbar)
2 h6 q; B) \% T2 O# J9 f \ if hpbar.mergehp then7 u0 j& Q; D; e7 i" v T4 Y
for i,v in ipairs(hpbar.mergehp) do
$ w- @+ e) o3 z v:removeFromParent(true)2 J$ O0 F: y5 p4 W0 v0 B
end
) |; x" b$ k) ~' x8 c hpbar.mergehp = nil9 r2 P# X) u. w+ n' b: j9 L
end. z6 \6 J y* x5 M v
end
+ r9 [; V! |( r0 c9 {8 } function createMergeHP(hpbar, hp, hpmax, mergehp)) g6 L/ u; B: ?, ^$ g# Y- ~1 r8 Z6 h
hpmax = hp. P& {# @. @# x
for i,v in ipairs(mergehp) do
' ^3 n; B$ F/ B5 W. d2 E hpmax = hpmax + (i == #mergehp and v.hpmax or v.hp)/ `( ~$ }7 F6 C
end# ~( B, q" {' G8 A( L1 ?
local perc = hp / hpmax! h) V( A$ s8 W' k( t" V: l
hpbar.hpimg:setWidth(hpbar.track:getWidth()*perc)
" [9 ^1 `) L4 E# Y$ [+ N hpbar.mergehp = {}
4 N& V' X) Y* ]1 k W for i,v in ipairs(mergehp) do
7 V1 [% u9 G7 K6 l2 ~. p. W8 M1 c local hpimg = F3DImage:new()
5 ?8 N5 K& }4 c local pc = (i == #mergehp and v.hpmax or v.hp) / hpmax. a- D* q5 @' d, z- G
hpimg:setTextureFile("tex_white")% l# e6 \9 F1 f5 ]: d; {
hpimg:setWidth(hpbar.track:getWidth()*pc-1)
" W; M3 w/ N: B. u: R9 M hpimg:setHeight(hpbar.track:getHeight())3 L+ v) E r ~% z
hpimg:setPositionX(hpbar.track:getWidth()*perc+1)
# K3 I- z7 R0 f5 d3 v$ A hpimg:getColor():setRGB(v.color)
( x- V' g* h+ T; m$ g. V0 E$ |, Z8 J hpbar.track:addChild(hpimg)$ u9 `5 p% I K6 i! d7 h
hpbar.mergehp[#hpbar.mergehp+1] = hpimg
4 s& V* g) E$ W5 [0 J0 N: J' Y perc = perc + pc
% X/ z. h6 j% Z8 J3 F hp = hp + v.hp
( N7 I3 l! z0 h5 R' o4 j. I. o end
& A3 N/ A+ U0 F% O" k return hp, hpmax
% q% S' {; Z+ S8 ]3 ] W% O0 r end6 q) F& ^" R1 \$ b
function onHpBarInit(e)
. _) z- Q6 q0 y local hpbar = e:getTarget()+ Y+ h; K5 j0 Q* e+ v
hpbar.name = hpbar:findComponent("name")
) Q3 A0 m# f% g* | local ss = 实用工具.SplitString(hpbar.v.name,"\")% f2 [; D0 A! R# o7 S9 H% ]0 N* S- C1 c
hpbar.name:setTitleText(txt(ss[1])); s: t# b4 j8 x* K2 U% l
if #ss > 1 then
8 ^" }8 H2 R5 M/ @1 G& U. Q. @. ? hpbar.nameexs = hpbar.nameexs or {}
+ X. Z9 m) f0 c# B# l# Z/ H' g0 ?) L5 e for i=2,#ss do0 \3 s% R8 [* X r8 o s+ o
local tf = hpbar.nameexs[i-1] or F3DTextField:new()
* p) x+ l, `) m if g_mobileMode then' m3 r2 K9 a3 r$ J8 ?6 N& w) Z& m
tf:setTextFont("宋体",16,false,false,false)
7 e- m: Y( C7 l; }+ t! I1 @ end
1 U( v4 x' J- z- q$ B E A7 j; N tf:setText(txt(ss[i]))0 j+ k1 c- O8 s8 t/ X8 {2 I
tf:setTextColor(hpbar.namecolor or 0xffffff,0)
: y1 j1 y' N: M0 S4 w tf:setPivot(0.5,0.5)$ B* z1 m0 j' \, r
tf:setPositionX(0) {' y: w* @6 I5 }
tf:setPositionY(50+(i-1)*14)5 i3 t5 _/ S- U) P
hpbar:addChild(tf)$ s) m) u+ r% D
hpbar.nameexs[i-1] = tf# O! O1 W# C! [1 T; r) e8 n! x% o* p4 \
end9 B9 T! n2 o: g+ c4 {
end
( G4 f' L5 b# s hpbar.name:setVisible(hpbar.showname)
. i6 B) ]8 n5 Q4 U, @ hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)
; p5 j4 k; X% t% `5 i hpbar.guildname = hpbar:findComponent("guildname")
6 A) }/ \3 w# }4 c S, K hpbar.guildname:setTitleText(txt(hpbar.v.guildname or ""))
2 h8 a- `$ h8 [ hpbar.guildname:setVisible(hpbar.showname)8 x# \9 b, Z( U B5 C' T
hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)3 s, p( `3 G5 _3 ~; e0 v% z
hpbar.pro = tt(hpbar:findComponent("hpbar"),F3DProgress) E; S8 p t8 ? l# H' ^
hpbar.track = hpbar.pro:getTrack()
6 @! a, v+ n; Y3 v( H hpbar.hpimg = F3DImage:new()
" o# |. v ?' k- U4 L3 y9 u hpbar.hpimg:setTextureFile("tex_white"); Z! W1 h4 ]. u
hpbar.hpimg:setWidth(hpbar.track:getWidth())
# A! s& G0 h9 N+ I3 }8 f! _/ y hpbar.hpimg:setHeight(hpbar.track:getHeight())5 ]% a7 P2 i( w0 l% }% V1 O
hpbar.hpimg:getColor():setRGB(hpbar.v.color)
6 o8 y# ^0 ^2 `. H( H/ D% x hpbar.track:addChild(hpbar.hpimg)7 b, j4 G6 t- l6 V0 m* K2 x' ]/ p
local count = F3DTextField:new() --创建一个文字
: X% g8 V1 W$ |, ~1 Z count:setPivot(0.5,0.5) --血条文字改为居中& g% o3 F! s/ k* g8 P) N
count:setPositionX(20)--变更一下血条x位置
7 H) A1 U0 @3 ~6 W6 J$ s3 k% W7 o8 i count:setPositionY(-10)--变更一下血条y位置
6 d+ S5 m8 z: P* P1 E hpbar.pro:addChild(count)--跟名字绑定
( F8 Y! a) q5 K3 F4 ?3 { hpbar.count = count --方便下面随时修改血量
8 ^! \4 J$ z" ^; B' n hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp.."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改+ e d8 n4 t# m7 Q
--hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp .."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改 ~$ F1 ]" I+ |! ^" |# [9 k
if not hpbar.v.mergehp then
6 \9 C0 l; s& A hpbar.mergehp = nil
" _2 j( T( o a9 I# J% @ hpbar.pro:setMaxVal(hpbar.v.hpmax)
. U# c- ~- q& U; y$ n9 r4 S+ j$ @ hpbar.pro:setCurrVal(hpbar.v.hp)
8 s0 ?- A1 K1 S9 S4 B" t) V$ B hpbar.pro:setVisible(hpbar.v.hp > 0)
3 E; T! V) D: }) [ else
5 d" c/ {( c* ?6 v" \3 J3 z local hp, hpmax = createMergeHP(hpbar, hpbar.v.hp, hpbar.v.hpmax, hpbar.v.mergehp)
# u$ z' N/ s: H" {+ J: w y hpbar.pro:setMaxVal(hpmax), `8 j/ j/ W* V: A& ^1 G! c0 q
hpbar.pro:setCurrVal(hp)
4 E# A1 L+ k* I' `, v4 ` z! B hpbar.pro:setVisible(hp > 0)1 R' g1 N; L8 Y/ Z9 O9 j
end9 z' R5 p7 O( [* p+ ]& \3 ^8 c
end& c5 w' |+ d1 _1 _* A9 e+ ?4 U
function setHPBar(role, hp, hpmax, color, name, mergehp, showname, guildname, namecolor)3 B0 p* Y4 W7 R- Z9 u1 z5 P
local newcreate9 n- N# L6 x/ i" F) d8 [
local hpbar
1 V/ w7 f0 m+ ]$ Y showname = showname or 显示名字 == 1
" V/ G: Z$ W6 ^) q, p" o if role.hpbar then
$ s7 `& H' |0 W7 c- D* b hpbar = role.hpbar
2 c& r( O1 A" G8 Y# o hpbar.showname = showname
% U0 v- [- y2 I) O. v. |4 v& s# {. k hpbar.namecolor = namecolor
9 @4 O5 a, ]0 ?2 K& a Q else
% W8 O$ u1 f; F- M, C if #hpbarpool == 0 then
! [% n! Y: B& _. Z hpbar = F3DLayout:new()
8 |9 Z8 w. M1 ~- m# |5 J0 I2 d hpbar.showname = showname4 Q3 @1 ^4 X4 u7 p2 A" ~
hpbar.namecolor = namecolor; p% @0 d' m* v# j
hpbar:setLoadPriority(g_uiFastPriority)
- x( v+ Q$ S# [0 Y9 d' W, j hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}# N% O9 s& S1 \: N
hpbar:addEventListener(F3DObjEvent.OBJ_INITED, func_oe(onHpBarInit))
& P2 Y! M) H% d' U0 k hpbar:setLayout(g_mobileMode and UIPATH.."血条UIm.layout" or UIPATH.."血条UI.layout")--IS3G and UIPATH.."血条UIn.layout" or
% @! q* o3 c% V6 Y; ]' X; H- J( e newcreate = true2 V4 T7 C" u% {# y ^
else
; g4 \0 J) y) h; ~; K hpbar = hpbarpool[#hpbarpool]
3 G# U; I$ H! M) p4 h% a; j hpbar.showname = showname
* r8 @3 `% C; B. T hpbar.namecolor = namecolor
4 r6 }! p( u) l, ]' L table.remove(hpbarpool)( P% V. ~$ x5 m8 |1 b
end2 Y7 Y2 U: x( U8 w. l# _5 I
role.hpbar = hpbar+ T' ~" H: z/ o. J
hpbar:setZOrder(-role:getPositionY())2 x4 Z, N# k/ y1 b
hpcont:addChild(hpbar); l. S, g# m- y- T
end% ?% r+ A" w, h. P
if newcreate then
5 G; f7 N+ ~7 z& A, P% F4 L elseif hpbar:isInited() then( U# N4 B8 b5 Q+ `# O% \/ [' T
local ss = 实用工具.SplitString(name,"\")
: ?! n/ N8 v2 y hpbar.name:setTitleText(txt(ss[1]))
* L: v; }4 N) {- J% ` if #ss > 1 then
5 k& Z" x7 d# ^5 K9 I hpbar.nameexs = hpbar.nameexs or {}
- ^1 {: Z2 K C! z7 F2 E' C for i=2,#ss do+ q1 C1 f0 J4 A& `! ]
local tf = hpbar.nameexs[i-1] or F3DTextField:new()
2 x* f7 p3 N! m2 c/ |# F if g_mobileMode then
k& ^ {1 X7 }' x* G2 C, L tf:setTextFont("宋体",16,false,false,false)
$ n; P T0 m& D. K end
1 {! c% c/ Z, Y2 ?; R tf:setText(txt(ss[i]))9 G( N9 X& m5 R; {% n
tf:setTextColor(hpbar.namecolor or 0xffffff,0)
+ S, J, A5 ]# \; s tf:setPivot(0.5,0.5)% J2 ~$ e7 {* h. e* k k7 X$ |# b
tf:setPositionX(0)
$ D1 R0 I' ^$ G+ g7 D1 t tf:setPositionY(50+(i-1)*14)
& S: P% s' ?! C9 b0 F3 e0 } hpbar:addChild(tf)- N" y( D8 {! R% N, C
hpbar.nameexs[i-1] = tf
- K, c- g( a* F5 ?1 p( _ h' ] end
+ f5 ]' ?) S* O' R) ? end
& o! o b$ A. q" ] hpbar.guildname:setTitleText(txt(guildname or "")): M1 {, Z" H0 g! K* m2 I* ]# H# n
hpbar.name:setVisible(hpbar.showname or role == g_hoverObj)# @* q2 j; D# w* b5 Y& ?4 g
hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)9 n4 ~! d: `5 M; S1 `( s! n8 X
hpbar.guildname:setVisible(hpbar.showname or role == g_hoverObj)
& \+ k0 j$ f- H# S$ {: _' L hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)6 Q% r0 S3 h( A1 }* r* J- o% F8 s% O
if not mergehp then! i& p& |9 `- |9 ~2 V4 I( z
removeMergeHP(hpbar)
+ P* H4 i, W' Q) ~* i4 Y" a2 p: p3 R hpbar.hpimg:setWidth(hpbar.track:getWidth())& q/ v( d5 g$ O2 h
hpbar.hpimg:getColor():setRGB(color)1 y3 V! R. B0 c, s8 [* g$ q8 W
hpbar.pro:setMaxVal(hpmax): l1 U& t/ a' r$ @ \( g
hpbar.pro:setCurrVal(hp)
: o! Q7 g& A+ v. C/ v3 G7 W hpbar.pro:setVisible(hp > 0)
$ C0 a, G' q3 a0 y. a0 [ else
2 ?' F" Z0 W; I) H) L: j removeMergeHP(hpbar)
' Q4 P& q5 m4 r2 q; x- M- K. V hpbar.hpimg:setWidth(hpbar.track:getWidth())
D7 B7 x$ ^, q1 z5 \' ^ hpbar.hpimg:getColor():setRGB(color)! v. d7 S% g% |3 T4 W8 x
hp, hpmax = createMergeHP(hpbar, hp, hpmax, mergehp)
1 d- U$ r# Z. `, s' J! I hpbar.pro:setMaxVal(hpmax)
' p: l8 K/ _, S7 M hpbar.pro:setCurrVal(hp)& M# E+ |2 x# s
hpbar.pro:setVisible(hp > 0)/ r2 R7 Q0 O& e& m- Q
end
) F6 d* Q3 e4 S hpbar.count:setText(txt(hp == hpmax and "" or hp.."/"..hpmax))! Q+ |, D5 e. Y
else
- g$ q6 Z* o& a5 S hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}5 x* N9 I+ P% `$ X
end( u8 l A$ v& q Q
if not role:isVisible() or (hp == hpmax and not mergehp) then! q1 @ f. e* w8 k( ^- M$ I6 ~
hpbar:setVisible(true)--false)
/ V/ a* N8 N1 A# X4 D else
& J6 b. P) M# L' o% p2 v hpbar:setVisible(true)
7 \/ Y2 W/ W9 P! b- Y end
% M) x$ }8 l4 ^( ~$ R0 k0 U; } end
$ |6 k/ P/ H& \0 \2 \ function delHPBar(role). J( q" k8 W z2 ?2 {* B: f) u
local hpbar = role.hpbar0 @4 z8 ? @. }/ f/ {* Z$ |
if hpbar then2 e6 F! K% b( \
hpbar.showname = nil
/ w6 k2 p0 o, k! s) y hpbar.namecolor = nil. C0 X5 f h4 |: E4 T
if hpbar.titles then
. O3 A0 W: U. `$ ^ m6 [# ] for i,v in ipairs(hpbar.titles) do
5 C; {, h4 x9 O& O4 b, k9 i% E: y v:removeFromParent(true)2 X; J3 {& [4 p; `* S" F
end* q3 ~- R, E6 {5 u+ T8 z2 m
实用工具.DeleteTable(hpbar.titles)
( v5 X6 H$ C$ @5 G% H0 L, J5 p& C end
4 p# ]) ?0 {% ^, m$ | if hpbar.nameexs then
9 Q( @8 c) _0 {7 I8 u5 u! _ for i,v in ipairs(hpbar.nameexs) do. u: D0 q, T' D
v:removeFromParent(true)
; }: n, z$ F: [# C! s" c2 z9 ?2 ?/ E end
: x4 c3 ^5 }: e/ b9 W 实用工具.DeleteTable(hpbar.nameexs)1 y9 g% w1 D, y/ P
end9 {5 \+ K* q# O6 e- x
hpbar:removeFromParent()$ T+ F. w2 t8 V5 z5 Z0 g
hpbarpool[#hpbarpool] = hpbar9 y* q, |+ g8 g/ d% M
role.hpbar = nil$ t2 U7 z2 \) r
end
4 G+ d7 F. [# o3 h) u2 E$ S0 W end# n2 ^; A' j3 n) @
function updateHPBar(role). o; O( ^: k- ~4 i3 x/ O* Z
local hpbar = role.hpbar& d0 X8 o% k) W" f0 b& s" q2 a& R
if hpbar then
0 b2 v# ?5 `" c6 R W hpbar:setVisible(role:isVisible())
- O8 P: D* g% c0 ^ end
1 J3 {) M7 Y, O: d9 q; j% ] if hpbar and hpbar:isVisible() then
2 O3 c- x( g$ B hpbar:setZOrder(-role:getPositionY())
1 d" S8 h! a& s local pt = F3DUtils:getScreenPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 20)
- b! _# ^8 d# X, O7 O* J h if pt then
/ u+ `& ]6 @5 \! ?. E3 ~ hpbar:setPositionX(pt.x)+ ?* [7 z/ A5 G, G/ X" a
hpbar:setPositionY(pt.y)
# p4 x4 |8 Z2 [" X* A4 z, P( H end% i0 w; Y( w) }- j9 N. X4 c: d
end
3 P& e; x4 v3 Z) \" X( c" d end 复制代码
' T6 ^1 I" @) S3 J& u
8 a+ Z6 ]$ x* |: \