|
平常他是不显示的,默认的是只有血条,没有数字! ; g3 U- L% w9 U
5 F1 d/ t, p2 s* G* \5 q- E
如果想让他这样显示按照下面方法做: # H. W6 ]$ I; R
' J! S) q" a* D
把下面的lua脚本复制到你服务端 ' @+ F% i. q2 i# o
4 J2 D/ ]" M( p/ k( v7 H5 S0 @\龙途\Flying3D\scripts\模块\主界面\主逻辑.lua ! J9 O9 Z$ v4 `5 F
) g% J; w. P* B% n5 h8 R; j
里面全部覆盖,注意是全部覆盖! ( }- ^: M/ t) ]& B7 r1 ^
; R7 H$ j3 I1 T6 l然后重新打包pack
" V, i- F/ ]" f' V- module(..., package.seeall)0 d0 u9 Z4 V! [0 C6 W: m! b
- local 实用工具 = require("公用.实用工具")
! Y7 W! [& j6 `5 K, L - m_FlytextPool = {}
9 u- i! @4 Z; U& c2 t0 T - m_Flytexts = {}
6 b. B I. q; j' F - function pushFlytext(flytext)
& z* S6 a- t0 Z6 [1 a - if flytext.minus then6 f. s- E6 A7 _0 H! S
- flytext.minus:setVisible(false)& A( s8 u- `+ m6 k: F4 M1 E
- end
& b0 g6 I# M6 x3 O. A4 Z5 s- F - flytext:setAlpha(1)
( A; _/ |3 h6 j5 [3 x, P; t2 w - flytext:reset()6 `! X# j9 V3 ^: P& L
- flytext:removeFromParent()+ S6 @. S) A; I; X
- m_Flytexts[flytext] = nil6 m" ]* D8 [' L4 O& s; X$ ]0 n# F
- m_FlytextPool[#m_FlytextPool+1] = flytext
5 V# a$ G, j5 V* \& _$ r. @ - end9 \4 N g- |) ~0 |# q
- function popFlytext()
6 V, ^2 a, I1 k) z' z - if #m_FlytextPool > 0 then* B6 S+ ?4 Z" B* _! w
- local flytext = m_FlytextPool[#m_FlytextPool]# d4 x7 M! A7 ~ S0 K
- table.remove(m_FlytextPool, #m_FlytextPool)9 d/ N6 a& { p: g9 K5 F* s# g! P
- return flytext9 O/ V1 a. r8 v. A
- end3 u+ \+ c5 [ ^0 g1 Y/ H+ W8 c
- end
2 ^( X6 f k3 [! m& c; W3 D - function showFlytext(role, dechp, crit)5 y8 t$ C1 S( x
- if 1 then" ~) R- o! E2 U8 F. |& P* H9 @
- return- J! e( y1 @% T4 Z ?" h
- end
9 @! \6 y7 ~ j( I - local flytext = popFlytext() or F3DImage3D:new()2 w* X% H9 }+ o
- if dechp == 0 then) ?, |% R% z5 O/ @+ H O/ |8 r- \0 m
- flytext:setWidth(0)
& a) ^, F: ^* Y( ^' U - flytext:setTextureFile(UIPATH.."公用/fight/miss.png")
% j* K2 h; f# d - flytext:setOffset(-52, -35)
9 Q; }( h7 x( ~4 ]5 H - elseif dechp < 0 then- C( M' g1 C, O8 N
- dechp = -dechp' t7 p) L( ~) H: y6 \) N
- flytext:setTextureFile(UIPATH.."公用/fight/addHit.png")
( ~$ ~7 l, n2 x* @( y A - flytext:setWidth(22), V y% [) R' E1 m, h. ~3 V+ S
- if not flytext.clips then
1 t I, \7 e5 l/ a l" P3 B0 A - flytext.clips = F3DPointVector:new()$ r2 k0 P! m' G5 I& U
- end
# D- y {4 `& U; e( T1 h - flytext.clips:clear()) C) H3 {$ _1 P& ^$ z9 E
- while dechp >= 1 do
% S% C/ _6 ^6 z' N - flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22)
& k* `7 a9 T8 u$ M) F2 i - dechp = dechp / 10
$ Q1 d! }; [$ u - end+ y- p4 K8 `" T0 w) m1 L' N) ^
- flytext:setBatchClips(10, flytext.clips)
$ E0 X8 x1 [& Z" ]5 J - flytext:setOffset(-22+flytext.clips:size()*11, -50)) B7 v( t7 B1 `, g
- if not flytext.minus then
/ H: R2 y/ `1 F! O9 Y - flytext.minus = F3DImage:new()
" I/ L1 G5 R$ m9 N - flytext:addChild(flytext.minus)& ^0 f% L* w' A
- end A# A" J* w& X/ o( f
- flytext.minus:setTextureFile(UIPATH.."公用/fight/addFlag.png")
$ a! ] ~& D- T% Y D* s. w$ j - flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-27)
8 [. S6 U3 N2 T5 E2 i8 ?8 E - flytext.minus:setPositionY(4)
; y6 N1 c8 s, l8 |. ~ - flytext.minus:setVisible(true)# X' o8 g5 l3 ]" S
- elseif crit == 1 then6 z/ n5 \% ^2 @. N
- flytext:setTextureFile(UIPATH.."公用/fight/criticalHit.png")
/ o' `: C- U0 ~2 `$ ~ C3 n6 l5 x% l - flytext:setWidth(28)
: f0 t, r2 ? L O, ? - if not flytext.clips then
) H- Y- d4 ~. l# C' Y - flytext.clips = F3DPointVector:new(); K$ [6 `: J8 A7 f
- end
5 P' i7 _/ C5 s6 L7 N I - flytext.clips:clear() _* J) ?8 Y/ P) @/ g1 |! N; |
- while dechp >= 1 do' ^1 A, _; ^" n% v Z( t
- flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*28)$ b; A4 J- ]8 t# J0 n( O5 _0 N
- dechp = dechp / 10+ c$ p; r: r# x( W
- end7 }" s/ A+ W/ w3 z5 I9 }: U
- flytext:setBatchClips(10, flytext.clips)
. R, \! i' U1 P' b/ b - flytext:setOffset(-28+flytext.clips:size()*14, -50)
0 Q' h- e1 i8 ]0 O& P% x: s - if not flytext.minus then" |) h& E7 T1 Z$ j
- flytext.minus = F3DImage:new()/ m# n- V' o) S( E( i5 w2 x1 U* R
- flytext:addChild(flytext.minus)6 P5 H# k5 p3 s# N& W( g, m
- end# K" R4 h+ T' l( u" W4 c
- flytext.minus:setTextureFile(UIPATH.."公用/fight/criticalFlag.png")
/ J& w( F3 O9 F- C2 \ - flytext.minus:setPositionX(-(flytext.clips:size()-1)*28-55). ^% r$ J& R( O% ^) v7 ^. W) R7 M
- flytext.minus:setPositionY(-5)5 e: ~+ Q( y1 t, g
- flytext.minus:setVisible(true)
9 t" a5 J& [0 J3 F& G - else; Z- u& P# Y/ W
- flytext:setTextureFile(UIPATH.."公用/fight/otherHit.png")
* U/ Y& ]- ^9 P2 c* U - flytext:setWidth(22)
$ ?/ d; u9 N: R1 |/ O' \0 G - if not flytext.clips then
5 p7 d) U. u/ G6 x) f - flytext.clips = F3DPointVector:new()0 t% s7 m2 |: `# k
- end# E! u. o8 ]8 Y8 J6 S5 J" e
- flytext.clips:clear()
9 w9 i; R, e0 }: P' T4 z* L - while dechp >= 1 do+ B% ?5 J' @% g: w) S3 H
- flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22)
; g; c5 a* `: P. O - dechp = dechp / 10+ R" s( ]8 s' B0 J& v, C# K' O( `/ ~- i
- end9 `$ B2 @2 v, i& t. V* p0 B
- flytext:setBatchClips(10, flytext.clips)
+ D; C+ C0 ^* e% }5 B3 G - flytext:setOffset(-22+flytext.clips:size()*11, -50)+ P- l$ O3 l' n( X& x
- if not flytext.minus then# I2 b/ A: D, p, z: P
- flytext.minus = F3DImage:new()
3 ]# R. s: M& `2 |3 {5 z- o% C& F3 z5 P" P c - flytext:addChild(flytext.minus)
4 Y; Z: r% V: z% l* q! D - end0 `2 |" w1 v0 [6 @# a* Q
- flytext.minus:setTextureFile(UIPATH.."公用/fight/otherFlag.png")& X1 H. d1 `8 t W! g7 x
- flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-17)
. c: W4 G6 {9 S8 z - flytext.minus:setPositionY(12), e8 t) w. r [. |3 D. {
- flytext.minus:setVisible(true)
) ~ o; L3 i+ W+ b0 y: g9 d - end
( p8 s" Y/ \( C# @7 o/ x - flytext:setPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 10)
) r4 [- R& S l( G' _ - dechpcont:addChild(flytext)/ u& x0 h5 P( n( L$ G4 A. @8 O
- m_Flytexts[flytext] = 1
) c8 {+ r3 v+ i( C - local prop = F3DTweenProp:new()9 v" U) Y2 o9 s/ B6 S
- prop:push("offsetY", -100, F3DTween.TYPE_SPEEDDOWN)
. X* a4 y: Y: U# d+ o - prop:push("alpha", 0, F3DTween.TYPE_LINEAR)
+ T* I# ]9 e+ \# a6 P% p7 Q - F3DTween:fromPool():start(flytext, prop, 1, func_n(function()
) B% J. }' t( R. W# l6 ^ - pushFlytext(flytext)--flytext:removeFromParent(true)
+ i( I) A2 }) d9 A3 G" k& I6 q - end))$ @/ @& ?$ N3 X0 k
- end: S' o u, O' p% z
- hpbarpool = {}
! g5 @; `& T; f. x) l6 w - function removeMergeHP(hpbar)
2 X& p, x$ ?, E1 L- {0 w - if hpbar.mergehp then8 e3 P! |* w' W6 X
- for i,v in ipairs(hpbar.mergehp) do, N+ ?" p; o# C6 F# o3 I
- v:removeFromParent(true)1 j- c: _2 ~6 B+ S
- end
# P2 D) G3 F( f - hpbar.mergehp = nil
# G2 T3 w8 H; @. `# {) |* @ - end
/ `! r+ ?7 A" r2 ]' B6 Y - end
: a, m" K- {( N. K - function createMergeHP(hpbar, hp, hpmax, mergehp)9 C, q+ a* G$ G" Z
- hpmax = hp' g6 l) z }$ D
- for i,v in ipairs(mergehp) do
0 P/ F( q4 z' g" e" O' h - hpmax = hpmax + (i == #mergehp and v.hpmax or v.hp)0 s) G3 R6 ?$ O- y/ B
- end% k3 Q/ V7 s4 X
- local perc = hp / hpmax! W) n7 n1 m& g0 I2 x( q
- hpbar.hpimg:setWidth(hpbar.track:getWidth()*perc)
* y1 ?8 y. ~; d: ` - hpbar.mergehp = {}
* {' G! f* j' q/ r3 \% l) f/ J - for i,v in ipairs(mergehp) do* X6 |0 _ v/ x- w
- local hpimg = F3DImage:new()* Y X3 y; g' I
- local pc = (i == #mergehp and v.hpmax or v.hp) / hpmax- @) _* R! E2 N V8 N2 p- H6 w$ K
- hpimg:setTextureFile("tex_white")/ X7 s4 r- q4 F3 X: l/ Q
- hpimg:setWidth(hpbar.track:getWidth()*pc-1); z- V. A7 a* i5 K
- hpimg:setHeight(hpbar.track:getHeight())
# d8 ^( t% h6 F- _- B. K - hpimg:setPositionX(hpbar.track:getWidth()*perc+1)
c3 g7 w7 x3 {* s5 W: P1 q$ J - hpimg:getColor():setRGB(v.color)' E# i0 K% {2 M: C+ X
- hpbar.track:addChild(hpimg)7 q. _0 |$ Q: |9 T' G# s: T, x2 s
- hpbar.mergehp[#hpbar.mergehp+1] = hpimg
2 b) ?% e( D& `" U - perc = perc + pc2 A7 e+ S$ \: P" `+ C
- hp = hp + v.hp1 C6 Y2 w* V0 U. d9 A! _! a& |
- end
* [' |2 }3 r4 H; N - return hp, hpmax
9 U2 O {) H5 F: i% N7 t - end
! r) h4 ^" `3 u) v) w* }: F - function onHpBarInit(e)
/ E7 _( a+ g- x0 j+ J" V - local hpbar = e:getTarget()
# h4 B& E' E7 R4 ]& o* q - hpbar.name = hpbar:findComponent("name")
5 _ y0 J" r" K - local ss = 实用工具.SplitString(hpbar.v.name,"\")+ R, w% F# I4 ]& D6 G) @
- hpbar.name:setTitleText(txt(ss[1]))9 z! {* L0 [1 n& X' C
- if #ss > 1 then% u4 j( w! I; H5 O9 [3 l6 ? M+ d
- hpbar.nameexs = hpbar.nameexs or {}+ M* C! h# z5 @. \- T M' M- G
- for i=2,#ss do2 i |$ Z z* X5 E$ u5 }- W0 y
- local tf = hpbar.nameexs[i-1] or F3DTextField:new()
- d' f6 ^+ R' s# |" V - if g_mobileMode then
( [. O( C7 S; c8 M- B" p3 J - tf:setTextFont("宋体",16,false,false,false)
3 X2 \1 Q" [3 z# b - end/ `* m! x1 v- i% \ ~' Y
- tf:setText(txt(ss[i]))* l$ @+ ^) ^' S$ C9 S& g; u
- tf:setTextColor(hpbar.namecolor or 0xffffff,0)
7 F& P& ] C. v2 ]. h0 p - tf:setPivot(0.5,0.5)! S1 K9 B4 w: ~- } g
- tf:setPositionX(0)
2 O$ y) L9 u2 C6 w) g+ @4 D2 T - tf:setPositionY(50+(i-1)*14)8 Q8 R; R2 B; v' }
- hpbar:addChild(tf), X4 m! @" @% A+ Y
- hpbar.nameexs[i-1] = tf) e* c7 U+ M7 f4 s; C5 h" \
- end
2 F9 n1 n- n) i5 D# ]* ^8 g - end
( N3 v9 Y- U" ~7 n- u/ Y) P1 ^0 \ - hpbar.name:setVisible(hpbar.showname)# i: m0 l# b1 Y7 q$ Q6 d& Q# A
- hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)
$ T4 o+ X; ?/ G4 Z - hpbar.guildname = hpbar:findComponent("guildname")$ s$ q! x/ V' B2 R
- hpbar.guildname:setTitleText(txt(hpbar.v.guildname or ""))
# l) N2 ]; Y6 D2 U - hpbar.guildname:setVisible(hpbar.showname) U3 G7 [- @& l/ u
- hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)
) h4 G" h {( D1 ]3 c - hpbar.pro = tt(hpbar:findComponent("hpbar"),F3DProgress)
8 K5 e5 u# {$ y( q: p4 X5 r T" N - hpbar.track = hpbar.pro:getTrack()
7 V7 k: m0 ^ o - hpbar.hpimg = F3DImage:new()0 q- ~. I4 k1 }& d+ F
- hpbar.hpimg:setTextureFile("tex_white")
- P7 y+ e4 x6 w/ O1 M - hpbar.hpimg:setWidth(hpbar.track:getWidth())
6 E+ C1 l1 E( l! z6 a - hpbar.hpimg:setHeight(hpbar.track:getHeight())
+ u& H2 x+ q3 c: r - hpbar.hpimg:getColor():setRGB(hpbar.v.color)
1 x, _/ r# j2 C6 k' | - hpbar.track:addChild(hpbar.hpimg)
( z9 b$ W# _) R$ a4 z - local count = F3DTextField:new() --创建一个文字+ i- b z D( A7 Z
- count:setPivot(0.5,0.5) --血条文字改为居中" X6 M" |6 I) \+ t! P
- count:setPositionX(20)--变更一下血条x位置/ ?* u1 F- l9 O8 U0 T9 X0 y
- count:setPositionY(-10)--变更一下血条y位置! S1 _4 A' \3 j* u9 ^1 ~- Q! A, {
- hpbar.pro:addChild(count)--跟名字绑定
; g$ b. H' w; w4 d$ q; w$ o - hpbar.count = count --方便下面随时修改血量
( J* z! @& ~: Q) b' x! V$ c$ K+ b - hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp.."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改
; H ?: z! L0 S. f! ]1 z - --hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp .."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改. T" C% a( f" C9 Y- [2 a- `
- if not hpbar.v.mergehp then& I# w) ^" g K! `+ y- H0 L2 K/ L
- hpbar.mergehp = nil
/ U5 F: p, Y: i' M) U+ z( }4 J% W - hpbar.pro:setMaxVal(hpbar.v.hpmax); ?( N- v2 _; F7 V
- hpbar.pro:setCurrVal(hpbar.v.hp)7 |7 L2 R u1 V1 X# ?0 X) L0 g
- hpbar.pro:setVisible(hpbar.v.hp > 0)& ?* _: c/ _2 H2 X6 \
- else' Y5 }6 Z9 s0 y6 _
- local hp, hpmax = createMergeHP(hpbar, hpbar.v.hp, hpbar.v.hpmax, hpbar.v.mergehp)' v# ^1 b5 O1 p B
- hpbar.pro:setMaxVal(hpmax): n' x0 \! l* s
- hpbar.pro:setCurrVal(hp)* r% K. \/ v4 V
- hpbar.pro:setVisible(hp > 0)
6 t$ `9 J) L/ _8 T R, ?! ] - end
2 P9 S5 _. f1 v! E+ z" R, L. @ - end
* E5 H4 x) {! h, C4 x! c - function setHPBar(role, hp, hpmax, color, name, mergehp, showname, guildname, namecolor)
7 ~! y$ K8 b) Z. D7 R/ w" [ p0 t - local newcreate
' w+ b6 M7 ^- u - local hpbar
" s+ u- q9 k4 r9 L4 ? - showname = showname or 显示名字 == 1
/ {& l$ }, P' ]7 E - if role.hpbar then, E4 t/ A1 l4 V
- hpbar = role.hpbar) S" f% h8 j- w0 C: J4 l8 }+ ~, `
- hpbar.showname = showname
; k% L, i# d5 q - hpbar.namecolor = namecolor0 O* P8 X2 \# S4 f
- else# y* L A l+ y' P2 i
- if #hpbarpool == 0 then
& f6 `7 C, h5 i - hpbar = F3DLayout:new()
/ e3 }9 M! z* Q) a6 b J - hpbar.showname = showname
: h0 x1 V! k7 S4 U" C& {0 E% ` - hpbar.namecolor = namecolor
, B) k! F, {* Y; j7 P1 c& Y; W1 x - hpbar:setLoadPriority(g_uiFastPriority)9 T9 P5 l# G3 _- {+ I) e8 @8 d& s
- hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}
& Z# M0 [3 h) K% F - hpbar:addEventListener(F3DObjEvent.OBJ_INITED, func_oe(onHpBarInit))
- E1 I- }# X2 C; S. e$ k' K - hpbar:setLayout(g_mobileMode and UIPATH.."血条UIm.layout" or UIPATH.."血条UI.layout")--IS3G and UIPATH.."血条UIn.layout" or % V) O: p5 q1 I0 _& ]
- newcreate = true
+ Z! J. n% h8 g6 L6 ] - else
4 h* t3 K& K6 `: X - hpbar = hpbarpool[#hpbarpool]( n7 [% D; n( q$ r2 H
- hpbar.showname = showname' Z( h) w0 ~( K3 n O z" i
- hpbar.namecolor = namecolor
* ~; c b& m: g; { - table.remove(hpbarpool); e: F ^3 J/ N# l9 W; j7 w5 b5 U. \$ d
- end
2 S9 v8 `( ?( j7 E! n( S - role.hpbar = hpbar+ N: o! M4 |" Q) c2 t$ O
- hpbar:setZOrder(-role:getPositionY())
) M4 P" Q0 M2 N. s - hpcont:addChild(hpbar)" p: J) }9 S( v
- end; _0 _/ q* O: b" \; @1 v* H; [, ^
- if newcreate then! U7 ^0 M5 J. f9 a# e, ?
- elseif hpbar:isInited() then# s5 V) l' F7 }% O, Q' t
- local ss = 实用工具.SplitString(name,"\")
8 O' F7 n; z# R, _ - hpbar.name:setTitleText(txt(ss[1])); }2 |$ F, j$ _! Q/ I2 D/ |
- if #ss > 1 then
; m: t: a/ `& p+ \6 d' G0 \ - hpbar.nameexs = hpbar.nameexs or {}: [5 v2 w2 ~7 C9 i7 {& P
- for i=2,#ss do! b8 d4 ~0 ]2 ~+ R# M
- local tf = hpbar.nameexs[i-1] or F3DTextField:new()! E$ ]& l* U% i- n
- if g_mobileMode then
' ?, g: k, x3 H# P0 C$ A - tf:setTextFont("宋体",16,false,false,false)
' @( J. b- y' `5 N2 Q - end2 `; C: A+ z; Z; `
- tf:setText(txt(ss[i]))
" @1 c8 ?7 i" m4 x - tf:setTextColor(hpbar.namecolor or 0xffffff,0)
' e* h. d3 @7 R! ^# ~; K7 g# B x - tf:setPivot(0.5,0.5)
: a/ T; Z/ X3 y( q; R! u1 Y+ S/ j; ^# J3 s - tf:setPositionX(0)
3 y2 x6 w8 T; G5 v+ v5 `9 T$ n - tf:setPositionY(50+(i-1)*14)4 D9 t' l/ K& l2 c8 U: M) V
- hpbar:addChild(tf)6 A1 r* W. s/ ~$ {
- hpbar.nameexs[i-1] = tf) ]/ n$ W& i' x! ?4 g' p! n
- end* N+ l" d. D7 c' G3 K' A
- end' Q a* `9 D$ S2 o% @
- hpbar.guildname:setTitleText(txt(guildname or ""))/ D f _# b, T8 T L: \6 M0 E/ y3 o3 e
- hpbar.name:setVisible(hpbar.showname or role == g_hoverObj)
/ a7 w E( B' v# i4 @% U - hpbar.name:setTextColor(hpbar.namecolor or 0xffffff); r' S" ]; K5 }1 P
- hpbar.guildname:setVisible(hpbar.showname or role == g_hoverObj)) G D& l% R& ]; Z; H6 D
- hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)
3 Y& p+ q% e0 J$ ^9 j - if not mergehp then
) ~& `) o3 r& H1 Y0 b6 q% h2 @& ~ - removeMergeHP(hpbar)$ v/ C' T$ `& z: Z. y, U R! \: b1 k
- hpbar.hpimg:setWidth(hpbar.track:getWidth())8 @" o P4 t G! z& A
- hpbar.hpimg:getColor():setRGB(color)4 O! i' w1 l; T) Y# r- H! M
- hpbar.pro:setMaxVal(hpmax); j L% f; h- R5 Q4 h7 `6 S
- hpbar.pro:setCurrVal(hp)
8 Y0 B, L$ A5 w, F6 t - hpbar.pro:setVisible(hp > 0)
7 R+ K; b# \6 ^5 G, \! f0 c2 t - else
: Z* B2 }8 a+ l; ^" ^3 W' Q - removeMergeHP(hpbar)
$ U& N# G6 Q6 V - hpbar.hpimg:setWidth(hpbar.track:getWidth())) @- l* c9 P8 P* h
- hpbar.hpimg:getColor():setRGB(color)
( P# v; d) N- r. i9 \! T - hp, hpmax = createMergeHP(hpbar, hp, hpmax, mergehp)
& q; H' Z s2 F - hpbar.pro:setMaxVal(hpmax)
+ G6 H8 _! C9 I: w - hpbar.pro:setCurrVal(hp)
, ?+ h$ r- c# t - hpbar.pro:setVisible(hp > 0)
: {6 O$ n2 N. p" I- j* p7 p - end
! K, C2 E) k5 W( O9 L: H - hpbar.count:setText(txt(hp == hpmax and "" or hp.."/"..hpmax))9 T( {& ~* u2 N0 r* u
- else
$ u6 p; S Y, G& K5 j3 c - hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}( `3 f' q' b& c
- end$ n% D8 a/ u' L A6 h: J
- if not role:isVisible() or (hp == hpmax and not mergehp) then
& w( ^0 N' P1 I" W' S { - hpbar:setVisible(true)--false)
* v# Z O& u5 s0 x H3 k! y - else/ {: F" W6 q. h* X% U1 t
- hpbar:setVisible(true)6 R) B z. l4 }. q% w1 b+ q* m
- end
) f1 W2 R" r, J0 n - end
6 t# v6 X6 t$ x+ O2 R# `9 ]$ U( ~ - function delHPBar(role)
& {/ X( Z+ @. e0 A/ @) i6 l, N2 G - local hpbar = role.hpbar
) i* L p. e a) W% X - if hpbar then
- K7 T+ [" u0 O9 ]( x8 Z - hpbar.showname = nil% \1 B( q7 C; A( q* I$ f2 G
- hpbar.namecolor = nil# |/ Y/ U- G3 [* Z
- if hpbar.titles then2 @6 R# d- W" o5 M. Y. c' n! @
- for i,v in ipairs(hpbar.titles) do
; U" x- K$ d% r0 z5 R - v:removeFromParent(true)! C. w8 D- e! s' K
- end% L0 Q6 p# a4 r
- 实用工具.DeleteTable(hpbar.titles)1 L% |& a8 y* I/ C: M* |! b1 b
- end0 K8 M1 p s$ o5 ~
- if hpbar.nameexs then2 Q+ i9 Q! b% H% U. [
- for i,v in ipairs(hpbar.nameexs) do' p3 ~/ r3 o9 d4 u( `5 `, y
- v:removeFromParent(true)+ V! d( p; [+ ^# [7 M& Q
- end/ C3 z/ H3 v4 h" t5 W
- 实用工具.DeleteTable(hpbar.nameexs)
- y P& v Z, Y8 w; J; i9 k0 U - end
, O- v0 y' Z6 O# f - hpbar:removeFromParent(), }7 F# g# M2 n" h. K" N9 G+ R
- hpbarpool[#hpbarpool] = hpbar! J( }' Y- o* g. O
- role.hpbar = nil
3 N, N0 j* L6 l- a; D- O; r - end: K. R5 @" A4 n: u0 E
- end* v5 T7 g. |/ _3 B8 O/ h
- function updateHPBar(role)' E; ]$ T3 D$ T P5 B
- local hpbar = role.hpbar' s9 e9 B" p2 `
- if hpbar then, n/ t6 i% J8 @% ~# ?$ w
- hpbar:setVisible(role:isVisible())
- F. M ?( d- `. c+ {3 H - end8 Z, H0 i( }) p( [9 Q* N6 G7 Y b
- if hpbar and hpbar:isVisible() then8 i( H' [; F& l6 B+ C
- hpbar:setZOrder(-role:getPositionY())) y- N" L p5 g( B' C
- local pt = F3DUtils:getScreenPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 20)
0 Q# g! x/ {/ C, i) j - if pt then
; r0 J. }& z5 Y# J' H; a) e - hpbar:setPositionX(pt.x)# ~9 m9 E# v8 ]* u9 g( E/ Z7 N1 g1 {
- hpbar:setPositionY(pt.y); b/ r( F4 m8 o" v- i
- end. A' G. r$ |' w( i, n% @- F! n
- end
+ u/ c( g/ c) H9 m6 z - end
复制代码
; K4 w6 M: I1 Y$ V- C* |6 Y* |/ H9 t6 P* F
|
|