|
平常他是不显示的,默认的是只有血条,没有数字! ) Y: L# G: u! H" C- s
+ J" T, B; p$ I1 N [1 e4 B如果想让他这样显示按照下面方法做:
6 I( i- b) M- V0 _: j9 j2 L) o0 I$ v$ V8 I. }3 m+ U
把下面的lua脚本复制到你服务端 & i9 |, ?$ B# [
4 a% Y2 y2 w) z2 N! u
\龙途\Flying3D\scripts\模块\主界面\主逻辑.lua
" W. P/ v! o' k- K4 `( f3 g5 Y
, _9 V- \ s$ w6 M; I; ?& i里面全部覆盖,注意是全部覆盖!
- J$ S0 `/ U! E2 W# {' T9 @" R/ A1 d
然后重新打包pack 5 T' Y; n R* B0 p) A
- module(..., package.seeall)
# C! I0 z% m# b7 F# h! V - local 实用工具 = require("公用.实用工具")
# v7 G$ {; Z6 w5 v f - m_FlytextPool = {}; ]% s. z& x) }" ]
- m_Flytexts = {}
3 ?$ a9 _- [1 q: o! w - function pushFlytext(flytext)
9 R. u; f/ ?4 D# A - if flytext.minus then
^. ?% N O! j4 k8 h8 r - flytext.minus:setVisible(false)
( |9 J" _8 K' K7 ~: a. G - end
; D6 U8 Z" N% B/ P - flytext:setAlpha(1)
! {; P/ S- W" G6 v" @2 F - flytext:reset()* b* p8 Y1 x% e. w( b9 `
- flytext:removeFromParent()3 f! G% H( T' i5 m8 o' ?
- m_Flytexts[flytext] = nil0 u4 o) v% X6 Y" h
- m_FlytextPool[#m_FlytextPool+1] = flytext
) T5 s) J/ N- V% Y' L - end, H, ] V+ X2 l* J U
- function popFlytext()
7 c: A+ H" o L% Z5 y: e6 O6 L+ R - if #m_FlytextPool > 0 then
* g/ l- ]! r% p* h, R. }- T H( s S5 g - local flytext = m_FlytextPool[#m_FlytextPool]
& T% j" T w P6 T/ o0 U5 Y6 p - table.remove(m_FlytextPool, #m_FlytextPool)4 _2 i& H% K) a3 e& x3 ^' R
- return flytext8 W* ^" `4 y) ?0 R: j$ R w) i3 J( S
- end
1 C! {' a& I: W* H' j3 m4 b* J9 [ - end
) s5 v9 f" i# K" u! @- [ - function showFlytext(role, dechp, crit)
8 U: P* Z# o7 q! |! M% K1 n8 D - if 1 then
& E+ W4 q# w* C( T4 x, p/ B - return$ Z5 r& b# G) w. U5 r1 t+ X# `
- end2 I3 d# S- t* m w8 D$ H; Z! b2 j
- local flytext = popFlytext() or F3DImage3D:new()
" W3 r- g$ F- f" |9 W. h1 C# r' b - if dechp == 0 then% G5 _( f! T6 S$ Z2 b9 S
- flytext:setWidth(0)
8 N; m( T/ \) a, l6 r - flytext:setTextureFile(UIPATH.."公用/fight/miss.png")
; {; b g0 z9 i' r+ h$ @! h - flytext:setOffset(-52, -35)0 g* ~3 u# K" J' e" g
- elseif dechp < 0 then
[8 @$ {6 C/ V k% f - dechp = -dechp" t( w9 G% ?/ I9 }* ?3 S+ A
- flytext:setTextureFile(UIPATH.."公用/fight/addHit.png")
' V' U0 ?$ I- @( C7 n% j' d - flytext:setWidth(22)" c e5 v$ P3 {4 U; g
- if not flytext.clips then
2 H( [% d, o* }1 W- O - flytext.clips = F3DPointVector:new(), Z e& {/ S0 x3 x* e+ y
- end
L, _3 O6 r9 V. o$ g; I% p - flytext.clips:clear()
' D0 z! B% \ J - while dechp >= 1 do: h3 j) i% k2 g" h$ a
- flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22)8 i* E9 A/ M) M
- dechp = dechp / 10" d/ g7 Z% I+ \1 A7 \* v. x' i( S# Y
- end1 |2 W. y6 T. W
- flytext:setBatchClips(10, flytext.clips)+ @0 F* z2 d& F5 T. H/ M+ N0 `
- flytext:setOffset(-22+flytext.clips:size()*11, -50)
) U& Q7 ^, M: U( | - if not flytext.minus then% \/ K6 `4 }/ Q1 L* g# w
- flytext.minus = F3DImage:new()! ?$ I/ @6 O! n+ U
- flytext:addChild(flytext.minus)8 G5 j& k1 ?8 @ L5 S! U0 Z
- end! ~$ M2 f+ X0 X( _: O# x
- flytext.minus:setTextureFile(UIPATH.."公用/fight/addFlag.png")& j4 G5 h( q! F: F
- flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-27)
! H) E9 x9 z3 O( W6 C - flytext.minus:setPositionY(4)
" \% b v/ y' H- D _7 l+ o/ y - flytext.minus:setVisible(true)5 b" d5 X% y0 V6 h; n
- elseif crit == 1 then
% ]7 X8 b V5 s7 ?; g/ | - flytext:setTextureFile(UIPATH.."公用/fight/criticalHit.png")# m ?; E' \ C+ N | Q
- flytext:setWidth(28)
. ~7 l1 `8 H) U$ _ - if not flytext.clips then# q2 C b; F) @$ B
- flytext.clips = F3DPointVector:new()
3 Y, F/ {; h+ p% }+ l: W8 k5 C - end
! n' ^% F5 {6 \: y# N9 r' @ - flytext.clips:clear()
% t6 O; [* |. A( Q d - while dechp >= 1 do
' J! Y/ ?7 u2 R' K3 H: d$ L# Q - flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*28)
]; E. |+ B. Q1 f - dechp = dechp / 10
& t: u3 e3 c% U( M6 w - end
) T* ^9 j5 V8 L - flytext:setBatchClips(10, flytext.clips)( @9 b; u5 k1 u' d: t3 p( s
- flytext:setOffset(-28+flytext.clips:size()*14, -50)
, C0 r1 w3 f* t4 l - if not flytext.minus then
' I9 l* w4 W. a* m5 H - flytext.minus = F3DImage:new()+ ^' K% N. o9 z1 A/ x
- flytext:addChild(flytext.minus)
' L" G) r8 g8 h R( P: J0 Y - end
& }/ x/ Y; |$ g+ [4 B - flytext.minus:setTextureFile(UIPATH.."公用/fight/criticalFlag.png")% {& k6 z9 Q: @* r
- flytext.minus:setPositionX(-(flytext.clips:size()-1)*28-55)
. W" G+ q+ ~# e - flytext.minus:setPositionY(-5)1 G; F0 q8 o8 i. s8 B D b
- flytext.minus:setVisible(true)! H( Z: x/ G; p! ]- l9 |
- else
$ S7 ?: U* N. h! m3 o - flytext:setTextureFile(UIPATH.."公用/fight/otherHit.png")
( X Y t2 N. n) i& [" e - flytext:setWidth(22)
2 z# }8 u2 K8 l! f: X. ` - if not flytext.clips then! j. e% Z7 m% m% S* I
- flytext.clips = F3DPointVector:new()$ C6 I# \- g2 d6 H4 o C! V: B! R
- end
( u+ F1 ~3 ~+ l! I1 J" l - flytext.clips:clear()5 E. A% Z# W% Q
- while dechp >= 1 do! r8 ~1 a! L; r4 J/ ^! O* V V
- flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22)
% G: f: j, ^& Y0 M - dechp = dechp / 10- L$ s+ F. z" }4 k& u* ^
- end0 K7 i0 L9 f# E/ p$ k. s; |
- flytext:setBatchClips(10, flytext.clips)
& D% x& Y- B- V. k' T0 o6 Z - flytext:setOffset(-22+flytext.clips:size()*11, -50)
/ }) x. D( A4 q& I - if not flytext.minus then. p& b" G+ s" I0 v5 N+ k- M
- flytext.minus = F3DImage:new()$ k, v( `0 D2 @5 ]- w
- flytext:addChild(flytext.minus)2 R9 g; B" o) u) p& ?; ]
- end
; O) r: G0 k+ Z% w - flytext.minus:setTextureFile(UIPATH.."公用/fight/otherFlag.png")! x ~& I# p' i, ?) B& U
- flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-17)7 G% ?: p% J9 F' B% n3 @
- flytext.minus:setPositionY(12)$ N( v$ g# ~: x% S: U# _
- flytext.minus:setVisible(true)' K. |4 G1 D! _6 P6 ^
- end
: o4 g9 |3 }# Z; V @ - flytext:setPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 10)
$ Y X. y% n9 j& W z$ G - dechpcont:addChild(flytext)
x& y9 A/ r7 Q: Q - m_Flytexts[flytext] = 1
( Y! |9 q! O7 M% O - local prop = F3DTweenProp:new()
% n% c, i/ S# N0 g1 N - prop:push("offsetY", -100, F3DTween.TYPE_SPEEDDOWN)0 i& o- E8 K+ W% `
- prop:push("alpha", 0, F3DTween.TYPE_LINEAR)
: w! A6 J; ?% ~# x - F3DTween:fromPool():start(flytext, prop, 1, func_n(function()
( ~7 | g: s0 B8 N1 o4 L5 z - pushFlytext(flytext)--flytext:removeFromParent(true). [* a' u' l7 ?9 _* N" V+ A. [( j
- end))
, m2 Z b! j7 z: L& [( n/ } - end4 C6 N: l: e0 h+ o+ J( B
- hpbarpool = {}
0 B. I. ^8 D, V7 x* U4 C - function removeMergeHP(hpbar)
# M/ a! S, a6 R9 j' a; r - if hpbar.mergehp then% t1 ^8 C' }: n) E( _) |
- for i,v in ipairs(hpbar.mergehp) do9 z) v' a9 Z5 ~4 i2 \9 m+ S0 f, L
- v:removeFromParent(true)
+ \1 b6 |9 @0 D1 J( b* G' W& C. [( D - end
- G$ q. B# L7 R7 ]% E2 T, f3 a - hpbar.mergehp = nil" E' Z' ]7 `8 m5 b" K' `6 M' ` D. U
- end* H7 {# G) C1 m% G
- end
9 e( x, |& ?3 A& z( ]8 {) ^ - function createMergeHP(hpbar, hp, hpmax, mergehp)
& R- x6 r* a8 l) ]' t - hpmax = hp
% B; A4 D" J# ]$ F! X' Z: ?5 M - for i,v in ipairs(mergehp) do
0 a3 x) ?: u4 d - hpmax = hpmax + (i == #mergehp and v.hpmax or v.hp)" l( P% h5 }3 R C, E1 J0 s: C
- end
# {( K( G6 d0 z5 ?. D f - local perc = hp / hpmax
5 j% I( l- o& ~3 Y( k) L6 E; N5 l - hpbar.hpimg:setWidth(hpbar.track:getWidth()*perc)
: ~" B! a) }* c4 x q2 p, f - hpbar.mergehp = {}4 ]9 N. h6 h2 @5 O
- for i,v in ipairs(mergehp) do, k; c* F" I' |- ]
- local hpimg = F3DImage:new()' B5 B. Y$ b$ K1 Z2 j2 z7 C
- local pc = (i == #mergehp and v.hpmax or v.hp) / hpmax* J+ A7 r4 c7 R7 j, A, I/ q2 z. t
- hpimg:setTextureFile("tex_white")
$ _. x; ?; s( u! _$ E" r d - hpimg:setWidth(hpbar.track:getWidth()*pc-1)
2 l# }3 }# y5 D- k! a8 s. g( B - hpimg:setHeight(hpbar.track:getHeight())
3 W2 ?8 i* s9 u; w: y( w5 G: Q - hpimg:setPositionX(hpbar.track:getWidth()*perc+1)
/ Z @7 v: l) X) e# x/ s X# T - hpimg:getColor():setRGB(v.color)
. y; Q( h4 z3 w/ H0 W$ \9 g( s9 G - hpbar.track:addChild(hpimg)
# n- {- J+ B, d1 g - hpbar.mergehp[#hpbar.mergehp+1] = hpimg
7 p" P" c8 d3 C. ?' i4 J2 f k+ E - perc = perc + pc
" F1 v& H) o0 p - hp = hp + v.hp' Y8 N2 V9 e3 o
- end* W* o. H: V* d1 v! g( F; p
- return hp, hpmax
- w& [( M9 ]* z - end: S& S1 t4 U8 Y7 e8 L# x
- function onHpBarInit(e)
6 F7 a9 ^5 ?/ C$ } - local hpbar = e:getTarget()
& F) W6 x8 y! ]2 F! M7 s8 Q - hpbar.name = hpbar:findComponent("name")
' L i- W2 l3 `0 q - local ss = 实用工具.SplitString(hpbar.v.name,"\")3 p/ F: c9 O4 F
- hpbar.name:setTitleText(txt(ss[1]))( V3 Q: W1 |; O
- if #ss > 1 then4 d$ O9 D m3 L2 |
- hpbar.nameexs = hpbar.nameexs or {}
$ n* e, j! Q" C+ G; M& n5 n' D - for i=2,#ss do
5 D; L7 k6 \+ e# Q" w, [3 j/ g - local tf = hpbar.nameexs[i-1] or F3DTextField:new(): I0 e% i, w6 `% G) t
- if g_mobileMode then
$ L. D! X+ [% W8 J9 }# c - tf:setTextFont("宋体",16,false,false,false)
^; W4 X( t1 ]/ e: _* x - end
0 z7 p9 |$ j* y( l0 V2 c) i7 j5 g - tf:setText(txt(ss[i]))
2 n/ x T& I9 h; w$ ` - tf:setTextColor(hpbar.namecolor or 0xffffff,0)7 V; h, B# D$ [$ P. ^. E! l. P# m
- tf:setPivot(0.5,0.5)
% q! { P1 c: M8 l# Z - tf:setPositionX(0)
& Q, F& p% o/ }, e - tf:setPositionY(50+(i-1)*14)
$ g+ [% Y- v/ d1 I' Q - hpbar:addChild(tf)
: _' M' ^* q& e( J8 _ - hpbar.nameexs[i-1] = tf: S; v2 L. Z) n3 G
- end+ O b' J o! Y) g2 ~; D3 g) X
- end
2 W. T! `" v- D M0 Y - hpbar.name:setVisible(hpbar.showname)' |. r/ W0 Y: a0 v# t( B9 Y
- hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)
* z4 t6 a+ o- J( \2 { - hpbar.guildname = hpbar:findComponent("guildname")
# [ ~, o- G2 o4 V- b; k - hpbar.guildname:setTitleText(txt(hpbar.v.guildname or ""))
6 Y& `- j9 S6 v - hpbar.guildname:setVisible(hpbar.showname)
0 q x1 v) [9 @. a - hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)" u4 r$ Q& {/ f2 s7 E6 k. ~: }
- hpbar.pro = tt(hpbar:findComponent("hpbar"),F3DProgress); K0 z }+ c( w! @& Z+ J% _
- hpbar.track = hpbar.pro:getTrack()
( i$ I$ [+ u0 W. W5 P - hpbar.hpimg = F3DImage:new()
# o o! s4 a' T' \ - hpbar.hpimg:setTextureFile("tex_white")% w0 _2 ~; {7 C* ]
- hpbar.hpimg:setWidth(hpbar.track:getWidth())
8 ?/ W# C: h6 U+ N0 q' K8 u2 Z - hpbar.hpimg:setHeight(hpbar.track:getHeight())5 j. `/ @4 q+ }3 w
- hpbar.hpimg:getColor():setRGB(hpbar.v.color), t' }, G- V9 n/ h+ p5 x2 U
- hpbar.track:addChild(hpbar.hpimg)2 C! z4 {( ^ G& L2 l
- local count = F3DTextField:new() --创建一个文字 j) G4 X. M( a K6 ]" ~; F
- count:setPivot(0.5,0.5) --血条文字改为居中
* |# F, ?5 c# |/ ]. v" ? - count:setPositionX(20)--变更一下血条x位置
7 b& P* r9 N. u3 q& Z* s+ W; [ - count:setPositionY(-10)--变更一下血条y位置
! B& ?9 ~- Z+ f2 F5 _ @ - hpbar.pro:addChild(count)--跟名字绑定6 l1 |! j4 w8 y
- hpbar.count = count --方便下面随时修改血量
; P$ m7 V& G+ @1 Q - hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp.."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改
. i! R! {4 |3 h - --hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp .."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改
8 Y" v: T7 k6 U C - if not hpbar.v.mergehp then
# r' V' O* Z( b9 k - hpbar.mergehp = nil
J3 _3 }4 @5 |( P - hpbar.pro:setMaxVal(hpbar.v.hpmax)
; \% x; A6 B$ Z% U - hpbar.pro:setCurrVal(hpbar.v.hp)
, M e3 W6 ?# h6 J; \. k1 q - hpbar.pro:setVisible(hpbar.v.hp > 0)2 [* _! w$ D" \# }: Q4 N
- else
% V, I, v7 A. } - local hp, hpmax = createMergeHP(hpbar, hpbar.v.hp, hpbar.v.hpmax, hpbar.v.mergehp)
9 |( V" N; s- \( r - hpbar.pro:setMaxVal(hpmax)
# `) l. G% L' X1 f - hpbar.pro:setCurrVal(hp)
# g. P! ^( j, h4 O& a9 J - hpbar.pro:setVisible(hp > 0)) Z _+ @; e1 h/ k7 N7 H2 \
- end
4 j. H4 N+ Z! j) p' M - end
9 y+ N3 W1 A3 @3 D6 W4 ?! P - function setHPBar(role, hp, hpmax, color, name, mergehp, showname, guildname, namecolor)0 ~) f; d( w8 L& I
- local newcreate9 R( @: k( x6 A- A* h) G8 u7 A+ S7 ~
- local hpbar8 O+ f$ F0 a+ J2 w u$ K
- showname = showname or 显示名字 == 1- k& M: k I$ k5 W7 I4 F
- if role.hpbar then
; o, r+ P2 u: L - hpbar = role.hpbar
9 C: P; f, V j2 z' h0 R$ T+ { - hpbar.showname = showname
' M+ u" I8 K: [& Q4 `. O a: I - hpbar.namecolor = namecolor
; H8 |: j& O- t; \9 w - else5 b) _$ Y: v7 i! o" d. H
- if #hpbarpool == 0 then; l) j4 w/ J2 b6 B2 s
- hpbar = F3DLayout:new()
* l$ h) G) v4 c: g - hpbar.showname = showname
8 C4 ~9 ]) U4 N% |8 K) L9 V5 z - hpbar.namecolor = namecolor
Q! U) ^" R! B5 d( m3 [2 E7 ?( b. e - hpbar:setLoadPriority(g_uiFastPriority), I% K, d% P$ j: T" g
- hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}( {4 u! J; d; G4 N) @
- hpbar:addEventListener(F3DObjEvent.OBJ_INITED, func_oe(onHpBarInit)). n$ _2 z5 V6 L
- hpbar:setLayout(g_mobileMode and UIPATH.."血条UIm.layout" or UIPATH.."血条UI.layout")--IS3G and UIPATH.."血条UIn.layout" or
5 w: N6 o% ]/ n9 \7 Z/ b- V! C - newcreate = true9 V7 |& a, S' J4 k% d, N" B
- else7 m3 q+ A- V6 [5 x5 ~
- hpbar = hpbarpool[#hpbarpool]
( F/ e- O$ L1 I! ? - hpbar.showname = showname
( R: G9 v8 i1 ?2 A5 p/ [* R& W2 Q - hpbar.namecolor = namecolor
; ?+ y! m* k* C4 s' y# v - table.remove(hpbarpool)
- W$ F$ V& i7 R$ K9 K) z - end
: Y V5 ]. p8 ^1 z - role.hpbar = hpbar
1 h) ~$ A- s6 d! W5 c2 a - hpbar:setZOrder(-role:getPositionY())5 Q7 ~1 z4 ]2 K1 O2 F1 D' d# n
- hpcont:addChild(hpbar)
( e: i, ^! s; C4 ?) {3 S4 |+ ] - end
6 H8 o' A6 K' R- E - if newcreate then
5 r; L7 t; p) H$ D - elseif hpbar:isInited() then
6 O4 G2 ^4 C6 e c7 O+ g - local ss = 实用工具.SplitString(name,"\")
: [) \* }! A5 L% F/ O - hpbar.name:setTitleText(txt(ss[1]))+ x0 X/ Q% x% V7 W
- if #ss > 1 then
1 W" x) d% U' D; ~- j/ F2 ^ - hpbar.nameexs = hpbar.nameexs or {}
5 S# m3 r' H& B4 A% p) M - for i=2,#ss do0 U8 U- ?/ D1 C, |0 e6 n
- local tf = hpbar.nameexs[i-1] or F3DTextField:new()
4 d! C" L3 T5 r - if g_mobileMode then6 ]: d% X. j$ w& o
- tf:setTextFont("宋体",16,false,false,false)
+ L" e3 i X' p! h( h) s5 X. { - end3 t2 ?2 X) {: X1 ~: o+ t
- tf:setText(txt(ss[i]))1 k7 L! [. j+ V `
- tf:setTextColor(hpbar.namecolor or 0xffffff,0)
* v @ u# T; q5 A' J4 |! c - tf:setPivot(0.5,0.5)# n- s- h- g1 l# r1 f, n: e& ]
- tf:setPositionX(0)
) T! [' N* z" _' Q. }; f - tf:setPositionY(50+(i-1)*14)$ I* k+ N; g, @& E
- hpbar:addChild(tf)
5 Q, |9 r9 P- a$ l - hpbar.nameexs[i-1] = tf# S/ I6 _9 Z6 F/ D. W
- end
$ Q3 B3 q9 ^1 t0 E# D$ p& M - end+ d7 h% C* G; E
- hpbar.guildname:setTitleText(txt(guildname or ""))1 |5 F! M1 x; \! Z# t
- hpbar.name:setVisible(hpbar.showname or role == g_hoverObj)
3 k8 L0 D. X! L+ H5 }+ j/ p - hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)
6 o5 \& Z/ {9 ?. c j1 | - hpbar.guildname:setVisible(hpbar.showname or role == g_hoverObj)
1 R/ s. X, c3 C: V/ X4 n - hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)
7 m( i2 B7 W2 ~" O# ? - if not mergehp then+ n" H! t% _9 n- W8 j( S: X1 a; v% O# h
- removeMergeHP(hpbar)
6 q) u2 q! G! Q) T7 @# ` M - hpbar.hpimg:setWidth(hpbar.track:getWidth())
/ m$ g# n/ }; n$ p - hpbar.hpimg:getColor():setRGB(color)
& `2 \+ |- c6 c: P, ~. q" K: y - hpbar.pro:setMaxVal(hpmax)
# Z* G! f: G- i2 Z - hpbar.pro:setCurrVal(hp)* w6 Q% q3 m1 p; t7 @/ S! m
- hpbar.pro:setVisible(hp > 0)
6 P3 }1 s0 `! d* j# T# p: w - else
( g0 x9 A- g- k/ o3 J# R1 w - removeMergeHP(hpbar)# i' V( ~8 I/ P4 P; g1 X X# `$ Q
- hpbar.hpimg:setWidth(hpbar.track:getWidth())3 X& Y! S! x7 v0 A6 |
- hpbar.hpimg:getColor():setRGB(color)
: |: ]' O) Q+ m2 B! L. h: ~ - hp, hpmax = createMergeHP(hpbar, hp, hpmax, mergehp)
3 g. ?8 X- `1 b% t6 k# @: | - hpbar.pro:setMaxVal(hpmax)
6 I0 R4 k' A0 G; B6 @ r& i - hpbar.pro:setCurrVal(hp)
7 r0 R8 M V) G) b0 ^, _! P - hpbar.pro:setVisible(hp > 0)6 o2 ? R) ^( S$ L+ o; Z) T& X
- end3 N6 E4 V& S7 Q% j; p" q
- hpbar.count:setText(txt(hp == hpmax and "" or hp.."/"..hpmax))1 K2 u0 h! y1 d6 F; D9 C2 b5 S
- else( P" v/ R" ?- C* p. z
- hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}0 ]+ W$ @2 \8 I5 T8 M3 d
- end
Y: p, o: V6 b4 k5 u3 r6 T1 M - if not role:isVisible() or (hp == hpmax and not mergehp) then
. K( R0 G- V e; q/ ^9 s* P) h - hpbar:setVisible(true)--false)5 ~2 F, M% g" n5 t# c I6 f8 w
- else. F; y0 Z$ }4 i [' h0 \1 i6 `
- hpbar:setVisible(true)
, G) s G. e6 z - end+ o3 c, t* ]6 J4 V: l
- end
+ b: t9 y% L2 J* c - function delHPBar(role): E% `4 C( l+ k) r% O
- local hpbar = role.hpbar9 `( S9 h" d& X+ ~+ s7 U6 V t( g/ ^
- if hpbar then
9 e y ~7 ^% d" B" G - hpbar.showname = nil
5 E0 N1 J8 L! X8 [ - hpbar.namecolor = nil& E( y% N" C* [4 w6 p* @1 z( m. v
- if hpbar.titles then0 n6 U, ~- @2 V
- for i,v in ipairs(hpbar.titles) do
o6 X# {' v4 o - v:removeFromParent(true), E" a' t9 h! @' b
- end
2 b% z$ Y2 Y& E R6 C A' \ - 实用工具.DeleteTable(hpbar.titles)" t1 d& P0 B# `; N, i2 j
- end
W8 w9 |, K, ?; s9 l+ A8 C5 U5 } - if hpbar.nameexs then; G; U* Z' v0 U! G5 k; w
- for i,v in ipairs(hpbar.nameexs) do
/ ^ U- f% [; T: U - v:removeFromParent(true)5 c4 {( K' j) N* u
- end
. |" S! l( }. g# y! S - 实用工具.DeleteTable(hpbar.nameexs) {6 R6 _* z% ]' s3 q' q
- end
& @& C! a# C/ j; V" Z - hpbar:removeFromParent()
, ?+ s. Q, {5 o+ J9 [ - hpbarpool[#hpbarpool] = hpbar
8 _3 r* r) P) J4 O: F( N% ~& ^6 q - role.hpbar = nil
3 y1 \* T# T5 _! U0 j/ t% I - end7 \' P2 S/ H7 P6 G2 V" g% V% O4 f
- end
; S3 D P1 @- k7 n5 O - function updateHPBar(role)
" t M7 |7 T* x' | ~ - local hpbar = role.hpbar
6 [- r( e+ U; g ^" F - if hpbar then
6 Z+ N4 r) U! q+ q( y( }# g - hpbar:setVisible(role:isVisible())
! y9 U5 g, } `- i) r* L8 u; E - end# K! j) k0 o2 J. G8 H, K7 |8 Y
- if hpbar and hpbar:isVisible() then
2 e5 k$ D) n9 j; z - hpbar:setZOrder(-role:getPositionY())# Q& m* @7 _" M
- local pt = F3DUtils:getScreenPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 20)
& M& [" i0 g8 M: g$ I8 \% n i) ^! I - if pt then
' t6 x1 H" N/ }: U5 j - hpbar:setPositionX(pt.x)
% K$ a8 s8 H9 B h% j; j7 Z* F6 Q - hpbar:setPositionY(pt.y)2 I. t6 y4 V0 `' {$ g! [
- end- `7 y! s# G6 `+ w8 n- @1 O! D6 H
- end! P4 Q: M; G u1 ?
- end
复制代码
* w, H7 g3 |$ Q' Z P* U/ d" o; `3 M0 n! h# R# {
|
|