|
平常他是不显示的,默认的是只有血条,没有数字!
f" L, N) v+ o5 B! ^8 r1 k0 O* R$ z, S! a$ a# K: j3 C0 j' k: N
如果想让他这样显示按照下面方法做: 4 A8 n' F/ y7 T, C8 N% h9 k/ t: R& I
/ w2 S7 h, H0 b0 ~* B M/ k
把下面的lua脚本复制到你服务端
a9 o) F$ k) E: g; @ Q8 K" o6 f( c
. j U. [" _' y5 w9 b$ O\龙途\Flying3D\scripts\模块\主界面\主逻辑.lua . h. y& u3 y. T& U8 Y
2 ?9 S' U8 ?# w1 W2 {( P$ [里面全部覆盖,注意是全部覆盖! : K0 B( m# I- b1 j
+ u* ~/ s2 Y; ?7 D) p; c然后重新打包pack & O- j( S# l T" _
- module(..., package.seeall)
: W0 m, C4 N: i - local 实用工具 = require("公用.实用工具")
4 O/ f$ b0 O6 Z# T/ b: C$ O/ h - m_FlytextPool = {}
0 k4 |& C, r% {. `+ \/ Z8 x: p9 { - m_Flytexts = {}- Z2 A B$ a2 Z8 Q0 t1 l" p
- function pushFlytext(flytext)
; ^: m+ ?! }. Y! I - if flytext.minus then) [8 B8 f3 i) Q( @( s. v. K
- flytext.minus:setVisible(false)3 O1 V! [6 {5 O4 I
- end
6 Y" t7 I- {9 s* T5 [) W! s8 B - flytext:setAlpha(1)
" K% Y! h- q e+ C& V% m - flytext:reset()8 q: Q9 g! [8 e, B
- flytext:removeFromParent()3 q# w6 n8 i" R" e5 x9 m% P
- m_Flytexts[flytext] = nil
/ ~1 c: p9 L; J - m_FlytextPool[#m_FlytextPool+1] = flytext' b/ C4 U; t; ^. p$ Q7 T
- end" w5 c# M7 r2 H6 m9 B% x
- function popFlytext()
' M+ ~4 }) L2 p k$ i - if #m_FlytextPool > 0 then& L( c5 W! O" `2 v4 c
- local flytext = m_FlytextPool[#m_FlytextPool]
z! D& u# X" I" j- `5 f - table.remove(m_FlytextPool, #m_FlytextPool)
1 b/ d3 R* e! i+ b5 I" W- w% M - return flytext3 q, ^& c1 W- ?9 J/ P
- end5 p5 J: \9 ?, B+ b6 ]
- end: n9 n* j7 _" P, @0 o
- function showFlytext(role, dechp, crit)! n2 }0 @) t i' d: n8 n
- if 1 then
$ i, u; {$ l; |& |( M' b+ d - return' c: R+ X1 T; ?, V8 [& z
- end
& D) _1 K/ v( M" `* |" s - local flytext = popFlytext() or F3DImage3D:new()/ ~$ j+ b9 N5 J- n; J+ l/ n& E
- if dechp == 0 then
; \' Q& _: P( H3 R8 @9 @ - flytext:setWidth(0)
2 c$ V/ d. J% g3 R6 _ - flytext:setTextureFile(UIPATH.."公用/fight/miss.png")
( c5 c: P; K& S - flytext:setOffset(-52, -35)- {( I9 a: M0 W4 D
- elseif dechp < 0 then* J" N2 C( r) n$ l# `7 @7 G
- dechp = -dechp& N. e2 o. E) o
- flytext:setTextureFile(UIPATH.."公用/fight/addHit.png")3 e! ]; |- g# ~
- flytext:setWidth(22)
( r* G v+ v. {' x( |3 ] - if not flytext.clips then
, J f" H4 ~! _! P9 ^& H - flytext.clips = F3DPointVector:new()
1 K) J0 h. T9 d0 ^& |+ G" ?# ^% S - end
, w' L- [- G8 S5 O! I7 B( y - flytext.clips:clear()
$ O1 }) _% i# |. |0 g - while dechp >= 1 do
- T2 O9 x8 h. Z8 L4 |1 [6 J/ {; h - flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22)7 E5 P1 s/ t& Z4 Q
- dechp = dechp / 10" ?8 l+ q. f1 b R
- end
3 g# P Q0 G7 T" F5 k- b0 t - flytext:setBatchClips(10, flytext.clips)
/ ~+ [( B- {1 A2 L - flytext:setOffset(-22+flytext.clips:size()*11, -50)& o0 x5 L& C9 g1 s$ Y
- if not flytext.minus then. U; x4 b% M. i; X9 R: ^% r
- flytext.minus = F3DImage:new()
2 y; V( g+ h- k2 `7 i9 Q - flytext:addChild(flytext.minus)0 c" _( }+ Z1 K% [! m( [
- end
# W9 i5 M4 J& s1 D( ] - flytext.minus:setTextureFile(UIPATH.."公用/fight/addFlag.png")
! ~' n1 Z( i z - flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-27)+ v _2 H1 W; I
- flytext.minus:setPositionY(4)
! r' d& f4 h; o8 t k. _1 X; Q' e+ m - flytext.minus:setVisible(true)0 A/ v: i2 e9 f, p
- elseif crit == 1 then
8 I0 A8 l& ?( P0 T' x; z - flytext:setTextureFile(UIPATH.."公用/fight/criticalHit.png")
$ C0 G6 V+ L# k* n E - flytext:setWidth(28)
4 D+ Z8 E: t Z( L) j& ~+ K - if not flytext.clips then7 O8 m% n* H/ Z8 z" O0 {
- flytext.clips = F3DPointVector:new()* H! W- p( L6 Q/ U: ]
- end5 n$ N: K: M& e- K& i: B
- flytext.clips:clear()4 }( h; \2 o% M
- while dechp >= 1 do5 G! U' i: S* L9 }/ s9 q
- flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*28)& F& ]4 a/ p' L! q! q4 \
- dechp = dechp / 10
X" n/ f/ W( A& @9 ?$ ~, o - end
# l" u. d. `# e8 s" i7 Z - flytext:setBatchClips(10, flytext.clips)
1 A! ~! V: d3 n6 ~0 E% d) l - flytext:setOffset(-28+flytext.clips:size()*14, -50)
1 M+ G {! f* K O7 C - if not flytext.minus then
* O6 F; b! Q2 W; u# e; @ - flytext.minus = F3DImage:new()
# l! F; T+ c0 O - flytext:addChild(flytext.minus)
2 E& O1 }; \; O0 `! P& w - end
. ~$ s0 C$ F0 D: z - flytext.minus:setTextureFile(UIPATH.."公用/fight/criticalFlag.png")
) Y0 n) ^4 f! n# g - flytext.minus:setPositionX(-(flytext.clips:size()-1)*28-55)
\1 o2 U; m/ Q1 O" X0 R) L - flytext.minus:setPositionY(-5)
) C' \/ A/ @# ]" ^ - flytext.minus:setVisible(true)- H2 ]- K6 Y6 Q3 b1 ~
- else
' C# D% V; T/ |" U/ B - flytext:setTextureFile(UIPATH.."公用/fight/otherHit.png")- p6 d! x3 H/ b; F5 n
- flytext:setWidth(22)
, }& r# i( e. z) ] - if not flytext.clips then4 Y( n7 l+ t0 x* o! V ^4 ^4 x% U
- flytext.clips = F3DPointVector:new()1 K) O7 t: \7 C* ~( q1 W5 ?
- end, V# N: Y+ I; i p" l7 c$ ]3 a
- flytext.clips:clear()1 ?; b5 ?; H" D1 Z. {/ Q- {0 q
- while dechp >= 1 do( \- j) R F& r
- flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22)
9 A7 @& O X6 ~ - dechp = dechp / 10
5 V; y x: h2 G- G5 ]# j - end
1 |' a5 K+ G8 A; F - flytext:setBatchClips(10, flytext.clips)
* {; R; V' k6 A9 q+ F# e - flytext:setOffset(-22+flytext.clips:size()*11, -50)
( P1 H, m& c" {4 |/ s - if not flytext.minus then
( U% M3 R- V. w3 V) B4 \ - flytext.minus = F3DImage:new()
. T( Z/ _) w7 S2 Z; s; H - flytext:addChild(flytext.minus)
9 b! g/ A) c8 v - end
" U) X7 }2 |! D3 N6 G - flytext.minus:setTextureFile(UIPATH.."公用/fight/otherFlag.png")
& A5 K$ [9 B- O - flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-17)2 ~, L* u7 v. t* w7 |
- flytext.minus:setPositionY(12)1 O+ v; O+ P+ y8 S6 G; V
- flytext.minus:setVisible(true)
9 S( w: m4 [! _- m5 s - end
' ^, d; G& j2 l! m+ Y1 Q4 o - flytext:setPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 10)% c$ V, z4 C- v( f2 `$ l S7 N/ a% T, |
- dechpcont:addChild(flytext)
' z7 V: A) x, V0 C - m_Flytexts[flytext] = 1, @7 ^! D- b9 z) e. S
- local prop = F3DTweenProp:new()6 u8 K) k x* Y* L3 w
- prop:push("offsetY", -100, F3DTween.TYPE_SPEEDDOWN), y( S% m/ p7 t, Y8 l
- prop:push("alpha", 0, F3DTween.TYPE_LINEAR)
8 @( L. h7 E- P% g: U) p6 q, _ - F3DTween:fromPool():start(flytext, prop, 1, func_n(function()7 K% {, B0 h5 U0 o
- pushFlytext(flytext)--flytext:removeFromParent(true)
- w* M/ s, M5 o* A+ J) ` e( T - end))$ T: d3 R, K1 r! a" G# O
- end
" h; V. h' b0 E0 X2 ` - hpbarpool = {}2 B% e: E( u" c, H4 ^4 u& f/ C
- function removeMergeHP(hpbar)
& b# G2 w% J! B/ k/ b, j( y7 e* p - if hpbar.mergehp then6 O3 X& f. D, U: q5 g( N
- for i,v in ipairs(hpbar.mergehp) do
/ l5 I- H S- J5 o) h) K - v:removeFromParent(true)
$ m0 L3 K2 I, z m - end" W" E* |) p1 M! Y2 f& v
- hpbar.mergehp = nil
, u% s! f, @, t# v - end7 d! u2 X6 e: e/ a5 V; S# Y
- end) X! ]+ P' Q: v5 I/ `
- function createMergeHP(hpbar, hp, hpmax, mergehp)
3 d8 x4 s( X! o: }- T) {. C6 Z - hpmax = hp
7 ] k7 i' m; ~6 v - for i,v in ipairs(mergehp) do
0 V: e7 G/ k7 {6 W: Q9 p - hpmax = hpmax + (i == #mergehp and v.hpmax or v.hp)" x* t7 y3 p& L0 D& c' x
- end
% K& @4 r' G6 S1 \ - local perc = hp / hpmax
1 h. }$ k; y, a$ ]% D8 T) I4 n) w( i - hpbar.hpimg:setWidth(hpbar.track:getWidth()*perc)6 Z: s S2 Z- r
- hpbar.mergehp = {}
; H( N5 e/ o4 Z - for i,v in ipairs(mergehp) do, o6 s8 q6 `* G M6 r
- local hpimg = F3DImage:new()
# Q+ ` w2 [' X. Y2 Y - local pc = (i == #mergehp and v.hpmax or v.hp) / hpmax' u7 m8 k& h: j) K
- hpimg:setTextureFile("tex_white"); `' B y7 a& |; f5 K7 Q
- hpimg:setWidth(hpbar.track:getWidth()*pc-1)
7 C/ ^* r* j# M+ G# a% C" c - hpimg:setHeight(hpbar.track:getHeight())
( m8 P8 N3 F3 X5 a1 m4 M% ` - hpimg:setPositionX(hpbar.track:getWidth()*perc+1)' U2 A) y8 N7 n+ |2 G5 T
- hpimg:getColor():setRGB(v.color)
' I. y0 w: n4 \/ n5 ?& I - hpbar.track:addChild(hpimg)
' E7 f) K4 v5 S; m" d0 z. O - hpbar.mergehp[#hpbar.mergehp+1] = hpimg5 C- O! q) x3 K0 a! j0 X. a
- perc = perc + pc
) ]0 ]2 U& i A0 ]3 ?5 H - hp = hp + v.hp
4 T" d. Q% a: |# X/ |" r7 O5 b3 S - end
& W8 c ?! ]' k c' q; t" Z! T - return hp, hpmax5 I9 \8 d, W% u4 T( m" Q1 r2 C" G+ v' R
- end
* q5 R& H2 L3 J" n6 h6 x - function onHpBarInit(e)" ^* q' O' @) m- p F4 p
- local hpbar = e:getTarget()( B0 X/ J; {" q
- hpbar.name = hpbar:findComponent("name")
! a4 B- G3 @' E( k- d3 e ? - local ss = 实用工具.SplitString(hpbar.v.name,"\")
0 q3 s* F7 ~" q! y7 O8 ]0 O: @! R - hpbar.name:setTitleText(txt(ss[1]))
! Q1 W u" c3 }$ z - if #ss > 1 then; H1 q4 f9 I8 S% W* n
- hpbar.nameexs = hpbar.nameexs or {}' d f) X, Z9 y0 R4 s; F5 Z" }
- for i=2,#ss do' A: d" j1 |6 ~
- local tf = hpbar.nameexs[i-1] or F3DTextField:new()1 M7 T8 B/ `$ S, g
- if g_mobileMode then' V$ y5 j! a' o- G
- tf:setTextFont("宋体",16,false,false,false)0 I2 m* |% N. @9 J" s+ m
- end
* L% C9 d; R5 c: D - tf:setText(txt(ss[i]))
3 t# Z$ F5 q3 O - tf:setTextColor(hpbar.namecolor or 0xffffff,0)& I7 t6 G( ?9 n8 V |; j* g
- tf:setPivot(0.5,0.5)" n5 q( a) Y, ^) j5 z& ]4 o( {
- tf:setPositionX(0)
+ X, p# A! k4 N9 f$ I - tf:setPositionY(50+(i-1)*14)
1 i& q6 O' ?+ r; ]0 b8 B - hpbar:addChild(tf)% s; u2 I2 \6 ?. W7 R' A
- hpbar.nameexs[i-1] = tf4 l! o+ @/ [5 b* ?9 @8 v$ F3 H6 Q
- end0 m7 Z$ I/ ]7 [5 j: u' ?
- end
5 K* ]$ t* B6 p, x: {2 N9 h+ M6 H' O - hpbar.name:setVisible(hpbar.showname) @7 \: A. `# e: w6 X
- hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)
0 [3 {$ ?$ [* s& O { ~# x V x; _" U - hpbar.guildname = hpbar:findComponent("guildname")# ~% W' r. R2 Q5 K3 E8 C3 c
- hpbar.guildname:setTitleText(txt(hpbar.v.guildname or ""))/ f6 F8 I; i7 ?+ v6 S% p
- hpbar.guildname:setVisible(hpbar.showname)
, L; ?! Z: C$ n( A - hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)
; Z9 R+ W3 u4 }( h - hpbar.pro = tt(hpbar:findComponent("hpbar"),F3DProgress)
2 q3 W! n: l' t, q! c1 H - hpbar.track = hpbar.pro:getTrack()
0 k: ? a/ L- e/ `5 K - hpbar.hpimg = F3DImage:new()0 W& Z9 k4 d' k; M* p5 y) C
- hpbar.hpimg:setTextureFile("tex_white")7 B6 q' Y: Q, B( X7 g1 i1 S
- hpbar.hpimg:setWidth(hpbar.track:getWidth())
7 R7 w# J( a' A7 p - hpbar.hpimg:setHeight(hpbar.track:getHeight())
% l- ~0 b; s6 M6 h5 d3 X9 h- |/ f7 V - hpbar.hpimg:getColor():setRGB(hpbar.v.color)% m3 B- ]6 T& M! @8 `
- hpbar.track:addChild(hpbar.hpimg)
5 f( v5 ^' z* l1 U( I! F2 {3 ^ - local count = F3DTextField:new() --创建一个文字
" F- k4 P, C; p: y - count:setPivot(0.5,0.5) --血条文字改为居中
7 P9 {: O: n1 N3 o3 M' I: M5 j - count:setPositionX(20)--变更一下血条x位置! B5 R$ O' \% N7 X% k) V
- count:setPositionY(-10)--变更一下血条y位置
, a4 `' C4 |! V1 \# S: d4 ` Q. f - hpbar.pro:addChild(count)--跟名字绑定
4 O2 V- n4 ~) S, C8 [2 g6 Q% U - hpbar.count = count --方便下面随时修改血量) K' R8 l$ m- i& X
- hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp.."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改
4 g- a# L& [4 C - --hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp .."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改
' M4 a. Q& }1 j: C( _- R - if not hpbar.v.mergehp then8 q2 N6 j4 a7 h) S6 p
- hpbar.mergehp = nil
3 ~( H" b% T+ [ C3 B - hpbar.pro:setMaxVal(hpbar.v.hpmax)
- c$ M/ p% u7 V) N& } - hpbar.pro:setCurrVal(hpbar.v.hp)
+ b- ?* M, V+ y8 S- Q1 ?$ ^$ @ - hpbar.pro:setVisible(hpbar.v.hp > 0)9 l( k) U3 @3 l( B, X
- else
- }' G+ t2 r+ q - local hp, hpmax = createMergeHP(hpbar, hpbar.v.hp, hpbar.v.hpmax, hpbar.v.mergehp)
0 O% N) S2 V+ [; X$ t0 s5 u5 J) Q - hpbar.pro:setMaxVal(hpmax)
9 V _" i/ n8 f! c$ @( ?4 o" B$ ]; o - hpbar.pro:setCurrVal(hp)* W- R* e" Z7 ^$ S% a
- hpbar.pro:setVisible(hp > 0)
- L- B6 |! ?" Q; U. x: Y( f - end
L+ R% U% ]. b - end
& x6 ?9 O9 B& S- n$ O9 U5 k0 A' z - function setHPBar(role, hp, hpmax, color, name, mergehp, showname, guildname, namecolor)
% I# N2 Z* g5 a2 L0 W( V& O% H: b. C - local newcreate' Y& m3 G1 f1 m; U8 ^ j' h' g7 u. t
- local hpbar
+ E0 |- O' U. N& ?1 K% C- X$ I. } - showname = showname or 显示名字 == 1# E3 `, }9 t( l% j9 i# b$ v6 u
- if role.hpbar then
& v0 Y1 X# s# W- p: F' ~ - hpbar = role.hpbar
9 c! p% B) j# o" m - hpbar.showname = showname& w( `$ t& r2 b
- hpbar.namecolor = namecolor" j: H8 I* _; J1 l2 \( c
- else; V+ a6 q" N, v+ o! W! @2 f. T& Q
- if #hpbarpool == 0 then& S2 D# d5 S8 |9 Y o' a
- hpbar = F3DLayout:new()
+ J3 G( q4 I6 j- K' _ - hpbar.showname = showname& t9 G# Q' p, B6 Y/ E6 ]* H
- hpbar.namecolor = namecolor
0 u2 O( I, k( |& J - hpbar:setLoadPriority(g_uiFastPriority)" h# h. M- g) f$ J$ O
- hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}
5 [ c- F/ v6 `; ~' K - hpbar:addEventListener(F3DObjEvent.OBJ_INITED, func_oe(onHpBarInit))* _+ n; n3 n. u
- hpbar:setLayout(g_mobileMode and UIPATH.."血条UIm.layout" or UIPATH.."血条UI.layout")--IS3G and UIPATH.."血条UIn.layout" or
% R6 P6 U, r, s9 T* w6 f - newcreate = true
" P& U* i& x! x0 h+ D! c - else2 v7 Q2 F( c. g9 ?
- hpbar = hpbarpool[#hpbarpool]7 |" \5 I& |3 z& A
- hpbar.showname = showname
$ R& y- U2 j. F2 M9 E; Z. U8 Q - hpbar.namecolor = namecolor) m. g9 G* e4 v0 l
- table.remove(hpbarpool)
) u8 h6 o. R g% J/ u0 D i6 l0 C - end9 c& z: E$ `9 l. P, d1 b6 U4 \
- role.hpbar = hpbar2 @7 p+ l Q2 S+ P* l ?, ~+ c
- hpbar:setZOrder(-role:getPositionY())
' u( r/ {* Z+ X% r! x% e1 N- H, }, J - hpcont:addChild(hpbar)$ s$ x/ _( h: l) e0 C; `
- end6 P g+ y- [$ @- D( r6 L. G2 B" n
- if newcreate then
b8 j9 [# R+ D4 A) d - elseif hpbar:isInited() then
- z* z" P4 `& l" N - local ss = 实用工具.SplitString(name,"\")7 u' L: |4 G- t: B
- hpbar.name:setTitleText(txt(ss[1]))3 k. @/ m( r6 f8 `) w0 T
- if #ss > 1 then2 G* S4 ]3 i* H- d% T
- hpbar.nameexs = hpbar.nameexs or {}+ s/ [/ U2 d) s, S; M
- for i=2,#ss do
) L( z( a k0 `5 y - local tf = hpbar.nameexs[i-1] or F3DTextField:new()
x+ _5 R9 p1 ]8 z - if g_mobileMode then
' J1 [ D1 T5 g8 c' Z' X% e2 R* G - tf:setTextFont("宋体",16,false,false,false)! I! d8 f. O8 ]; i- w$ f
- end+ B' g/ U+ N( l+ F# U
- tf:setText(txt(ss[i]))" H- J1 l$ X$ b+ O
- tf:setTextColor(hpbar.namecolor or 0xffffff,0)) q m1 ]; x7 P
- tf:setPivot(0.5,0.5)% ^. _' M7 b" i' W6 }5 e; t" N' P1 ^
- tf:setPositionX(0)
: L; L* a( O: M& a/ @& |( r R - tf:setPositionY(50+(i-1)*14)" {1 Z: N q5 j w M c: Z9 k' F* d
- hpbar:addChild(tf)0 |0 _9 l. p: f7 C7 i
- hpbar.nameexs[i-1] = tf9 b1 G& S y; D
- end6 ^' a: u6 r9 @& h7 ~7 ?
- end# Q( o A, ]" Q3 t' q8 _
- hpbar.guildname:setTitleText(txt(guildname or ""))- P3 n6 ?/ B3 ?, V [
- hpbar.name:setVisible(hpbar.showname or role == g_hoverObj)
2 v" q, n% O( i: S& a: [" [* Z - hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)
2 O, n% z! Y- z5 \ - hpbar.guildname:setVisible(hpbar.showname or role == g_hoverObj)& y0 a: x, d2 o h4 L+ _: r% x
- hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)
1 R+ T L7 O( K2 v" l) v$ Q" v3 u - if not mergehp then
6 \5 P' @$ g1 Q7 r% c, L) Q+ O - removeMergeHP(hpbar)
8 L9 `/ u$ ?. a( B1 \8 K - hpbar.hpimg:setWidth(hpbar.track:getWidth())
8 j- S: M8 t# }2 {$ d9 Q - hpbar.hpimg:getColor():setRGB(color)# ^; Z# u! ]0 Q( s4 ~; L
- hpbar.pro:setMaxVal(hpmax)
! c/ E- ~( n: q - hpbar.pro:setCurrVal(hp)4 z( M- p( J- T/ s9 K, a
- hpbar.pro:setVisible(hp > 0)1 q1 C' Y8 V) a1 D" ]" B& w4 n
- else
: t5 U/ X+ C1 Y: X; p) S6 ? - removeMergeHP(hpbar)
a. H6 F; X2 V1 U" S - hpbar.hpimg:setWidth(hpbar.track:getWidth())0 Y' _7 T2 x% ?' t1 c/ L7 w9 H( h
- hpbar.hpimg:getColor():setRGB(color), a+ m. x0 v% m
- hp, hpmax = createMergeHP(hpbar, hp, hpmax, mergehp); _9 o" z$ N& ^+ ^+ A/ j. W
- hpbar.pro:setMaxVal(hpmax)
: Q2 {4 @- v0 d! M* W D. J6 O - hpbar.pro:setCurrVal(hp)
/ D* _8 a6 e5 j - hpbar.pro:setVisible(hp > 0)- a& P% E8 ]& j6 r/ |
- end) }! R1 O( K: A) L
- hpbar.count:setText(txt(hp == hpmax and "" or hp.."/"..hpmax))4 _4 C4 J9 d* \1 Z1 ]1 G
- else
/ L* M) l6 P/ A- Z- c - hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}+ N8 ~ p% c7 P- {# K
- end
: Y7 @$ c! A) `6 ?5 y - if not role:isVisible() or (hp == hpmax and not mergehp) then6 g+ B$ A. P; ?6 h! _( Y
- hpbar:setVisible(true)--false)
* m& D* j% O7 H" O; h4 x8 s# a9 I - else) m; p l5 H6 X [
- hpbar:setVisible(true)
6 |/ I3 ^. p& B. `* q. u; ` - end
: R+ R) z% n: Y) i5 f - end
$ ^; u. Q7 i* H2 U1 g5 r- w - function delHPBar(role)
# u3 D o0 `/ C9 ^" P* ]. l - local hpbar = role.hpbar; c6 ~8 ?5 M. i, R0 l. C
- if hpbar then) ]. | Q: Z" u- ?/ x/ o. I
- hpbar.showname = nil
8 H6 K0 c! ]5 D q1 Q% w5 r" I9 F - hpbar.namecolor = nil* z1 `/ W; Q/ r( z
- if hpbar.titles then
M6 Q3 v! G. |, v: X( o6 y - for i,v in ipairs(hpbar.titles) do
9 g3 w$ z6 X- W; _; C/ {! |' s/ R - v:removeFromParent(true)" Q: H- _! u5 E3 g: [
- end
: |2 o- l7 X: r0 v6 I H - 实用工具.DeleteTable(hpbar.titles), N+ F% O: z; X# V0 T
- end7 ?0 r! u6 O b. R- a2 {" g
- if hpbar.nameexs then
: _0 W: T' I2 G& Q - for i,v in ipairs(hpbar.nameexs) do
! k1 _$ G5 o- B* B) D - v:removeFromParent(true)
6 d/ d% X; g. b# W% C, l7 d5 { - end
! k& ~- z* B$ J6 ]; } - 实用工具.DeleteTable(hpbar.nameexs)
# U+ F' e# i, P7 {% K - end! W, G8 f4 k* {8 y) i; G
- hpbar:removeFromParent()' ~8 ~7 \& f' H" {7 U" k! V
- hpbarpool[#hpbarpool] = hpbar2 @) n% a5 n; N9 W( N7 T# Y
- role.hpbar = nil
# T! H4 f8 o s - end0 r" a9 ?9 l9 u9 H; j" t' Z" `8 T3 k. P9 B
- end$ j8 N( v; I. Z0 S8 L: ?* |3 s4 t
- function updateHPBar(role)
9 v$ w: [* E- p8 I4 X; Y2 q - local hpbar = role.hpbar! Z, p$ O2 f, G$ g" W
- if hpbar then
% ]0 a2 Y! P v; U) d% S - hpbar:setVisible(role:isVisible())9 N. y- {- W. @; ^& l
- end7 V! A6 w! i& b
- if hpbar and hpbar:isVisible() then
( C4 Z- A" Y0 t( X+ n- G$ J6 A8 @ - hpbar:setZOrder(-role:getPositionY()) B# u3 h. v8 M
- local pt = F3DUtils:getScreenPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 20)8 J. s7 }% c- U; q/ t# _9 Q2 m/ Z# g
- if pt then7 }- X+ [1 `2 E% Q" S* v: r- P/ w
- hpbar:setPositionX(pt.x)
8 `8 i1 A8 \- m0 b - hpbar:setPositionY(pt.y)6 W0 z. d& P$ z' ^; e$ u( p w' A
- end4 c# Y1 L ^/ g2 y9 S) G8 l% c/ v6 y
- end
; b( l7 f- t) H8 J1 K$ H) \ - end
复制代码
8 C/ g/ W9 q" z8 Q: I0 C5 k2 n- e6 F7 k
|
|