灌水成绩
等级头衔
ID : 1
管理员
积分成就
威望 : 8
点
贡献 : 9 次
下载币 : 434 枚
在线时间 : 1943 小时
注册时间 : 2013-9-5
最后登录 : 2026-9-9
平常他是不显示的,默认的是只有血条,没有数字!
8 v4 I" E* z7 V" Z5 l4 a
- {9 Z. k* ^( ^! N4 W 如果想让他这样显示按照下面方法做:
$ ^3 L* w: F. l+ z, J
$ {* W. h. C1 N& L4 i8 T. ^$ t% n
把下面的lua脚本复制到你服务端
3 ?$ ^' n" k! ]
) ]8 C: K1 v: e, U: C \龙途\Flying3D\scripts\模块\主界面\主逻辑.lua
4 c* x% A; {2 ^7 p& k" ] # ?' h9 O+ Q4 X7 X4 Q
里面全部覆盖,注意是全部覆盖!
7 U) z7 x6 V0 H' G1 U
7 u' R: l: A- |. \3 J
然后重新打包pack
1 y3 g) L+ `1 {, {+ Z% K
module(..., package.seeall)) v' |+ r( y% I) [' T, s
local 实用工具 = require("公用.实用工具")0 y2 E( Z9 B9 e9 W( g" }9 F
m_FlytextPool = {}( m/ w$ T$ Y$ `# t$ ^# V# h6 e
m_Flytexts = {}' o- J. }3 X+ X. k( O5 Z
function pushFlytext(flytext) ]$ ]7 {! Y3 w
if flytext.minus then
4 ~% l" o; z8 k& J& d! ~ flytext.minus:setVisible(false)9 j+ t# t' o6 Z0 P7 M* r; E' ]
end
& f: p8 T) }* t5 I O4 J flytext:setAlpha(1) O1 [# h* d! f* F( @; \/ j
flytext:reset()# R5 Q/ j) R2 t2 G
flytext:removeFromParent()
) x! x6 t/ C. w& u m_Flytexts[flytext] = nil- c( [% I9 p; }- n# `, N
m_FlytextPool[#m_FlytextPool+1] = flytext
) e6 |! J4 k: e end# ^: @2 X# _1 H. ^0 e9 _: k( _
function popFlytext()6 l7 D& k6 `' h6 y4 Q" l
if #m_FlytextPool > 0 then
9 k5 j: g, k1 | local flytext = m_FlytextPool[#m_FlytextPool]1 k2 R7 M* m0 {# @ C. ?# m
table.remove(m_FlytextPool, #m_FlytextPool)
# r2 L7 q+ r# v' L, ` return flytext
* r5 W' E4 z% F* O9 l0 r* q# J end/ p! ?$ ~4 S9 Z2 ^6 ~! g L* y. `( `
end* v6 U$ ~5 s. I+ a3 N8 m- {
function showFlytext(role, dechp, crit)0 d# R9 G! g" x5 X
if 1 then; \1 J- W& f1 r" d$ e) p7 p
return% r8 W0 X* B$ j: q0 G% J6 m
end
8 x! `$ m* t! y& c0 a% Z: ` local flytext = popFlytext() or F3DImage3D:new()
3 Q4 Y( @5 k0 V. C3 u3 L if dechp == 0 then
3 G \3 f# y* e6 I flytext:setWidth(0) x! B8 q" f! U- }
flytext:setTextureFile(UIPATH.."公用/fight/miss.png"): D1 c# r4 j' w: ]/ d9 v
flytext:setOffset(-52, -35)% h3 A# X" A4 i: U1 i2 f
elseif dechp < 0 then
- L$ o4 O2 w, t4 U7 x/ g" t dechp = -dechp) ?9 Y: V9 [7 K! u
flytext:setTextureFile(UIPATH.."公用/fight/addHit.png")+ v9 q; E m. c5 Z) E
flytext:setWidth(22)
0 K5 z$ [; p& Q3 p8 U) B0 M if not flytext.clips then/ F$ l. o" H( m) l5 T1 V, T! B
flytext.clips = F3DPointVector:new()' h8 r. A( ]9 J! A$ y: s, T
end
4 R7 i3 k" K' i7 a' ~ flytext.clips:clear()
% d) @0 @% q& m. ] while dechp >= 1 do' h2 v3 l# {, Q+ e
flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22)
! [: T! a- g/ U; _ dechp = dechp / 10/ g/ y: W3 h1 J$ d$ I z: E# V
end& B1 N) X b$ ]( |7 W2 f5 d9 B
flytext:setBatchClips(10, flytext.clips)* L: H' {& W( I& ?6 h
flytext:setOffset(-22+flytext.clips:size()*11, -50)
% N d& u8 e" R0 {' x# h if not flytext.minus then0 f f! A H# h
flytext.minus = F3DImage:new()
* s/ ^+ b1 K' l1 y: | flytext:addChild(flytext.minus)
7 n- E5 {- q/ H9 q V end9 }8 y8 }4 D/ A4 |# b" k0 C
flytext.minus:setTextureFile(UIPATH.."公用/fight/addFlag.png")
- P* [, v2 I# H flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-27)
, L6 r1 P' p R2 P flytext.minus:setPositionY(4)9 g" d% k0 p( u3 l, [; s/ e4 P* z
flytext.minus:setVisible(true)
) G/ s ?5 V4 e' i1 u9 i elseif crit == 1 then* l' K% |- b: X4 V3 A0 G' H+ A
flytext:setTextureFile(UIPATH.."公用/fight/criticalHit.png")6 f6 C4 |& b5 {
flytext:setWidth(28)
8 G& v0 j7 c/ u2 d) M if not flytext.clips then
Q. n% ~, L1 [: ] flytext.clips = F3DPointVector:new(), s+ w0 N) R5 x) Y. G- H* u! x
end
" ?& w# }/ U3 E" D2 T flytext.clips:clear()# f, B$ r; |+ m6 J c: q
while dechp >= 1 do0 u3 B5 L# M! h% V4 k
flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*28)% {$ Q; O4 G; B% H9 X
dechp = dechp / 10% w) A5 O/ ?& M; [& Y
end
0 v% ?: h! E# b; k4 X& c flytext:setBatchClips(10, flytext.clips)
2 G; {. g! `8 ]; Q% o flytext:setOffset(-28+flytext.clips:size()*14, -50)! c; j' O. ^0 J
if not flytext.minus then4 o' T, N) v& v/ y
flytext.minus = F3DImage:new()( A! B- ^' b, M( ?
flytext:addChild(flytext.minus)" x3 o _8 O4 r) U
end! W/ K& x3 H) T$ t3 \
flytext.minus:setTextureFile(UIPATH.."公用/fight/criticalFlag.png")( u# \6 E0 C. p0 c s+ V( s
flytext.minus:setPositionX(-(flytext.clips:size()-1)*28-55)
( f6 v6 T& D3 Q V; A& D# l0 I9 S flytext.minus:setPositionY(-5): G5 p5 t' e3 k0 ]' W7 y* g
flytext.minus:setVisible(true). Q( l0 z6 s5 ]7 E
else
, s4 U1 e4 w6 |: @' q flytext:setTextureFile(UIPATH.."公用/fight/otherHit.png")
! b$ k' t4 G9 v" ~ flytext:setWidth(22)
( G% r( \; y5 ~; D. u if not flytext.clips then
7 g' V# x; U/ f3 [4 Z flytext.clips = F3DPointVector:new()& }& C1 Z) J$ v) j3 B |
end
, v8 U2 W/ G( A/ f) Q4 Y& {2 F flytext.clips:clear()
& ~! F. C! S2 z# u) n K while dechp >= 1 do
) Q* }, b5 x/ |2 X3 w+ {, q flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22)
/ m9 j4 r y- S' h6 ~* ]& }( Z dechp = dechp / 10
# G- S$ M3 }7 B- ]: a" [ end
8 [" s' D! ?% j+ a" f flytext:setBatchClips(10, flytext.clips)
; N$ O/ J- \! o1 b3 ]# t flytext:setOffset(-22+flytext.clips:size()*11, -50)
' d$ L1 O6 H( f7 W2 R( o" q if not flytext.minus then
/ U$ `' t4 M% V' p0 L! w) Q flytext.minus = F3DImage:new()1 t& ^# H% m" I
flytext:addChild(flytext.minus)
3 m7 O8 X5 L4 n! E' X8 R end; H6 c1 _2 m; W% y
flytext.minus:setTextureFile(UIPATH.."公用/fight/otherFlag.png")2 m# Y y! J8 S; q4 l* P! @
flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-17)
1 P' H; P' W' I) Y; c& k4 B# @ flytext.minus:setPositionY(12)
: H7 a- l- o7 P7 x- R1 H3 p flytext.minus:setVisible(true)" Y& s: A+ i7 [, t
end
- \( c: U4 F; K) w/ i1 Z& ^( N flytext:setPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 10)
) \7 _- Q, K0 K' [* y C3 \" N dechpcont:addChild(flytext)6 D" I. i( }& L. m M: ?4 }; \
m_Flytexts[flytext] = 14 o4 Y3 |. P1 T4 _8 a7 ^5 ?
local prop = F3DTweenProp:new()
9 Y) X s3 b9 S0 x' v& j4 f4 P1 A' S prop:push("offsetY", -100, F3DTween.TYPE_SPEEDDOWN); ^/ f* k6 r: V3 h' P2 ^0 N. ]
prop:push("alpha", 0, F3DTween.TYPE_LINEAR)
) J' f( ^5 `9 l5 v$ Z F3DTween:fromPool():start(flytext, prop, 1, func_n(function()! d" m0 }) g% w2 @
pushFlytext(flytext)--flytext:removeFromParent(true)
1 N6 V7 z" ~8 h7 Z6 p* m end))
$ N2 b. W! D1 r" [" F! M' K end
; f5 k' V# @; k0 E9 s- P$ S1 a hpbarpool = {}& G4 [% g, a) ^: K V8 p4 Y9 i/ f
function removeMergeHP(hpbar)' m o: B6 p% w. y& D
if hpbar.mergehp then
. J8 `' V" J' B6 A' m0 N7 e for i,v in ipairs(hpbar.mergehp) do' j; x$ B) s3 Z: y- p! C% Y
v:removeFromParent(true)
0 b( x1 {. p" H; t: g2 i" B end' a% m9 s5 r2 s7 ^8 g
hpbar.mergehp = nil9 }, I1 X* c" \7 o' C. ]! c r% Z, I. S
end2 p# I4 f: R3 j d
end
% _9 H6 J- W& |2 s# V# B Z$ i function createMergeHP(hpbar, hp, hpmax, mergehp)
9 C6 }7 V* m( m3 C" g2 Z, Q/ c hpmax = hp6 C8 o* u$ A E$ U; O2 ]
for i,v in ipairs(mergehp) do
( s* T! U6 P- N e" |) C hpmax = hpmax + (i == #mergehp and v.hpmax or v.hp)
Z1 j0 v" m2 A# C) E) {6 I0 f) l end6 f( C4 m! O- W( d& T" |
local perc = hp / hpmax
3 M- }- P3 y+ ` hpbar.hpimg:setWidth(hpbar.track:getWidth()*perc)
c( s6 q5 w( Q; x) T) v hpbar.mergehp = {}
- }% q! o% `" X5 C- `8 u3 a* ^ for i,v in ipairs(mergehp) do
" P$ y0 T$ ?7 T% U& C local hpimg = F3DImage:new()
' q v8 S8 r& ~& n0 l8 M local pc = (i == #mergehp and v.hpmax or v.hp) / hpmax
0 S8 F4 J( R( _0 d hpimg:setTextureFile("tex_white"); T7 M( i9 |/ B0 q% {
hpimg:setWidth(hpbar.track:getWidth()*pc-1)' ] P; R( j: a3 N/ W
hpimg:setHeight(hpbar.track:getHeight()). ?( k& o+ s7 [6 ]: t0 f5 b$ M% D
hpimg:setPositionX(hpbar.track:getWidth()*perc+1)
# l( s3 y( K7 R" b0 O. J6 A7 B hpimg:getColor():setRGB(v.color) x \, @ E& K3 q) m/ M3 B, m
hpbar.track:addChild(hpimg)
! W( |. t" j$ O {$ j6 { hpbar.mergehp[#hpbar.mergehp+1] = hpimg
1 d4 Q; L& w8 Q8 q! x3 ` h$ g: B perc = perc + pc4 l' t' }$ `6 L# m
hp = hp + v.hp$ N `2 {# x$ v0 i. o
end* G) D4 |) ~/ y$ f6 J
return hp, hpmax
( T$ x d. W& g) m end
/ C5 k3 V& c: n2 Z* @ function onHpBarInit(e)
- u$ D7 n6 ?* M local hpbar = e:getTarget()8 Q; X$ h; o7 }/ u
hpbar.name = hpbar:findComponent("name"): I( d: p1 V) [1 n
local ss = 实用工具.SplitString(hpbar.v.name,"\")
2 s" z" h' V* Q hpbar.name:setTitleText(txt(ss[1]))7 l& X% H; s! R% g9 p. o2 _) Y( K
if #ss > 1 then
7 }2 f5 E! l% E/ _7 a: { hpbar.nameexs = hpbar.nameexs or {}6 z& [1 c8 f, X# x( K
for i=2,#ss do1 K0 r# D) l5 z
local tf = hpbar.nameexs[i-1] or F3DTextField:new()
/ u" ~4 l( l% j& `+ M% M8 W if g_mobileMode then
0 o6 r$ c( r# | tf:setTextFont("宋体",16,false,false,false)
# A" T0 H: C t- A, ]( e! J end
/ H7 H7 m4 K/ _( m& S tf:setText(txt(ss[i]))
4 x: f/ w' v5 V9 B: ] tf:setTextColor(hpbar.namecolor or 0xffffff,0)
4 X1 I$ i. m$ W: `, T3 J z tf:setPivot(0.5,0.5)
# o( |) J/ R3 q tf:setPositionX(0)
" g* \ ]0 w0 m% @ tf:setPositionY(50+(i-1)*14)8 O! E7 h- T1 ]* q( ^9 L
hpbar:addChild(tf): F8 f# B1 Y3 D0 x! Y4 c: P# R
hpbar.nameexs[i-1] = tf6 ?( @5 v! U% L6 v
end
$ |( ?" V$ }5 H end& @! e3 k$ X) ` c
hpbar.name:setVisible(hpbar.showname)
+ c' w, y/ g2 b: v. F hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)
7 }+ y9 O) u+ a) e, `/ B8 ~ hpbar.guildname = hpbar:findComponent("guildname")
& L/ b9 R* ]; h$ N/ B9 P5 z$ B hpbar.guildname:setTitleText(txt(hpbar.v.guildname or ""))6 E' I, y( }0 q$ \& N
hpbar.guildname:setVisible(hpbar.showname)8 z r; Y: Q, F" N
hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)
% Z' M( e. J2 {/ K H hpbar.pro = tt(hpbar:findComponent("hpbar"),F3DProgress)
' u# b: B( `. |' H1 d8 W( W hpbar.track = hpbar.pro:getTrack()1 U+ h% e. C" W
hpbar.hpimg = F3DImage:new()0 M N% N) C# F1 \3 q' t* I
hpbar.hpimg:setTextureFile("tex_white")- Q) \& A2 [- K; e
hpbar.hpimg:setWidth(hpbar.track:getWidth())0 c% \4 y" s8 W a2 o! d& k
hpbar.hpimg:setHeight(hpbar.track:getHeight())
( k! t, S1 z* Q* Z% U, m hpbar.hpimg:getColor():setRGB(hpbar.v.color): V. g/ B1 n4 K# ^2 [
hpbar.track:addChild(hpbar.hpimg)) d( X! ~$ X w: P. d
local count = F3DTextField:new() --创建一个文字
( u& o! O2 [9 R& W4 G( {3 \ count:setPivot(0.5,0.5) --血条文字改为居中% ?4 J! V) v5 C3 z" d' g) Z y, `
count:setPositionX(20)--变更一下血条x位置
' T. p% A, J x* z5 N count:setPositionY(-10)--变更一下血条y位置
9 G0 t% Y0 Z- @ T1 B4 b3 J hpbar.pro:addChild(count)--跟名字绑定
; V$ }8 ]1 S# y4 X5 t/ K" t hpbar.count = count --方便下面随时修改血量. c6 B: V4 N" g5 \- \. } D
hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp.."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改* x& l# D0 g7 G7 c
--hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp .."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改
: Q8 w+ o) ~1 L, v, ]5 i8 x# c* ^ if not hpbar.v.mergehp then, [1 f; N; A; E/ X
hpbar.mergehp = nil4 o% l) c: @0 J3 ^# Y+ s1 Z
hpbar.pro:setMaxVal(hpbar.v.hpmax)
( i+ o* ~. r% [) F# |$ K7 o8 d9 m3 K hpbar.pro:setCurrVal(hpbar.v.hp)4 C6 k& z2 m6 P" i' S0 S& c7 r! n
hpbar.pro:setVisible(hpbar.v.hp > 0)
* @& X3 N6 d+ z6 q( y W else8 B) O9 v Z! J4 O9 N
local hp, hpmax = createMergeHP(hpbar, hpbar.v.hp, hpbar.v.hpmax, hpbar.v.mergehp)
% t* p4 f/ P. u" @ hpbar.pro:setMaxVal(hpmax) h9 f8 ]" z$ h' N" N+ Y
hpbar.pro:setCurrVal(hp)
" O$ Q7 L B5 j hpbar.pro:setVisible(hp > 0)3 ?2 m6 N4 [+ R0 R
end
]# r5 J+ ^6 M6 Q$ c# O1 b end
4 M9 Z2 l# c4 F9 k* u) r" ]( b function setHPBar(role, hp, hpmax, color, name, mergehp, showname, guildname, namecolor)* B( ^3 s4 c4 x) J( {; P
local newcreate/ x4 j k; N8 V6 X( r4 i
local hpbar7 ]2 U: z4 u$ }( E, _. L; C
showname = showname or 显示名字 == 1, C9 z" g: m8 ?" B8 L& l5 A
if role.hpbar then. X: E. b& l( }: k* K0 L. k) H
hpbar = role.hpbar( B; Z+ i- p# Z! ]5 f2 f& T. j" F% c
hpbar.showname = showname
7 v W# ~6 g o/ @% z2 W, t& _ hpbar.namecolor = namecolor
9 S. H4 N& ~+ R( x else$ z% [; e, [; w* g F
if #hpbarpool == 0 then% t0 J- V* H, F' ?3 f: c1 v3 ]
hpbar = F3DLayout:new()
; [' @& Z0 f* f+ t3 O1 C @ hpbar.showname = showname# b8 Q. z. ^8 a3 Y0 K! U
hpbar.namecolor = namecolor- ^ R* g% P& F9 |6 d6 @
hpbar:setLoadPriority(g_uiFastPriority)
: [4 }- M8 E. z9 E# X Z3 g hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}
0 f# f# I- z, J% M% r- ]' h hpbar:addEventListener(F3DObjEvent.OBJ_INITED, func_oe(onHpBarInit))
! \) _1 W, n3 A T! ~* Y hpbar:setLayout(g_mobileMode and UIPATH.."血条UIm.layout" or UIPATH.."血条UI.layout")--IS3G and UIPATH.."血条UIn.layout" or
7 g. a+ F# H/ i$ J/ [7 x newcreate = true% [' N* Y; h, b0 E/ k L
else, ]/ A1 D9 V d- p+ c
hpbar = hpbarpool[#hpbarpool]+ L8 D# H+ v/ x' W5 o! Y% r
hpbar.showname = showname; m3 G! s1 ?% |& V6 F; V: l: b1 X
hpbar.namecolor = namecolor
8 F2 a) V1 P5 `, X+ i4 i table.remove(hpbarpool)
# U+ v1 g+ D! h" r, V end
' T' |* P' S# X role.hpbar = hpbar# ^" ^8 y$ b7 |2 T$ Q; `/ {
hpbar:setZOrder(-role:getPositionY())* {5 o+ M p2 G1 e3 z
hpcont:addChild(hpbar)6 _6 ^* u: Y( U* z1 ?2 P0 h
end! B. F( L/ ^- E' X6 ]
if newcreate then0 c% d- p3 H0 }( \
elseif hpbar:isInited() then' O( `2 K) b! ~7 i5 p
local ss = 实用工具.SplitString(name,"\")6 k7 e5 D* Q* A2 p5 }. J0 M
hpbar.name:setTitleText(txt(ss[1]))
, R7 |6 V* m" S4 p! i+ s1 T, N' a if #ss > 1 then
# F' P) H0 a8 N% s8 p( M L hpbar.nameexs = hpbar.nameexs or {}
f. y$ H A8 T7 m for i=2,#ss do1 W3 E9 I' d+ c3 l" v
local tf = hpbar.nameexs[i-1] or F3DTextField:new()
* i" Z/ c" K4 x& N if g_mobileMode then
6 [1 h- |! q( u tf:setTextFont("宋体",16,false,false,false)% l3 I! L5 b, X5 l) G
end+ ?: D! B$ x6 X3 C
tf:setText(txt(ss[i]))% i4 b2 I, r/ @) N/ y
tf:setTextColor(hpbar.namecolor or 0xffffff,0), n5 s* Y- O) [1 Z& l( U+ @; h
tf:setPivot(0.5,0.5)! y$ X: i9 H1 x- h
tf:setPositionX(0)/ ~( f: P3 a; e, y
tf:setPositionY(50+(i-1)*14) N6 ]' j! ~/ X: T9 [3 ]
hpbar:addChild(tf)
% |9 Y1 D- K7 v# x$ e! k' z. f& E hpbar.nameexs[i-1] = tf+ o- C" z) K( F9 V
end# C7 T7 M9 O; ~/ G
end
^( ~4 n. v* T: A& ~ hpbar.guildname:setTitleText(txt(guildname or "")), Z' Z: R" I' j. b1 D# K
hpbar.name:setVisible(hpbar.showname or role == g_hoverObj)
3 n0 [2 M! M/ o- F1 i3 t hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)/ a; G g' ~% Y8 `) X: N
hpbar.guildname:setVisible(hpbar.showname or role == g_hoverObj)
, T0 B0 ^1 h+ S: x hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)
u& x: N7 P8 i8 y if not mergehp then, O* l9 N0 B V \% ]1 T( G0 {( Z) Z
removeMergeHP(hpbar)
8 H9 l9 [& L% V8 r, d7 C. ^0 M hpbar.hpimg:setWidth(hpbar.track:getWidth())
; ?! R' l3 T' b5 r. \ hpbar.hpimg:getColor():setRGB(color)
3 H7 w2 ~ u( ~* B( \; @7 z hpbar.pro:setMaxVal(hpmax)
7 c8 A' R) `4 b# E hpbar.pro:setCurrVal(hp)
8 E* R$ r9 F! s% t hpbar.pro:setVisible(hp > 0)
( }7 v( H- V( j$ L' ]# ~ else
& T, {8 t: B$ x. X removeMergeHP(hpbar); Z+ |" b% N( Z' h
hpbar.hpimg:setWidth(hpbar.track:getWidth())
! W6 e: _6 ?: @ U5 C& M hpbar.hpimg:getColor():setRGB(color)
* c. W6 R6 H( m8 e: n hp, hpmax = createMergeHP(hpbar, hp, hpmax, mergehp)
7 M s3 y1 ~- W5 [7 a! b hpbar.pro:setMaxVal(hpmax)9 j1 L- t. W8 i& n
hpbar.pro:setCurrVal(hp)% u8 C( {' W2 v; H9 D6 S3 L
hpbar.pro:setVisible(hp > 0)
" {" a0 ~) F& E$ ?) o4 m3 [2 i4 j end: `7 ~0 N# O# b
hpbar.count:setText(txt(hp == hpmax and "" or hp.."/"..hpmax))7 s5 y% t# b& ]% \' t/ V% P
else
1 H$ ]* F1 C) A* ~ hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}
! [) S5 H# I- i8 T; p end% v* n4 V4 p, F, c# X
if not role:isVisible() or (hp == hpmax and not mergehp) then
5 J- J- T+ e% h hpbar:setVisible(true)--false)0 Y) z- c1 Y1 q' A i7 d8 N" o. E
else
$ _9 L5 m4 N" l( z* A0 C- f hpbar:setVisible(true)" V0 t8 ~. \& q# ^
end
. y4 m4 J' X$ I% ]3 o- i- e end# M* J9 z0 B9 e7 e8 s
function delHPBar(role); s" ~; [( Q2 ?8 y& W
local hpbar = role.hpbar0 X( k& v$ Q+ V, x) c# h8 ]
if hpbar then
# \ e, h3 F) M, [# h! a+ L* ]: v* X5 q hpbar.showname = nil, a6 f- Z* d$ V3 B' ~
hpbar.namecolor = nil; Z2 d# O" W7 q( ?
if hpbar.titles then
$ b6 G8 j+ q5 ]+ I# {9 D for i,v in ipairs(hpbar.titles) do! ?8 U/ D+ E. d" s1 z$ T
v:removeFromParent(true)
7 _/ |7 i' Y& n9 u) q% c f" r end( Z0 t6 n* u4 `9 k. L" h
实用工具.DeleteTable(hpbar.titles)
$ l7 ~* b: u! U" Y end p: ]9 h4 ?: N4 ?) }8 T( S2 {, ]
if hpbar.nameexs then
* L9 c$ D7 m2 T, e for i,v in ipairs(hpbar.nameexs) do; X8 C6 ^: _& v- b3 @
v:removeFromParent(true)
% f& q7 `9 k% R: t* V3 K! Y end& l; e4 x0 |# n+ _* T
实用工具.DeleteTable(hpbar.nameexs)
$ |/ C, T% V! B- v, F3 n end5 O5 Q) Z9 e2 r3 D, o
hpbar:removeFromParent()( i+ O+ ^# I% }! \
hpbarpool[#hpbarpool] = hpbar! }$ \7 d% r7 X$ I! X/ _0 M
role.hpbar = nil
- ^) i8 K# I+ m% p2 K end; v" X* l% k1 f5 w1 j5 n
end
) @) i% X) y8 o5 q; X function updateHPBar(role)( A7 W) Y8 s& e; ^* Z5 c0 r. p
local hpbar = role.hpbar
6 g! f% B$ \0 l! i if hpbar then
/ z" a' M6 k! @ hpbar:setVisible(role:isVisible())+ Q, A+ x' g+ J; W6 g
end7 K7 n n8 Y5 ~ l/ m8 N
if hpbar and hpbar:isVisible() then( v. B j2 g. R3 g7 K- H* o% n
hpbar:setZOrder(-role:getPositionY())* i; T) t, L1 F/ X0 u. K
local pt = F3DUtils:getScreenPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 20)) E' c( t* k! }5 B) v
if pt then1 E4 ~8 X0 Z' E# J# U, W
hpbar:setPositionX(pt.x)
9 r2 X1 \; s0 ?/ t5 z hpbar:setPositionY(pt.y)' f' V" M+ n! [/ H) @
end& B6 S+ X4 R% _; v, m# T, j, f
end* v }& W- O! Q! F
end 复制代码
7 p; u6 g4 Z8 @8 h, A6 w / e- g$ X" a$ V' y