|
平常他是不显示的,默认的是只有血条,没有数字! 1 b4 D+ v) f" E
" r9 u& ^. R' e1 K! A8 c" u如果想让他这样显示按照下面方法做:
% z* Y% q- |% H& P# d7 I
, l# a) g f$ e k把下面的lua脚本复制到你服务端
o8 ]# T0 v1 n4 ~0 ^4 m. w$ X- b e, ?9 j' z- W
\龙途\Flying3D\scripts\模块\主界面\主逻辑.lua 5 R+ `1 T% \) t3 M5 O5 ~9 f6 t
( f% m2 V7 z2 {4 C0 y) H3 w( {里面全部覆盖,注意是全部覆盖! # X5 s7 s4 ]$ @/ j' q n
. Q+ A2 e6 n, _7 k
然后重新打包pack
9 ]& c- D! A E$ m& y: _6 D1 u4 G- module(..., package.seeall)! ?2 b4 n* Y( ^/ V) f* v1 V, I' ~# o
- local 实用工具 = require("公用.实用工具")2 m6 {7 G" a! S7 m7 S9 w- y3 \9 {! N
- m_FlytextPool = {}5 l) R+ }' H, N; t. @ c: Q+ `
- m_Flytexts = {}% b, ?* W1 m$ D
- function pushFlytext(flytext)
) r: a" p' A1 ^% \* Q0 j2 P1 t - if flytext.minus then
' c. p) B# ^1 {+ }4 _ - flytext.minus:setVisible(false)
( O% `2 D: W3 _/ ~* b - end4 ?' C1 h1 c4 c) X
- flytext:setAlpha(1)
! S, o" z: m+ T2 i - flytext:reset()! m0 Z5 R( M: |, o7 s- j: v7 T
- flytext:removeFromParent()
2 K# @ T- y8 O - m_Flytexts[flytext] = nil: f" I6 T7 n% ?
- m_FlytextPool[#m_FlytextPool+1] = flytext- g3 Z) @ M4 _9 O; n' n$ [- @
- end+ X1 H5 h. {6 i: q+ \) C7 d0 m) J! y- {) d
- function popFlytext(), j# q: r/ ~& G1 |: b
- if #m_FlytextPool > 0 then
' C; k9 K; ~) k - local flytext = m_FlytextPool[#m_FlytextPool]& r& j: c% s8 {! Z
- table.remove(m_FlytextPool, #m_FlytextPool)
5 F4 F( o1 u8 ~8 P3 d - return flytext( ]- E4 {1 |; L' ]
- end
" A3 u8 n, w2 I p5 a1 `7 Q+ i) { - end
; C% d% B5 n$ O9 F0 s+ M) U8 m+ {+ O - function showFlytext(role, dechp, crit)$ o( Q4 U# V2 _- L+ J! @
- if 1 then6 k) `5 Y2 F: A# a- \" }5 B
- return
( D$ C( |' u* G) c - end- Y8 E9 N6 S; m C+ m! D
- local flytext = popFlytext() or F3DImage3D:new()( M; X3 w+ ?1 m6 u
- if dechp == 0 then
( u5 _6 O' } G0 A0 i, Z2 ]8 K - flytext:setWidth(0)
% w- y8 b# G+ H% L7 M+ D I9 d - flytext:setTextureFile(UIPATH.."公用/fight/miss.png")8 h" g( H% y4 A# S% S/ O
- flytext:setOffset(-52, -35)
) {8 p8 F! T+ k( V4 x! R- U - elseif dechp < 0 then
# q2 I: D# q5 G8 C/ j5 j- m1 T+ ? - dechp = -dechp
; E, E. y9 z4 S& P/ p - flytext:setTextureFile(UIPATH.."公用/fight/addHit.png")" [( i# o, z# q2 O; b
- flytext:setWidth(22)) ]0 h6 i. |# N4 z' l/ F$ U% s
- if not flytext.clips then- {) N0 C0 r9 j) z/ v
- flytext.clips = F3DPointVector:new()
4 a( n6 @, L7 }5 q. ^ b( n+ M( @ - end
3 [ v' }$ S8 T& q! R! m- w5 ] - flytext.clips:clear()% |* |6 R0 ]1 x; D5 v
- while dechp >= 1 do, |' p4 j6 ?' e2 [: o
- flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22)
1 \/ f0 J+ q1 t - dechp = dechp / 10& ^2 O. J/ p' a6 @
- end
5 e5 e8 e4 h/ H6 F# r - flytext:setBatchClips(10, flytext.clips)
/ b! Y3 b" G/ a6 N" p. \9 e3 G2 n - flytext:setOffset(-22+flytext.clips:size()*11, -50); c8 w0 |$ }5 S) k% w3 F. r
- if not flytext.minus then6 `: D9 y7 N& Z/ {
- flytext.minus = F3DImage:new()
. ] ]: N U3 o2 { - flytext:addChild(flytext.minus) [" D2 U @' O5 w3 T1 w# C
- end
/ |* ?' p4 }4 M0 m- ^7 g - flytext.minus:setTextureFile(UIPATH.."公用/fight/addFlag.png"), \0 S1 D6 L4 _* o% k$ }: P
- flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-27)
0 v* d; M8 t0 `9 R0 d; G3 n - flytext.minus:setPositionY(4)6 r N2 T% d, J+ p( s6 {6 s
- flytext.minus:setVisible(true)
( a6 h W0 W. C1 R, o1 o - elseif crit == 1 then
" m" D, r m- s4 R$ H W* Y/ u+ {9 Z - flytext:setTextureFile(UIPATH.."公用/fight/criticalHit.png")
" k$ q3 x5 s8 h5 x, @$ | - flytext:setWidth(28)
" R+ Q! w# i2 [* B- |0 _4 f8 K# b - if not flytext.clips then1 n4 D& \7 F8 I* h
- flytext.clips = F3DPointVector:new()" R+ ]1 g$ E( Y3 K( u) o* J+ R+ T) U
- end# T3 P+ W8 R q$ Z7 ?$ B" m
- flytext.clips:clear()
6 i* T& e0 P8 t& T - while dechp >= 1 do
3 a8 O# a: i! f& \4 U( W - flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*28): X1 H0 h Q# H+ _! \) X0 i
- dechp = dechp / 10
$ n, K+ n3 G2 W( i - end
( P5 n) V J2 N, t: y& r0 h - flytext:setBatchClips(10, flytext.clips)
5 J: e* v, S% \1 f - flytext:setOffset(-28+flytext.clips:size()*14, -50)
* N+ L" i8 H: g& ]: ` - if not flytext.minus then5 u( a- e* ~) ~$ h' S0 J& j- Z' `
- flytext.minus = F3DImage:new()) ~7 R( R0 Q& l, l
- flytext:addChild(flytext.minus)4 z) k* {! q5 m& ]; [
- end
; n. l, S Z" p5 i. m0 V3 t - flytext.minus:setTextureFile(UIPATH.."公用/fight/criticalFlag.png")
: u7 Y" `* D/ T& V - flytext.minus:setPositionX(-(flytext.clips:size()-1)*28-55)
7 T) S) N2 F7 \6 s* I8 n) m - flytext.minus:setPositionY(-5)
# R6 {. i9 ^8 A y0 } - flytext.minus:setVisible(true)
0 r2 s: [; _9 |! S - else1 u0 D* ~2 e) E2 [2 F; K) M
- flytext:setTextureFile(UIPATH.."公用/fight/otherHit.png")1 D% W* d9 I" C
- flytext:setWidth(22)7 X9 P) l% _% D/ O
- if not flytext.clips then/ y. A) D/ t8 N* r9 j8 F# e
- flytext.clips = F3DPointVector:new()4 E# K3 [8 C8 I2 [! O% h
- end
" D( `$ V# c% Q* r1 T# e6 O6 N - flytext.clips:clear()$ ]6 p' j8 Q" y8 ]8 U ?
- while dechp >= 1 do4 J0 p5 {, z, r7 G' y
- flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22)
1 @2 m L4 P3 H9 S- L - dechp = dechp / 10
+ I/ ~5 o9 g ^ - end
% o' ?; p. m' p% K+ z2 K) ~) u6 v - flytext:setBatchClips(10, flytext.clips)
* [$ B" s' L% f+ o. W* H - flytext:setOffset(-22+flytext.clips:size()*11, -50)
2 Z1 H1 h# X. Z) a - if not flytext.minus then
, [" p$ r4 @! h2 R2 v - flytext.minus = F3DImage:new()! z4 Y! L. [1 z3 a$ y+ ?- u) Q
- flytext:addChild(flytext.minus)
) }! A% t; l' U; [) u ^ - end9 A7 a2 P- Z5 Z. l% u
- flytext.minus:setTextureFile(UIPATH.."公用/fight/otherFlag.png")( l1 j$ S' F; g; Y: d/ G
- flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-17)
# R n* ?# D8 u: Q+ \) f+ p - flytext.minus:setPositionY(12)* I: M( n$ j& W5 F
- flytext.minus:setVisible(true)+ N) _+ T7 Z0 V% ^7 x
- end8 Z- U8 o& U7 P2 { s1 A6 L
- flytext:setPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 10), z! Z; P' Q, a) U2 K* l& E
- dechpcont:addChild(flytext)
, a7 a1 ?" |/ [4 h - m_Flytexts[flytext] = 1; l. u2 }# L. D* \! u U# o
- local prop = F3DTweenProp:new()
9 y5 f/ m. m& T) `0 T7 X! T - prop:push("offsetY", -100, F3DTween.TYPE_SPEEDDOWN)
! P% r% h$ Y! [; D8 p1 F1 j - prop:push("alpha", 0, F3DTween.TYPE_LINEAR)8 V3 D2 n2 |& E3 {' l
- F3DTween:fromPool():start(flytext, prop, 1, func_n(function(), u3 F6 T; P) c8 m0 W% e
- pushFlytext(flytext)--flytext:removeFromParent(true)+ o* F( W; z4 K; v; |$ r: K& \+ D5 l
- end))3 \- S9 l9 P% W6 v
- end
3 U+ x0 g0 q- D, M9 O8 ] - hpbarpool = {}
# ]8 F6 D+ ^" }) _* v4 W - function removeMergeHP(hpbar)1 o M6 c- ~" d( g" j
- if hpbar.mergehp then' {2 ~; M* { u( P5 `5 o% F- R
- for i,v in ipairs(hpbar.mergehp) do R4 s3 L: ^4 G. a x+ t* a7 R) _
- v:removeFromParent(true)
, \0 o& G, r2 b$ @* D - end
O! r% a+ z" r) ]! J0 D - hpbar.mergehp = nil
R0 K2 B% P8 ]3 d - end+ P* O) x: y5 t3 v
- end x0 F1 u+ o6 V
- function createMergeHP(hpbar, hp, hpmax, mergehp)# Y" a- s; M" N( [0 |# r9 S7 }3 M
- hpmax = hp
0 b; C6 ?! e- H0 @% Z; I - for i,v in ipairs(mergehp) do, P. _$ ?% J- s2 K: z1 d
- hpmax = hpmax + (i == #mergehp and v.hpmax or v.hp)4 v' l" n. C/ K
- end9 m' U/ m5 H$ a! I
- local perc = hp / hpmax3 o: j4 i/ V5 ~
- hpbar.hpimg:setWidth(hpbar.track:getWidth()*perc)
$ c6 ]: J- G3 l/ G9 |8 ?6 x" a - hpbar.mergehp = {}2 M* D/ v! h" A; ^' w, x* K
- for i,v in ipairs(mergehp) do9 b5 G. t; Z: j# F1 V, K+ H
- local hpimg = F3DImage:new()
* z0 X7 y/ Z9 g5 C8 S3 u - local pc = (i == #mergehp and v.hpmax or v.hp) / hpmax
: k) B$ ]2 r" S8 O/ F - hpimg:setTextureFile("tex_white")( r( e( W0 E" J, z: j9 I: p/ w9 {
- hpimg:setWidth(hpbar.track:getWidth()*pc-1)
" o4 D8 \2 H# u4 Q& X( B - hpimg:setHeight(hpbar.track:getHeight())
& x D8 M( {% k! w7 k+ n8 i - hpimg:setPositionX(hpbar.track:getWidth()*perc+1)& A5 M7 {& e' `1 O. C& o
- hpimg:getColor():setRGB(v.color)
9 |3 T7 @2 b& C+ c& C" h( o# f0 m - hpbar.track:addChild(hpimg)
' R. [1 |+ p5 o7 e2 a, S) ^) T0 G - hpbar.mergehp[#hpbar.mergehp+1] = hpimg
8 }0 G/ Q' Q! o) k V - perc = perc + pc: [1 u; E" b3 l4 p$ x
- hp = hp + v.hp
. ? W. g: j+ ^; L - end. }$ N4 m3 l9 F; ]- p+ f8 ^
- return hp, hpmax+ B' ^# A4 v$ A
- end
1 N# R# `4 K) C: }+ ^1 q - function onHpBarInit(e), Z( w/ n2 W- K: d
- local hpbar = e:getTarget()
/ x; j% L: F+ J" v# q - hpbar.name = hpbar:findComponent("name")
% v' k* D4 d' c: T0 Y# N& T! b - local ss = 实用工具.SplitString(hpbar.v.name,"\")/ _+ ]" T( i% e7 a
- hpbar.name:setTitleText(txt(ss[1]))6 [1 U6 d- {, b$ H+ Y
- if #ss > 1 then: w1 g2 \) l+ r0 [$ D ~
- hpbar.nameexs = hpbar.nameexs or {}9 M' @# t3 N& u1 C, ~( h5 k
- for i=2,#ss do
0 P; N8 O3 p, a7 _( Y& B - local tf = hpbar.nameexs[i-1] or F3DTextField:new()
* o. }9 J2 E& u) ]; W* R - if g_mobileMode then* P6 Z8 d7 T, M+ b% p$ i
- tf:setTextFont("宋体",16,false,false,false)$ J/ _# m0 _* \. \/ c4 q; }
- end9 N$ [6 i, Y+ k4 e2 Q* `" y. v' d) l
- tf:setText(txt(ss[i]))
% j; I- f) D, L8 g- M0 s7 A; g: P: e - tf:setTextColor(hpbar.namecolor or 0xffffff,0)
, }/ U( J7 L$ e7 e) M - tf:setPivot(0.5,0.5)0 U1 m* E+ M" |( u3 S4 @7 Q
- tf:setPositionX(0) y) v2 y0 y" X0 p: W$ t2 W
- tf:setPositionY(50+(i-1)*14)
. O" m8 l8 m9 }# Y5 n: P s4 D/ ? - hpbar:addChild(tf)! \: m# O# ?3 i; Z: d
- hpbar.nameexs[i-1] = tf' [7 u8 B; X* Z
- end
5 O. H3 `" E5 G4 V6 R( H: F; p# n - end
$ x2 T9 C5 |2 k6 w# u. d1 P- T - hpbar.name:setVisible(hpbar.showname)
, t0 L+ Z8 {+ \ _& l% p - hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)% v1 i* x" w* Y. C, E
- hpbar.guildname = hpbar:findComponent("guildname")
& B& ~& n. L+ z - hpbar.guildname:setTitleText(txt(hpbar.v.guildname or ""))
2 e! T3 @& |7 K ^ - hpbar.guildname:setVisible(hpbar.showname)9 M8 M3 k" W! ?( M
- hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)
" a: U+ [4 y7 k* S# j - hpbar.pro = tt(hpbar:findComponent("hpbar"),F3DProgress); I4 w0 y2 X; G4 Q( t6 q1 v
- hpbar.track = hpbar.pro:getTrack()8 E5 u: M1 d- n# @
- hpbar.hpimg = F3DImage:new()
2 A" ? W6 Y( F) c$ V5 I0 T( B - hpbar.hpimg:setTextureFile("tex_white")
0 J6 a- F" h2 \& Z: l - hpbar.hpimg:setWidth(hpbar.track:getWidth())
0 W& f( Z6 w: b1 S - hpbar.hpimg:setHeight(hpbar.track:getHeight())
$ ]) g, g3 { _ - hpbar.hpimg:getColor():setRGB(hpbar.v.color)
) T e K. D; P/ ~/ e - hpbar.track:addChild(hpbar.hpimg), v& L/ }" z) A, \( W8 ^1 E
- local count = F3DTextField:new() --创建一个文字( Z! C$ G0 D8 W$ p
- count:setPivot(0.5,0.5) --血条文字改为居中
. @+ l& l# M$ s - count:setPositionX(20)--变更一下血条x位置
* w4 E! D6 E, c6 g1 Q' z' Q, T9 k - count:setPositionY(-10)--变更一下血条y位置
: {: d6 ~5 H1 \ - hpbar.pro:addChild(count)--跟名字绑定
% |4 R. D& H8 @7 Z' H0 N9 [ - hpbar.count = count --方便下面随时修改血量
1 @5 y. V0 }0 |% O - hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp.."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改
: w1 y* d: m, R& I - --hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp .."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改2 G- E' b: @; C# N$ k9 u
- if not hpbar.v.mergehp then
1 B! N7 y/ X p8 i, O - hpbar.mergehp = nil
5 P6 l! C2 ~- Z; ] - hpbar.pro:setMaxVal(hpbar.v.hpmax)# g/ z' B9 {2 @3 H* a( ^; L9 k' c
- hpbar.pro:setCurrVal(hpbar.v.hp)
9 w0 k- j3 D/ ^. z" i6 `1 r - hpbar.pro:setVisible(hpbar.v.hp > 0)1 S+ U4 G' l: d! V& c
- else& g7 g9 \0 ^8 P2 M" l
- local hp, hpmax = createMergeHP(hpbar, hpbar.v.hp, hpbar.v.hpmax, hpbar.v.mergehp)- p8 ^/ f- E2 N" h/ R3 i
- hpbar.pro:setMaxVal(hpmax), g6 {- ]- X, \- w. I/ I* n, X
- hpbar.pro:setCurrVal(hp)5 T8 H, K w, P, h s" q
- hpbar.pro:setVisible(hp > 0)
# J- z* G2 I' E6 Q - end* F3 A8 ^6 U1 I- b- r
- end
$ \! T6 F' R; Q2 @: B/ P - function setHPBar(role, hp, hpmax, color, name, mergehp, showname, guildname, namecolor)
( n/ \- J; @) K3 ^6 [4 m- \ - local newcreate
, ^4 i$ x8 n/ i$ z) |8 e - local hpbar
. b. h; i4 f/ W1 [ - showname = showname or 显示名字 == 1. F7 T; {( l0 E8 d
- if role.hpbar then; |+ U1 w1 D3 \* V- x7 o
- hpbar = role.hpbar
' g$ s3 O* H8 `) q0 n - hpbar.showname = showname" Q: {4 s7 T, D
- hpbar.namecolor = namecolor! `4 B6 q5 T$ f! e& j8 d) F
- else
k" J9 e6 z2 x; i - if #hpbarpool == 0 then
# ^# F; _$ S: Q- k' {4 b+ w - hpbar = F3DLayout:new()2 I% g1 f) g' a" E+ T8 W
- hpbar.showname = showname
; I6 y+ B4 Z0 U" [$ b0 L, ?$ I8 \ - hpbar.namecolor = namecolor
" h( x" R$ e9 A9 b9 i - hpbar:setLoadPriority(g_uiFastPriority)8 H$ q+ K/ c! e1 `% H
- hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}; E2 L0 |. b# f- `8 U2 \
- hpbar:addEventListener(F3DObjEvent.OBJ_INITED, func_oe(onHpBarInit))
, n0 |# ~& C, o& F: o - hpbar:setLayout(g_mobileMode and UIPATH.."血条UIm.layout" or UIPATH.."血条UI.layout")--IS3G and UIPATH.."血条UIn.layout" or ' Z5 m2 T+ L. s6 _# M+ i
- newcreate = true
" n6 p7 @- g. R - else
& Z, N& _# J7 N& [ - hpbar = hpbarpool[#hpbarpool]
% M, x8 \( q/ m' p - hpbar.showname = showname
. N/ D- ?( _5 x. V: |7 ` - hpbar.namecolor = namecolor/ o! ^, h; Y# i5 x1 s2 u* [$ y
- table.remove(hpbarpool)
' r7 }; P0 c% ] - end6 ~4 p4 c! I8 |' @5 G# ]! ^
- role.hpbar = hpbar' B! V5 ]4 k8 H) O. R
- hpbar:setZOrder(-role:getPositionY())
$ d5 v' Q% }, W1 N2 B0 D0 l - hpcont:addChild(hpbar)
. I2 q! v3 D' s9 r i% ~ - end; }! ^& j% s% D3 w: l! g1 E' `
- if newcreate then
3 y1 x1 H0 s8 G, T" }; j, i - elseif hpbar:isInited() then( J3 t. }2 v3 T; N9 J% w( T7 |
- local ss = 实用工具.SplitString(name,"\")
) J$ z- m: m; j0 z( ~$ Y S' h7 l# F - hpbar.name:setTitleText(txt(ss[1]))1 r! j/ L- t' b F
- if #ss > 1 then" E) q4 H: {& N' t) j
- hpbar.nameexs = hpbar.nameexs or {}7 A- r ~9 c% M3 R6 K2 r8 P
- for i=2,#ss do9 o5 [) l2 p( e* r8 Z1 P
- local tf = hpbar.nameexs[i-1] or F3DTextField:new()( q% S- ]. A+ e/ a7 ?3 O2 h3 f
- if g_mobileMode then+ i4 B" i+ n. K, b
- tf:setTextFont("宋体",16,false,false,false)3 G$ q/ M3 M, P; R: t
- end' ]/ f/ o- h, m+ y; Z0 L
- tf:setText(txt(ss[i]))1 t4 }( a0 f+ s( |2 [
- tf:setTextColor(hpbar.namecolor or 0xffffff,0)( ?, b( I0 @6 q+ ~- a' @
- tf:setPivot(0.5,0.5)
7 N+ K2 J0 o! c4 |/ W; V' g - tf:setPositionX(0)& n2 G y) H" K' G
- tf:setPositionY(50+(i-1)*14)
! K, [/ q; O/ U6 e - hpbar:addChild(tf)
C3 n a# Q( w* i. X8 I7 [# c - hpbar.nameexs[i-1] = tf
/ b) T( ~4 p$ T3 g S0 E - end
; X: q* U9 j+ U# H* e9 m+ r - end
; ]: z# C6 Q" P- `( z" c w' B - hpbar.guildname:setTitleText(txt(guildname or ""))1 U7 E- V" K2 E
- hpbar.name:setVisible(hpbar.showname or role == g_hoverObj)
' I- \( h6 @" Y7 ]2 _ p+ A) ` - hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)
$ r$ H& X Z) Y8 p$ ^ - hpbar.guildname:setVisible(hpbar.showname or role == g_hoverObj)# y7 w% {) f" U" A. }; g- r! Z$ j3 e
- hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)9 P% y' I& j* U/ x, z
- if not mergehp then- A5 b, }1 ?) |6 g- K5 b. n$ w
- removeMergeHP(hpbar)9 c+ O1 Q) r. ^8 W9 D
- hpbar.hpimg:setWidth(hpbar.track:getWidth())( q O# m n% W
- hpbar.hpimg:getColor():setRGB(color)
A0 V5 f9 `# W4 q! q2 D - hpbar.pro:setMaxVal(hpmax)! p- f; o& ^6 \; y% n: q: v
- hpbar.pro:setCurrVal(hp)
2 _% C/ E& P, v - hpbar.pro:setVisible(hp > 0)" _$ Q! v7 s1 i' N n
- else
% q. m$ d) J* f6 J& z h - removeMergeHP(hpbar)
3 m1 v' }$ K' h: i i# i - hpbar.hpimg:setWidth(hpbar.track:getWidth())
! B" E5 K/ E* y; ?6 e$ s - hpbar.hpimg:getColor():setRGB(color)) P* e" R# ?1 `: y- S$ s# H
- hp, hpmax = createMergeHP(hpbar, hp, hpmax, mergehp)
D5 ?, d, k& T& c2 Z7 ?$ @5 M - hpbar.pro:setMaxVal(hpmax)
1 n/ S$ V; f/ r% H - hpbar.pro:setCurrVal(hp)& l& H Z. r1 z( t ^. N" o- l
- hpbar.pro:setVisible(hp > 0)& K6 S2 Q( ~ r2 S ~* K: H
- end$ X7 I. {( O8 D' [
- hpbar.count:setText(txt(hp == hpmax and "" or hp.."/"..hpmax))
- r- Z& g$ m, Q1 L }+ G2 h - else8 o' f% ^- u8 y: }4 x5 k, c1 N
- hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}
1 Q1 u& n7 }, ?2 \ - end8 Z! ?, {, h6 z% h6 Y
- if not role:isVisible() or (hp == hpmax and not mergehp) then' s1 E6 s& g d3 N) l( U
- hpbar:setVisible(true)--false)
7 D! a* ^0 f- M$ E* `2 x - else( {* V6 ?) O) W$ j4 W# v% k* ^ U& a
- hpbar:setVisible(true)* \5 P$ g% @, b, S2 x5 O4 N2 N+ @
- end& H& @! ^6 p& r5 @% F, h
- end9 \* L! ~2 s/ \" _- r
- function delHPBar(role)- v: Z2 V9 d8 b& j) x' g2 N
- local hpbar = role.hpbar, d+ F1 @, X1 P- Z$ U1 v
- if hpbar then
; S% I) G i7 e5 g* F - hpbar.showname = nil
, p7 W) B5 c7 ~! n; @: e5 y - hpbar.namecolor = nil
( W8 r; k [- r; [7 J2 ^9 s G - if hpbar.titles then
) F+ Y4 z3 `. j( I F. ` - for i,v in ipairs(hpbar.titles) do* Y$ T$ _7 A' e3 x* t1 O
- v:removeFromParent(true)
; b3 t8 ^; n/ c) u! Q - end3 A" q/ L) Z& S0 T% B% y
- 实用工具.DeleteTable(hpbar.titles)0 l1 s7 W: o( ~8 Z1 H1 B
- end+ p% k0 _0 R* Q6 C
- if hpbar.nameexs then
& q: X' L* n( `+ r - for i,v in ipairs(hpbar.nameexs) do
! W4 @; [9 b K% }( y4 \! D% n2 W% K - v:removeFromParent(true)( G5 R' L1 _* O
- end, L8 ^( X, P% q# R6 J4 [( a
- 实用工具.DeleteTable(hpbar.nameexs)
& [) N$ N# B3 g' [% e9 O( ^7 ] - end
1 g$ i+ b- G/ ]. T7 B/ P9 V - hpbar:removeFromParent()2 T0 t0 \/ c( L. S, p( M. v) r3 \
- hpbarpool[#hpbarpool] = hpbar
% i( Z5 G* L( L+ @( n/ i/ Q2 U* g - role.hpbar = nil& c. [1 @& [3 w1 Y6 o$ v7 j' i( T% a
- end
( H% G7 z4 {1 E - end) w D. n$ \7 I) l
- function updateHPBar(role)7 F0 h5 v- I' n& }+ G
- local hpbar = role.hpbar; M/ Q2 [+ {6 Y1 j5 ^
- if hpbar then( N9 b# A8 t; E: y
- hpbar:setVisible(role:isVisible())$ \4 K% S# B8 S& b1 H/ a
- end0 J* j% ^, n. l3 s2 K* r6 k4 t' d6 n
- if hpbar and hpbar:isVisible() then
" H4 L! a. ]2 \& U6 y6 D - hpbar:setZOrder(-role:getPositionY())
+ f* c3 d% e7 ^1 f% J - local pt = F3DUtils:getScreenPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 20)
$ _7 v* y$ Q5 |/ X" g6 c7 y/ N - if pt then
: V& R, g2 E( R# W X+ @ - hpbar:setPositionX(pt.x)
1 X3 P; M# ?8 E) x5 ~7 j - hpbar:setPositionY(pt.y)& W2 L4 _2 Y* G- E8 E w! o7 W
- end1 _8 q: J# \: y9 ?
- end
3 F7 G7 d, X/ M+ ]9 H" H' ^- g) ` - end
复制代码
( O6 Y$ n1 T5 z+ Z8 j! Y: k5 \/ y) l9 Z9 g$ M
|
|