|
平常他是不显示的,默认的是只有血条,没有数字!
1 K. s9 l: |" i
8 G# `' d- U7 v1 n如果想让他这样显示按照下面方法做: ( J- u8 `2 E# N, L h- z2 z
1 q+ Y* w+ _' p8 [把下面的lua脚本复制到你服务端
9 b9 F( Z: Z& b# t& [7 d" [5 l' P; y: V, g `
\龙途\Flying3D\scripts\模块\主界面\主逻辑.lua
- q' t& p' i0 g+ r8 U4 ^
6 L& W# i( L3 Y$ q里面全部覆盖,注意是全部覆盖! , c& K& ]) ^4 g& [
! T6 m, M* y1 x" G, q3 w
然后重新打包pack
& |; _/ V* l4 M4 f+ l1 y- module(..., package.seeall)
+ X* n. r3 P/ c- d! @ - local 实用工具 = require("公用.实用工具")
! w; n* ?5 E( i- Z( N - m_FlytextPool = {}
! K4 t( q8 W/ N0 Q9 s& F - m_Flytexts = {}- R+ ?6 W- r! i" s- T* n
- function pushFlytext(flytext)
9 B5 f+ g5 p. F& X) J! l4 M. h9 B - if flytext.minus then
% w& S) |+ i/ v4 ` - flytext.minus:setVisible(false)
) k- t3 Y+ r/ f+ a, {, H- o7 y) a- G - end
9 Y& E; l, |, v4 I3 \ - flytext:setAlpha(1)
0 c8 y! s' c! \) r8 F! N+ p. U - flytext:reset()
- o( v/ T3 _# }! E4 Y4 z0 G - flytext:removeFromParent()3 h7 j# i% x5 O0 a2 t) Z1 T
- m_Flytexts[flytext] = nil
( E7 X `- b3 E, L - m_FlytextPool[#m_FlytextPool+1] = flytext3 X0 \4 [- l% `! W6 c9 X
- end
) H8 w6 B, Q9 ?. S - function popFlytext()
) v3 U, N |4 Z8 v - if #m_FlytextPool > 0 then, E+ Y* m% x! }# Y% |
- local flytext = m_FlytextPool[#m_FlytextPool]/ Q0 W, ]; m) }
- table.remove(m_FlytextPool, #m_FlytextPool)8 A6 T2 m- m# ]' u) G# {
- return flytext. H( A A+ P; x5 q9 n ]' U& C: x
- end
8 j( [: e' o; e/ c/ F& ? - end/ r4 R2 k2 _8 M
- function showFlytext(role, dechp, crit). Z0 X8 ?9 v1 {2 x/ V1 ?3 b3 s
- if 1 then: X! v/ s2 r* f: y! R) @
- return! c3 `5 N5 q3 P% K0 N1 }
- end
2 I6 U6 T; l3 B& y; p' E - local flytext = popFlytext() or F3DImage3D:new()/ X3 Y# N7 z! B
- if dechp == 0 then
: y& R8 R, \) I0 w$ X+ Z n5 ? - flytext:setWidth(0)
/ r" H. x+ H( L+ v' b2 {4 W - flytext:setTextureFile(UIPATH.."公用/fight/miss.png")
( P& x- D/ r% h# A0 a2 R: @$ M - flytext:setOffset(-52, -35)2 `% A. y: w6 d; o2 b# q9 k2 |; k
- elseif dechp < 0 then. k. S: r% e I" f0 a& o y6 l; P
- dechp = -dechp; m( z6 B3 r2 g$ F- p% q8 d
- flytext:setTextureFile(UIPATH.."公用/fight/addHit.png")
% I/ r" ^: O" ^: ]3 o - flytext:setWidth(22)
8 ~1 \! M, ]$ m9 v" c) J! P - if not flytext.clips then+ y6 r1 a1 K) M$ x) @' h+ L# I( t
- flytext.clips = F3DPointVector:new()' i L) m+ w4 a- x# c+ O! {+ L
- end# u: _0 i A' O6 a7 {, m
- flytext.clips:clear()
5 U) y7 h7 f6 `4 o) _ - while dechp >= 1 do' |# S( p+ c: i8 D
- flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22)( |$ ?4 @+ z/ C, q3 L4 G2 u! b
- dechp = dechp / 10
* t" B+ d% d: i+ c# [ - end. Y. B5 v6 V4 R0 B0 v- d- d
- flytext:setBatchClips(10, flytext.clips)
- A/ s% v6 J8 @' y1 R7 v: i2 O - flytext:setOffset(-22+flytext.clips:size()*11, -50)
- u, S5 j- G" z% ?$ l3 o - if not flytext.minus then" H) X$ L u# k
- flytext.minus = F3DImage:new()
$ R% ~* G* }. c# E' ? - flytext:addChild(flytext.minus)
9 K! _- W7 }+ O8 |. F6 s - end
4 X( F3 a U! c; X- B6 j - flytext.minus:setTextureFile(UIPATH.."公用/fight/addFlag.png")
. u6 G% Y9 g& d/ n) Y; o1 | - flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-27)
( _7 I: [, g2 Z0 e* p* x - flytext.minus:setPositionY(4)
9 A% P% i* X, Q. T' i% L$ M# j - flytext.minus:setVisible(true)
: K9 N2 ^5 ?$ g# L - elseif crit == 1 then
$ `, r; x# t2 }& p; t - flytext:setTextureFile(UIPATH.."公用/fight/criticalHit.png")( h, ]; l. P8 U- F; d, G5 r* ~
- flytext:setWidth(28)
7 M m3 b. E+ B# Z& t0 i- S - if not flytext.clips then. c: o& c5 @0 s
- flytext.clips = F3DPointVector:new()9 l/ [/ |# L; I7 Y+ S0 J& C
- end
. l- W3 I# s0 [, J0 C - flytext.clips:clear()2 a4 ~- w9 o9 ] L6 ?
- while dechp >= 1 do9 O' n. }) L) n( F
- flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*28)
7 P/ w4 |, ?( G& a- d; m - dechp = dechp / 10
1 M( N7 Q5 G% t - end
0 n" J4 [) t0 q3 i0 ` f - flytext:setBatchClips(10, flytext.clips)# D/ P6 V* j. z# A
- flytext:setOffset(-28+flytext.clips:size()*14, -50)
' d7 }4 M; I9 }" d: ~9 w. e - if not flytext.minus then
7 v4 y; p2 f9 Q9 @ - flytext.minus = F3DImage:new()
! z- F0 @* b3 q: V' @" [4 k+ R; { - flytext:addChild(flytext.minus): ^+ p6 d- h% u6 Z: }6 l7 U7 L
- end
. U1 a; |# y3 O( B) L: { - flytext.minus:setTextureFile(UIPATH.."公用/fight/criticalFlag.png")
: b: M% v. `% O& r6 I1 X- p1 f - flytext.minus:setPositionX(-(flytext.clips:size()-1)*28-55)8 W7 T s+ c3 @- w& A" T
- flytext.minus:setPositionY(-5). R0 o z$ ^/ }- F5 u% |8 ~
- flytext.minus:setVisible(true)
3 w) a# M! u4 e4 o - else+ |- N3 C0 T! Z, C7 `
- flytext:setTextureFile(UIPATH.."公用/fight/otherHit.png")
# R4 Y) [2 `1 k7 F9 H6 X1 i. W - flytext:setWidth(22)& w% T$ f6 j/ I' p1 [4 @
- if not flytext.clips then! R$ i. u8 T) R# ]6 O0 F7 O
- flytext.clips = F3DPointVector:new()/ ]8 Z2 {) t9 X7 T6 O
- end
5 @) X% M8 @: p, D+ F; g - flytext.clips:clear()
7 N2 Q7 e$ A* F! Z1 D - while dechp >= 1 do* P0 \3 w( E; _; D' F
- flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22). y/ S! C/ t. }- R- t8 z( i; {
- dechp = dechp / 10
! Y' ?) h* c. @5 w0 L5 P - end4 |( M& S9 B$ t. t
- flytext:setBatchClips(10, flytext.clips) d$ `" F* t/ U* U
- flytext:setOffset(-22+flytext.clips:size()*11, -50)
* V- G8 P" s7 G0 o/ g2 T - if not flytext.minus then
$ Z: a9 _2 q! O - flytext.minus = F3DImage:new()
* c' @) J2 N& P4 B - flytext:addChild(flytext.minus)8 P8 A0 G, i* P; A
- end' h, l9 e: O# a1 ^0 C! E) m! b8 b
- flytext.minus:setTextureFile(UIPATH.."公用/fight/otherFlag.png")
' r+ Z1 i( u% g9 w - flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-17)
Y3 S1 | c0 T i# j* A1 r - flytext.minus:setPositionY(12)' ^) f" _+ C( R2 Y4 h( ^6 V
- flytext.minus:setVisible(true) o) r7 m' Z' ^, u2 _
- end
& t9 V7 b$ g3 V9 W% k5 i- n$ _# P! O - flytext:setPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 10)% e$ C$ d' }+ t% L4 K p( c
- dechpcont:addChild(flytext); w4 X. @. R2 h" J, A
- m_Flytexts[flytext] = 14 @, |* G7 `) K* J1 z/ E
- local prop = F3DTweenProp:new(). b0 p6 |& `0 |' g) C8 N
- prop:push("offsetY", -100, F3DTween.TYPE_SPEEDDOWN)" V: L8 z- J$ n7 m( o+ r3 H6 O
- prop:push("alpha", 0, F3DTween.TYPE_LINEAR)
3 `4 q6 M- b" z1 {: e# T# N& p - F3DTween:fromPool():start(flytext, prop, 1, func_n(function()
$ x4 M& E: ~ ~% p' |) k" O# Q - pushFlytext(flytext)--flytext:removeFromParent(true)
: q6 F: |# J+ ?7 T - end))
' B# ]& `; F. Z; b$ d- ?% e0 o- Z }5 ~ - end4 O( I- J; s: ~3 A- }3 X( e3 J5 G
- hpbarpool = {}
' O, d: w7 O7 e8 t1 O0 w$ J$ L - function removeMergeHP(hpbar); A! K* {& p! m& N$ l1 m
- if hpbar.mergehp then
# p2 A' \ Q( }/ { - for i,v in ipairs(hpbar.mergehp) do
/ t* W+ r1 |3 |! @9 F. y - v:removeFromParent(true)
2 E4 x1 c4 \( i - end
2 r0 E9 q1 X, z/ W2 I" u- q6 @. ~ - hpbar.mergehp = nil
: e9 w2 m n1 B( y* {1 n6 o8 \8 } - end( O- w0 `% n8 S0 D) h
- end
0 t% W, [# `6 m0 R+ d8 m7 k - function createMergeHP(hpbar, hp, hpmax, mergehp)! J. V5 G% q$ \7 I0 K6 M8 W$ t
- hpmax = hp
4 t& J% b7 h( G - for i,v in ipairs(mergehp) do' v4 B% K2 s- i% f# X
- hpmax = hpmax + (i == #mergehp and v.hpmax or v.hp)
* u$ N3 K) D7 q! g - end
% i4 B) d# g) ~6 N# n' M - local perc = hp / hpmax
0 t! r/ H, V: w6 V1 s# G - hpbar.hpimg:setWidth(hpbar.track:getWidth()*perc)
1 `5 L* p1 i) e" }/ D1 s - hpbar.mergehp = {}$ S, D! U1 `6 G/ O& ?
- for i,v in ipairs(mergehp) do2 c$ |+ g7 E: R$ D/ t) p
- local hpimg = F3DImage:new()7 b! E& T# j) E
- local pc = (i == #mergehp and v.hpmax or v.hp) / hpmax% V/ U7 a0 p$ E# s; ^
- hpimg:setTextureFile("tex_white")* s" `8 P1 _# U) f
- hpimg:setWidth(hpbar.track:getWidth()*pc-1)' p U7 Q3 n- S: v. [$ ]. }
- hpimg:setHeight(hpbar.track:getHeight())
) q* O# h5 D0 y* u% N' q3 R1 C - hpimg:setPositionX(hpbar.track:getWidth()*perc+1)
* C' y J- p/ a: W* e$ K - hpimg:getColor():setRGB(v.color)
6 U$ `2 z* ~& S i - hpbar.track:addChild(hpimg)
& L' m/ h5 ]7 _2 n( L0 M - hpbar.mergehp[#hpbar.mergehp+1] = hpimg# y$ E3 M/ m% ^5 a4 F# Z
- perc = perc + pc: V k" |& e( o5 }+ w
- hp = hp + v.hp$ _# W1 s0 y/ B O8 }. c9 k: f' o8 E
- end m8 z3 A# v) p) L2 @9 L" [' w! g( _
- return hp, hpmax8 n9 _$ S3 m2 W# V
- end
; \% d Q1 C. \' M9 r! A - function onHpBarInit(e)6 L! M2 W. m) A9 l2 D
- local hpbar = e:getTarget()
( p( y- F" a6 D - hpbar.name = hpbar:findComponent("name")
- j5 s' ~" X) ~6 d - local ss = 实用工具.SplitString(hpbar.v.name,"\") H/ @: R8 [7 o. y' t( H5 V
- hpbar.name:setTitleText(txt(ss[1]))* ?' d) E* J3 Y U/ _
- if #ss > 1 then& |6 [' j" j5 Z* d8 z0 e* x
- hpbar.nameexs = hpbar.nameexs or {}
) T0 ?3 n4 _; m- j1 \& D - for i=2,#ss do( f2 H. O7 z! z3 v
- local tf = hpbar.nameexs[i-1] or F3DTextField:new()
3 N/ ?4 t* z# j - if g_mobileMode then0 g# ^ u) P- [8 s' ^* [
- tf:setTextFont("宋体",16,false,false,false)* I1 U2 N, I3 C
- end
; f" |% Y$ r7 S$ L2 ?6 C/ h - tf:setText(txt(ss[i])) i9 W# B/ C: d" j! G% K' u
- tf:setTextColor(hpbar.namecolor or 0xffffff,0)+ Z B$ d! O4 B4 f; i
- tf:setPivot(0.5,0.5)
; D9 h( q* x! O5 [8 a! P' t& y8 G - tf:setPositionX(0)! _" \9 @' q4 g3 a( e8 s
- tf:setPositionY(50+(i-1)*14)+ X1 V8 l1 D/ a
- hpbar:addChild(tf)# f: K/ F- i4 M$ {
- hpbar.nameexs[i-1] = tf- I) n! Z; [1 Y W
- end( A. U' ]: G3 z0 M* ]
- end+ b2 `$ o, r9 t: D. v8 |" [
- hpbar.name:setVisible(hpbar.showname)
+ R3 O4 O5 J% C: A0 Z' \ - hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)
0 w+ l$ G& X( O$ V0 I - hpbar.guildname = hpbar:findComponent("guildname")
/ c U3 p- M: _- z - hpbar.guildname:setTitleText(txt(hpbar.v.guildname or ""))
% g0 n( g" w, U8 ^: h$ o - hpbar.guildname:setVisible(hpbar.showname) v" l' r9 I: n+ O5 ?. y
- hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)* p2 N {# ^0 F6 L
- hpbar.pro = tt(hpbar:findComponent("hpbar"),F3DProgress)
$ H. M5 Q/ p; v( L9 ~; v7 |5 F - hpbar.track = hpbar.pro:getTrack()
& E {+ N' }. O* C) f3 g - hpbar.hpimg = F3DImage:new()( l6 l3 H8 T- U# t" l) O% x
- hpbar.hpimg:setTextureFile("tex_white")3 i% T/ l8 B( h; g, l
- hpbar.hpimg:setWidth(hpbar.track:getWidth())6 F4 ]0 t' M- L/ s
- hpbar.hpimg:setHeight(hpbar.track:getHeight())
% K6 S4 N9 x: i - hpbar.hpimg:getColor():setRGB(hpbar.v.color)
3 n# w* D( B, d4 n - hpbar.track:addChild(hpbar.hpimg)' B) v" x, l8 P. z
- local count = F3DTextField:new() --创建一个文字7 g) w3 T# {- N
- count:setPivot(0.5,0.5) --血条文字改为居中. |) X% m2 }' i
- count:setPositionX(20)--变更一下血条x位置
: \3 n2 U2 @$ J - count:setPositionY(-10)--变更一下血条y位置
# G. }- O* Y' ^ - hpbar.pro:addChild(count)--跟名字绑定
' D8 h: V' ]% X4 X s) ^* }/ w - hpbar.count = count --方便下面随时修改血量: C D: @* _3 K' G3 H8 l
- hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp.."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改
9 k- x `- @2 ? \. D9 L - --hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp .."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改7 |" p; g6 |, S. O! A! @
- if not hpbar.v.mergehp then1 u8 E) @0 _4 [7 I1 l2 g
- hpbar.mergehp = nil
8 \# j8 }0 `+ | - hpbar.pro:setMaxVal(hpbar.v.hpmax). v4 r& v6 h E5 R
- hpbar.pro:setCurrVal(hpbar.v.hp)4 J( E7 \" m7 q
- hpbar.pro:setVisible(hpbar.v.hp > 0)
1 a5 T( w) o5 E- H - else! q/ M5 u5 F2 e1 c
- local hp, hpmax = createMergeHP(hpbar, hpbar.v.hp, hpbar.v.hpmax, hpbar.v.mergehp)3 \9 E1 | z& \+ {
- hpbar.pro:setMaxVal(hpmax)) U3 `9 S, H: m
- hpbar.pro:setCurrVal(hp)
' j) x/ S& u0 @5 Z8 C" ^8 h - hpbar.pro:setVisible(hp > 0)
% Z# n; R$ i/ H/ r - end3 D, V$ T! {! F- u( n) w: {3 D
- end7 W+ |6 m% ^: C' d: h
- function setHPBar(role, hp, hpmax, color, name, mergehp, showname, guildname, namecolor); p0 B `# R4 C! [" O9 i8 P
- local newcreate
- e) b7 {8 a3 s - local hpbar
/ y9 G" g4 X" D# B- S - showname = showname or 显示名字 == 1! U; b; A7 _8 P2 `( a
- if role.hpbar then6 [& P; ]2 d# }9 p+ }' u5 h, j
- hpbar = role.hpbar' T1 S; g; b+ p% x- k3 v. ?/ K
- hpbar.showname = showname; F; g( s" [9 u7 b
- hpbar.namecolor = namecolor% g, J' |7 s. U% ^& s L- M# ?; @
- else6 [/ W6 `6 o& e' ]. n# C
- if #hpbarpool == 0 then$ c0 m! P- G7 g: j9 T" z9 `, Y
- hpbar = F3DLayout:new()
. U7 k" g1 Y$ s) a9 ` - hpbar.showname = showname
5 w C1 `/ K( A0 w - hpbar.namecolor = namecolor
2 h+ B0 }+ Q: g) n* o) s - hpbar:setLoadPriority(g_uiFastPriority)
* e H$ j( g# l4 M - hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}
/ C9 w9 [2 V5 ?2 i - hpbar:addEventListener(F3DObjEvent.OBJ_INITED, func_oe(onHpBarInit))
A$ A. D* c) P- x" E7 @ - hpbar:setLayout(g_mobileMode and UIPATH.."血条UIm.layout" or UIPATH.."血条UI.layout")--IS3G and UIPATH.."血条UIn.layout" or
/ j5 w7 C$ k' ^' h- g - newcreate = true
7 |! N, V* ?! D s - else/ ^& L8 ]( ~: i6 t
- hpbar = hpbarpool[#hpbarpool]
$ `3 y' W# I7 b' z- t" l' I - hpbar.showname = showname
( U3 c _# o i- E6 p - hpbar.namecolor = namecolor
7 ^* P+ `1 d/ } E - table.remove(hpbarpool)9 f" S0 E E5 H# w% ?- v/ ?
- end
p3 S! U' o# w1 j - role.hpbar = hpbar+ u* r2 x% ?- E6 C0 \2 s
- hpbar:setZOrder(-role:getPositionY())
7 v1 g; e$ J7 i0 S! |" [% U - hpcont:addChild(hpbar)
. E3 i' v2 P5 e3 ]+ }& v8 @ - end: P% Z7 G7 w* e' ]. A7 N
- if newcreate then
' t1 z" F6 M2 h. _8 L \- x - elseif hpbar:isInited() then
4 D3 t: Z: G. p0 ]/ x - local ss = 实用工具.SplitString(name,"\")* v. `6 z. I2 X
- hpbar.name:setTitleText(txt(ss[1]))
' R! ^- c9 Y& q, V - if #ss > 1 then+ k6 R9 E" c) r4 b* ?8 T5 B
- hpbar.nameexs = hpbar.nameexs or {}( C: ?6 E& R0 H) `2 D
- for i=2,#ss do
% n+ x, }* N( u! r7 w% a - local tf = hpbar.nameexs[i-1] or F3DTextField:new()
* N. u9 I7 P3 H6 @( r6 b - if g_mobileMode then
1 w8 `) T9 {0 M4 l - tf:setTextFont("宋体",16,false,false,false)
8 g: A1 q K. u' R) J" Z - end
, b3 ]2 p2 Q. M* Q ]7 X8 @* c - tf:setText(txt(ss[i]))
4 u1 a7 t" b: H5 R2 u# e! S' G3 O - tf:setTextColor(hpbar.namecolor or 0xffffff,0)
6 f; f9 ]3 |7 ]5 q: H - tf:setPivot(0.5,0.5)
+ f3 C! ~4 \2 M" f - tf:setPositionX(0)
' T2 C* ]1 L9 K. C8 r2 x - tf:setPositionY(50+(i-1)*14)
8 j+ P1 u) f4 k* u, V# [. U& @ - hpbar:addChild(tf)/ o9 m" i& J( \+ b S: Z# }
- hpbar.nameexs[i-1] = tf( [$ w& m2 w' U. L# q! q2 D% h
- end
+ l7 S5 M0 k9 T% G( A) a9 w& A& Y6 G - end1 [4 s. w7 c! S" K4 ?. `
- hpbar.guildname:setTitleText(txt(guildname or ""))
, R% Q' W9 z! f/ z5 g - hpbar.name:setVisible(hpbar.showname or role == g_hoverObj)+ w6 P! I" `+ f6 l% a* G1 [ M" Y ~
- hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)9 \4 z% Y) X# f8 }# @5 L' p
- hpbar.guildname:setVisible(hpbar.showname or role == g_hoverObj)6 h, w# S9 `: A1 A4 ]
- hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)% g6 s. B0 [& K
- if not mergehp then1 Y) p4 Y, K/ `
- removeMergeHP(hpbar)$ W0 D2 O2 J% w- I- S# Y) ^9 ~
- hpbar.hpimg:setWidth(hpbar.track:getWidth())0 i9 h% b: O# }9 U
- hpbar.hpimg:getColor():setRGB(color)
7 ?1 D& B# I1 P& D! A - hpbar.pro:setMaxVal(hpmax)
! c2 |6 p* Q- ]# o1 p - hpbar.pro:setCurrVal(hp)
0 d' ?. ~- O, ` w6 z0 A5 b$ U - hpbar.pro:setVisible(hp > 0)0 y3 y n, N7 j( Z; W7 v! n
- else# u& H! U0 B: L6 ?. t
- removeMergeHP(hpbar)
8 Q+ l9 W2 X2 c; e9 |; n - hpbar.hpimg:setWidth(hpbar.track:getWidth())! W K- S, u4 q6 m: s( R7 g8 D
- hpbar.hpimg:getColor():setRGB(color)
- Y$ l9 x b" \6 V' g" [ - hp, hpmax = createMergeHP(hpbar, hp, hpmax, mergehp); \$ N- u0 b3 Y/ z8 t- p
- hpbar.pro:setMaxVal(hpmax)
; b2 n" c8 S. C& g - hpbar.pro:setCurrVal(hp): t0 g# e/ f! a0 k- N
- hpbar.pro:setVisible(hp > 0)
1 {: C9 X& ?1 x. Y) s# l3 i, C - end
! u/ p& i# n7 J' e - hpbar.count:setText(txt(hp == hpmax and "" or hp.."/"..hpmax))7 M, x5 f; g; F7 y; R
- else/ S. p: ^- t/ H8 ^8 T
- hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}
! z: M6 b! F! E9 w - end
8 t( ?3 ]3 `4 r2 @7 K2 d9 q- m - if not role:isVisible() or (hp == hpmax and not mergehp) then
. n8 I/ P7 X! g6 Y9 C - hpbar:setVisible(true)--false)
8 B' d- s$ O% A1 Y - else" z$ b* E7 T- s+ p+ L# C( o) o' O! f
- hpbar:setVisible(true)' H. n% x3 X5 d% Y
- end4 ]+ N z3 F+ z$ T8 q
- end
" |( m! K, s; p* M. ^ - function delHPBar(role)/ \( s( @ s6 _5 {
- local hpbar = role.hpbar
% b8 e4 n0 T, N1 g3 T - if hpbar then
$ J1 @; M) B9 |* F - hpbar.showname = nil
$ w9 Y! C! d/ G& L% R - hpbar.namecolor = nil% \0 l& P7 S4 s& Y) \
- if hpbar.titles then( M4 f2 E* m! S7 V; E) _
- for i,v in ipairs(hpbar.titles) do& x. p* O R0 k5 g2 M5 d
- v:removeFromParent(true)4 z* q. I3 q1 j2 o
- end4 S4 d1 h' j& [
- 实用工具.DeleteTable(hpbar.titles)
3 H) h4 |1 @& }- t- S" O - end
* g C7 G3 t& `: D) g - if hpbar.nameexs then$ _; S4 ~0 k3 z9 C; W8 u1 e$ S6 W
- for i,v in ipairs(hpbar.nameexs) do
- y5 t3 {+ x" n* l2 Z& W - v:removeFromParent(true)
/ i1 e% p. P2 C6 z- J! f - end6 A1 P* b! d6 O& R" E
- 实用工具.DeleteTable(hpbar.nameexs)
7 y0 |3 T/ ?- P4 ^/ u: j2 `, w - end
?0 h5 v3 e) j" d* p9 w - hpbar:removeFromParent()
- [0 t2 e( [5 S5 d4 c- w - hpbarpool[#hpbarpool] = hpbar: r) ~1 A* i M6 x6 c
- role.hpbar = nil& B3 v1 M% ? D% u& j
- end
( \$ f7 r; ~! E0 _ - end
. g% I9 m5 K6 b" _& H( x% T - function updateHPBar(role)0 R8 M7 j1 a2 n1 D8 M5 s/ q$ }* l
- local hpbar = role.hpbar9 j: Y' N) i. G' O- d
- if hpbar then
) i: L1 R' w3 r) J5 I5 k* @ - hpbar:setVisible(role:isVisible()). w A2 |+ w- o( J
- end
2 U! f) w1 R9 a. ?9 |/ u - if hpbar and hpbar:isVisible() then' B" `: z& ^6 v
- hpbar:setZOrder(-role:getPositionY())
# }6 |5 x) d J" A( b0 ` - local pt = F3DUtils:getScreenPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 20)( a+ Q8 {8 o6 A3 L4 x) m% Q. }
- if pt then
+ c5 S8 w# ?9 L - hpbar:setPositionX(pt.x)- w+ @) ~/ C, s( n* S5 L9 o
- hpbar:setPositionY(pt.y)
: U9 a( Q7 z. e( }; { - end
/ i+ e3 |) f; |+ ~8 X: B" z4 o - end2 n E! F$ B9 h- {: t2 p
- end
复制代码 + q0 N/ C6 L/ P! E) e
8 q4 o' z; y' u+ O6 W: a
|
|