|
平常他是不显示的,默认的是只有血条,没有数字! u5 j/ x$ D& c+ B2 U; i
3 R- A3 g2 M: O# Z
如果想让他这样显示按照下面方法做: 9 _1 G7 I5 g$ V8 V7 [: ?
. h& [# ^) @4 B, }& }% @5 G. @
把下面的lua脚本复制到你服务端
# n8 D& p* |- v) h) a# X, ?
4 t* i7 L* x$ [\龙途\Flying3D\scripts\模块\主界面\主逻辑.lua ! G: u* @' u" p4 W6 z% S4 [
/ Q h9 x. U2 t2 v, U8 J
里面全部覆盖,注意是全部覆盖! 4 j: T0 x6 b1 r4 Q4 r
( y' [4 i8 ^5 I- m: c" b) u; G
然后重新打包pack 5 \/ x" p8 F: e' B! @; J. U
- module(..., package.seeall): Q) C; Z7 R) y# o2 c
- local 实用工具 = require("公用.实用工具")
4 k# w, r; n) e, H2 v7 y - m_FlytextPool = {}
: ]2 R7 ~* o: h# G S" r$ T! y: ] - m_Flytexts = {}* F3 s* ^$ t' g( ^, x( m: b
- function pushFlytext(flytext)1 l: k8 F# N2 Y: m) F2 W9 A. e0 w
- if flytext.minus then D3 C3 J; U! I9 o
- flytext.minus:setVisible(false)
~) C& P4 R/ j* S1 C - end. C9 l7 @2 S/ h8 _* s
- flytext:setAlpha(1)( L) j( _- y' _5 t) E8 V
- flytext:reset()
; n' Z- {. ]) }1 `/ _ - flytext:removeFromParent()# O2 _6 ?6 ~5 m, d
- m_Flytexts[flytext] = nil
5 ~% S0 r; k3 D! k, f - m_FlytextPool[#m_FlytextPool+1] = flytext
$ \5 {! n8 {2 E C - end1 u9 F4 _! F g. D
- function popFlytext()
) ?. ] E. ~: m4 v& P - if #m_FlytextPool > 0 then
- Z" O5 @4 V' p# g - local flytext = m_FlytextPool[#m_FlytextPool]) z1 r9 F! [4 n% F
- table.remove(m_FlytextPool, #m_FlytextPool)9 K- Q2 {; @7 S3 z I+ Q$ A
- return flytext; p3 B! H) {" \: C& F5 l
- end
" h: r* _, X# L5 A - end
0 ~- P5 x: o- @/ x - function showFlytext(role, dechp, crit)* ]8 ], P1 k# J/ R
- if 1 then9 K1 Y* o/ W6 x0 Z. a8 V2 J) N
- return
: i. s1 Y$ T5 f# |4 g - end9 o, u, M) B" u& n2 W2 v
- local flytext = popFlytext() or F3DImage3D:new()- {1 v" }% ^ r2 U7 t) o
- if dechp == 0 then8 `% _% V! y. `- F$ P
- flytext:setWidth(0)8 l8 O8 e2 J* I! R/ z! `# T/ L
- flytext:setTextureFile(UIPATH.."公用/fight/miss.png")1 n) E2 E, u, a, ?" y# a
- flytext:setOffset(-52, -35)
2 ?7 H4 O5 H' I. A, T9 [ - elseif dechp < 0 then
: o$ x" V0 P2 Z/ d: n - dechp = -dechp
+ e4 c/ i: D$ o" s5 s - flytext:setTextureFile(UIPATH.."公用/fight/addHit.png")9 p5 M- N% H+ ]2 s$ E4 {
- flytext:setWidth(22)
9 i" w1 J( K. {* T6 z - if not flytext.clips then
9 {- v C9 ~* i! I. @% \6 e8 \+ v - flytext.clips = F3DPointVector:new()
* i8 j4 _' B" }. b0 C7 [ - end# Y5 S3 d3 X- c7 x& R8 i2 ~ v: t
- flytext.clips:clear(). O- I4 x( D2 @& S
- while dechp >= 1 do# p J* b/ \8 p4 o+ k# k F+ K) e/ G6 v
- flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22)3 g h( w6 Y# [4 u
- dechp = dechp / 10! D& s, Q8 `3 a* b
- end
: H5 U$ C. Z, D* g( W - flytext:setBatchClips(10, flytext.clips)
* }+ `# b( \- Z; w - flytext:setOffset(-22+flytext.clips:size()*11, -50)0 w4 C1 s, D; i: D
- if not flytext.minus then# b0 G4 G- w& B* b/ x
- flytext.minus = F3DImage:new()
/ A# e. v) O' j1 s( h6 q! ~ - flytext:addChild(flytext.minus), P( D" [2 |+ ], M% d; l! f
- end
8 t! F' ^& V1 D) D3 Q+ K( n- Y - flytext.minus:setTextureFile(UIPATH.."公用/fight/addFlag.png")
9 j4 T' b* T+ V( k( R( A - flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-27)
6 X0 l1 ~# f. Q/ H- J; P: g - flytext.minus:setPositionY(4)& ?- K3 Y' f3 p; ]6 T
- flytext.minus:setVisible(true)
; P7 _0 I7 Q2 }1 ] - elseif crit == 1 then" }$ W2 h( j" j. g/ J0 u: {( C
- flytext:setTextureFile(UIPATH.."公用/fight/criticalHit.png")
5 I; _* ^2 \8 I2 i2 o4 x - flytext:setWidth(28); H4 _& r5 e# p. o3 R
- if not flytext.clips then/ c1 s# T4 L' a+ d; M
- flytext.clips = F3DPointVector:new()
/ |# ]: w5 J! ~ - end9 m" r# A M; a% I* S
- flytext.clips:clear()" t4 d- \1 f2 {/ `
- while dechp >= 1 do
# v% j2 b0 R4 i3 m4 o$ v, s - flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*28)
! [" U7 z6 p6 R; s7 K+ \, D: x1 N( K - dechp = dechp / 10
9 A0 y2 V$ f+ W. G: d( p$ I - end
' r: |( ]) N( [, I - flytext:setBatchClips(10, flytext.clips)
1 D% i( F: d' C - flytext:setOffset(-28+flytext.clips:size()*14, -50); V* A* G+ w0 `) b$ }- J6 L
- if not flytext.minus then
* O3 h: N8 J9 I2 h4 N: b - flytext.minus = F3DImage:new()
* v' W3 U o- @) `; \2 X, Q8 U - flytext:addChild(flytext.minus)1 Y) d* \8 |, K! R/ e3 P2 j5 j5 ~: l1 k
- end
+ y+ D$ u( R% c" y! }3 p - flytext.minus:setTextureFile(UIPATH.."公用/fight/criticalFlag.png")
/ N5 R' B5 W0 j0 e c' P% c - flytext.minus:setPositionX(-(flytext.clips:size()-1)*28-55)
+ N2 o) M; {1 X- e9 v - flytext.minus:setPositionY(-5)
- _6 E, _ t# v: X: J$ i - flytext.minus:setVisible(true)7 ^, M2 Y) s0 d
- else
$ S' ]- q2 j2 v4 H8 L( |% J - flytext:setTextureFile(UIPATH.."公用/fight/otherHit.png")
4 r- T3 q( P9 Z- u - flytext:setWidth(22)8 _7 J7 K }. z* F: b7 E% g+ D
- if not flytext.clips then
% ]! ~0 P0 V2 Y3 @5 s+ ^ - flytext.clips = F3DPointVector:new()
- M/ u7 p3 D4 t1 @: G1 s - end
3 g& y+ A) B5 H8 {; I; c - flytext.clips:clear()
" y# J8 a, x. V4 ~% s9 { - while dechp >= 1 do
- B$ d$ _' O% z: r5 G) a - flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22)
3 i8 J9 W+ Q1 o- j - dechp = dechp / 10: O1 ?3 N f" q
- end2 P) q2 v- b9 L
- flytext:setBatchClips(10, flytext.clips)3 b$ n9 ?4 w* d
- flytext:setOffset(-22+flytext.clips:size()*11, -50)9 O* R' G, |5 |- `6 V" B8 j
- if not flytext.minus then
* {8 M! T# n7 O1 h' p& p - flytext.minus = F3DImage:new()( `4 u+ x+ ]3 F
- flytext:addChild(flytext.minus)) t! ^" T5 ^5 X5 v2 j7 D
- end" g( v" P- g2 @0 w5 C* I
- flytext.minus:setTextureFile(UIPATH.."公用/fight/otherFlag.png")
+ G U! d8 P2 P - flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-17)# M0 }/ Z" G$ Z# @8 J" V
- flytext.minus:setPositionY(12)
2 M7 I% e6 ^% G* _* A9 t' R# s, y - flytext.minus:setVisible(true)
5 k* E+ o; S9 e: J - end& d! c8 v2 w+ f
- flytext:setPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 10)
1 ~" M0 L: j& `+ \ ^2 Q - dechpcont:addChild(flytext)
% Z8 L% e/ S: w - m_Flytexts[flytext] = 1
* ?$ W( y5 s8 X1 y/ d1 s - local prop = F3DTweenProp:new()
% d: E$ s$ p9 Q5 g - prop:push("offsetY", -100, F3DTween.TYPE_SPEEDDOWN)
7 b0 ]# ]" f; Q7 g% I; H - prop:push("alpha", 0, F3DTween.TYPE_LINEAR)$ h0 T3 T+ `4 x
- F3DTween:fromPool():start(flytext, prop, 1, func_n(function()
" R r0 w5 f9 K) Z - pushFlytext(flytext)--flytext:removeFromParent(true)
/ j p7 `% K+ K% A2 i - end))
) o$ W P# H3 _4 B! B3 r- ~ M - end6 [ i$ ^6 F# ?
- hpbarpool = {}
; g# `+ a8 ~! C2 d - function removeMergeHP(hpbar); J2 g8 U+ n2 y6 R) @- i6 `; _+ e
- if hpbar.mergehp then
3 `4 }$ E% s$ ~; V4 O E& E - for i,v in ipairs(hpbar.mergehp) do
( W, P% p% s6 Z x( }0 B6 P( T - v:removeFromParent(true)' M+ |0 U. G2 A
- end
: P# f' R4 t' Y2 t* I; ~: x; k$ R - hpbar.mergehp = nil$ u2 Q& v* X7 M
- end
6 Z- I5 f1 o, s D* A - end( h9 V- F8 U% Y: x s
- function createMergeHP(hpbar, hp, hpmax, mergehp)
# v. I5 \3 d! r c3 Q1 e9 f: E - hpmax = hp
/ `" W2 U: R$ M; @9 B2 O3 j' I - for i,v in ipairs(mergehp) do
2 A4 |, I5 |$ n$ W% H3 b1 ` - hpmax = hpmax + (i == #mergehp and v.hpmax or v.hp)& {* y/ Y) f, ]( W3 X
- end. W. z- ]" w, o4 Q! C$ o, F+ G
- local perc = hp / hpmax
* O+ y3 s: D$ D! i7 W - hpbar.hpimg:setWidth(hpbar.track:getWidth()*perc)
: I$ u+ D6 v! G( N9 w' h - hpbar.mergehp = {}
6 X3 N" Q3 Y3 H$ r' X! I - for i,v in ipairs(mergehp) do& ^5 O4 Q3 O6 V
- local hpimg = F3DImage:new()+ K) {8 m' S1 \# B7 a) b
- local pc = (i == #mergehp and v.hpmax or v.hp) / hpmax
6 z+ w: t: t% `$ `. X2 {; x% ?2 | - hpimg:setTextureFile("tex_white")
8 T$ k6 g2 b/ M; j' O - hpimg:setWidth(hpbar.track:getWidth()*pc-1)- Q) C8 F3 r0 v7 o: F/ D$ [/ |6 B% `- l
- hpimg:setHeight(hpbar.track:getHeight())5 y, K5 ]* E! y: m3 } _- v
- hpimg:setPositionX(hpbar.track:getWidth()*perc+1)
# g3 ^8 l1 G, O: G7 f6 i' B - hpimg:getColor():setRGB(v.color)
% X/ J& H/ z8 Q2 A - hpbar.track:addChild(hpimg)
# { l4 b9 o1 K2 e4 l. u - hpbar.mergehp[#hpbar.mergehp+1] = hpimg
' i* H, x3 w7 j9 X/ j4 }3 T - perc = perc + pc8 {4 k m' X2 P% \9 R8 X. R- [! y
- hp = hp + v.hp$ l0 h! o( W9 u; r, r& v0 W
- end* D5 o1 L& g9 x; L! v" _: h
- return hp, hpmax
, D6 R0 \. l% B! N5 Z! I- y - end5 h- d" a. }0 {$ t: f) Z
- function onHpBarInit(e)
5 P& }3 R4 o3 } - local hpbar = e:getTarget()
; l- H5 s \% M2 Q - hpbar.name = hpbar:findComponent("name")$ u! x( X9 D- y8 @3 W2 N
- local ss = 实用工具.SplitString(hpbar.v.name,"\")
9 m) m' @9 X' Y - hpbar.name:setTitleText(txt(ss[1]))
# ~* a0 w: L9 q; O. }2 ` - if #ss > 1 then
9 A( p& O: |' R. @' v - hpbar.nameexs = hpbar.nameexs or {}3 Y. G+ \) Y7 K" J' m
- for i=2,#ss do4 }, x. i( z0 \, g1 h
- local tf = hpbar.nameexs[i-1] or F3DTextField:new()
0 o0 b( g* M0 E' F1 F - if g_mobileMode then
- U- L' C B% ? - tf:setTextFont("宋体",16,false,false,false)" k! y4 R- r9 g$ [
- end
. Z6 D5 _. ~- W, ~8 K6 Z1 \" q - tf:setText(txt(ss[i])); A; U0 O- h, C# p+ \* s1 k
- tf:setTextColor(hpbar.namecolor or 0xffffff,0)
3 s, l& n+ d6 [2 z. p f$ G( N - tf:setPivot(0.5,0.5)
. k# ?4 d7 @8 U - tf:setPositionX(0)/ Q/ e3 u8 n$ T6 e! i$ h8 ^
- tf:setPositionY(50+(i-1)*14)4 H; d# c( ^5 f
- hpbar:addChild(tf). s7 T+ }4 \2 B6 }4 I! p, c
- hpbar.nameexs[i-1] = tf5 b$ ~6 U+ u6 W4 j; v- ~. i7 k. W
- end `1 h R1 v6 }# {5 J
- end' z! p# o4 T5 K
- hpbar.name:setVisible(hpbar.showname)+ E; t8 B5 {$ A/ x {
- hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)" d, A Z- p! r& M7 u
- hpbar.guildname = hpbar:findComponent("guildname")% I; u2 H+ o1 D* c/ p1 [( C& x( u
- hpbar.guildname:setTitleText(txt(hpbar.v.guildname or ""))
! n C; N% N# v ?: }$ h - hpbar.guildname:setVisible(hpbar.showname)
" D7 x- r3 K2 {) P. y, l6 n - hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)
/ Y. Y8 P6 t+ ]+ m! ?2 K4 z. k - hpbar.pro = tt(hpbar:findComponent("hpbar"),F3DProgress)# r$ f# y* V/ d7 c
- hpbar.track = hpbar.pro:getTrack()
0 I/ V) Z! X- G9 @# Q# s - hpbar.hpimg = F3DImage:new(). G* \- e0 b9 F ~5 ~" {: u
- hpbar.hpimg:setTextureFile("tex_white")) e: H2 j. }+ i6 W
- hpbar.hpimg:setWidth(hpbar.track:getWidth())# J' c$ J9 U# Y8 Q& w
- hpbar.hpimg:setHeight(hpbar.track:getHeight())
" V0 I* s9 h- e$ c4 h; K% w; [ - hpbar.hpimg:getColor():setRGB(hpbar.v.color)
3 @: h# H* B- ~0 T) R - hpbar.track:addChild(hpbar.hpimg)
* p' O" c, X; w0 d& m - local count = F3DTextField:new() --创建一个文字
9 z$ U1 w7 m3 C, m4 {- C1 p6 w - count:setPivot(0.5,0.5) --血条文字改为居中% Z0 l, r& k9 R; x
- count:setPositionX(20)--变更一下血条x位置
- C0 t; D9 X6 J8 j - count:setPositionY(-10)--变更一下血条y位置
6 ]0 @4 N# D5 N% g3 B - hpbar.pro:addChild(count)--跟名字绑定
: n& p! d4 e" h c' O8 H( v+ I - hpbar.count = count --方便下面随时修改血量
4 E- }7 _4 i, \; N* n! w- a. L8 L1 Y - hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp.."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改4 h/ m1 w% ~+ m' @5 V& h
- --hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp .."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改
) T# B. I$ J/ X. e6 T' |# c+ w - if not hpbar.v.mergehp then$ V) L0 {% y, ]' v
- hpbar.mergehp = nil
7 d V! ?8 z4 Z- ~ - hpbar.pro:setMaxVal(hpbar.v.hpmax)
' ]( i( z }4 W4 L - hpbar.pro:setCurrVal(hpbar.v.hp)" H* s' B8 E7 Y$ m/ y# u
- hpbar.pro:setVisible(hpbar.v.hp > 0)( a7 S/ c- P+ u; z% r
- else
& \6 w# s& G/ {9 O - local hp, hpmax = createMergeHP(hpbar, hpbar.v.hp, hpbar.v.hpmax, hpbar.v.mergehp) I" Y, o: e* G! T. {. R- D
- hpbar.pro:setMaxVal(hpmax)
% C7 `1 e: [7 k3 e - hpbar.pro:setCurrVal(hp)" \" I) r3 b: Y; F
- hpbar.pro:setVisible(hp > 0)2 i, L2 P( ^( y% n4 \( P% Z
- end! b6 H- V: s4 l+ W" m* ]& R
- end
2 T& N% C0 G/ O - function setHPBar(role, hp, hpmax, color, name, mergehp, showname, guildname, namecolor)* C! R( Z3 }6 l3 w5 j. b% v; G
- local newcreate
' ^5 A. p$ _9 ]5 o; l* i% S - local hpbar4 Z/ _# ]5 r% P
- showname = showname or 显示名字 == 1. V- E& ^$ A! Q- Y: K7 T2 n' p
- if role.hpbar then3 ~7 y [3 T. h; D( |" ^
- hpbar = role.hpbar
& g- X) }6 L% }0 I8 z" D( H' W { - hpbar.showname = showname
2 }3 I* J, ]6 `+ N$ H! q0 J4 O - hpbar.namecolor = namecolor
3 z+ s+ o6 p5 A; x: M, @ - else
N$ t" b8 f0 Y7 V& C8 N1 `6 A- h/ [ - if #hpbarpool == 0 then. N2 R t" S8 {9 X; Y, y
- hpbar = F3DLayout:new()/ u- L0 ^& t$ q5 h5 N, g$ g7 v
- hpbar.showname = showname
[" N" b' K6 s2 l) b1 T% p/ h - hpbar.namecolor = namecolor& H% Y$ `; _+ C& c5 U
- hpbar:setLoadPriority(g_uiFastPriority)% u: ^ C! L7 V' P" O% N; p& O
- hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}- H% N3 G3 z8 F/ e4 N0 r
- hpbar:addEventListener(F3DObjEvent.OBJ_INITED, func_oe(onHpBarInit))
: [$ {' F+ q) g/ K9 _ - hpbar:setLayout(g_mobileMode and UIPATH.."血条UIm.layout" or UIPATH.."血条UI.layout")--IS3G and UIPATH.."血条UIn.layout" or + [/ @* S/ W( A: s" l
- newcreate = true
o. U1 U- a: Z! | - else- t4 {4 ]) j( @; K+ K
- hpbar = hpbarpool[#hpbarpool]/ l' M1 x, G- ?7 E5 l
- hpbar.showname = showname
$ F$ \% R4 D. `& ] - hpbar.namecolor = namecolor4 W. F. L) p2 ]2 n% E+ x" x0 Z5 `
- table.remove(hpbarpool)
4 c; A: ` R: V - end" Y6 }/ u( `8 y
- role.hpbar = hpbar
4 D: {% M9 C1 b" h8 S5 B - hpbar:setZOrder(-role:getPositionY())- Z* ^- X1 F2 g2 n2 i. i) y% U
- hpcont:addChild(hpbar)
5 ^: U" `& H# I7 M3 _* x - end( |0 ]- g! n+ E3 x
- if newcreate then
# Y! S2 b' J/ L4 R - elseif hpbar:isInited() then
3 h# g0 l- y: t# _9 v/ O& S - local ss = 实用工具.SplitString(name,"\")
; N0 o$ J! a2 o, P - hpbar.name:setTitleText(txt(ss[1]))
( y6 ~) A3 N9 Q9 y+ ^ - if #ss > 1 then
* p& D& C- q$ c - hpbar.nameexs = hpbar.nameexs or {}
8 b4 D: k# q0 ^- Q5 U! b - for i=2,#ss do
V9 L" ?- f- g' [% [ - local tf = hpbar.nameexs[i-1] or F3DTextField:new()
# \# y! `- X( l0 l7 } - if g_mobileMode then7 S% P' m3 P9 j2 X) t+ \
- tf:setTextFont("宋体",16,false,false,false)
# k8 ^* C; ]2 {: R& P: K - end& d* V5 p& A6 v) H0 \, v& p
- tf:setText(txt(ss[i]))1 _7 _8 `3 J5 H5 U, j, K
- tf:setTextColor(hpbar.namecolor or 0xffffff,0)) `- d7 k. }. S1 u! t
- tf:setPivot(0.5,0.5)0 c1 }' b5 B2 n. V3 D8 J4 q
- tf:setPositionX(0)
$ \9 @4 z: t) Z( \7 s, |% c - tf:setPositionY(50+(i-1)*14)4 ]$ p2 u8 x3 M
- hpbar:addChild(tf)
/ Z/ W: u& h9 |' j - hpbar.nameexs[i-1] = tf% w3 |7 h4 Z% T6 f/ s* d% e# ^6 c
- end
- W+ Y3 t; v/ R$ c$ W8 c' g - end+ y' e3 p: @9 P% h% J
- hpbar.guildname:setTitleText(txt(guildname or ""))
: Z- f; y0 q* s1 [) L - hpbar.name:setVisible(hpbar.showname or role == g_hoverObj)
% [* d- i. n, l - hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)
7 {# `; X* b, ` - hpbar.guildname:setVisible(hpbar.showname or role == g_hoverObj)
9 E7 @3 C7 T8 [! R - hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)
+ h% ]' T3 H6 h1 d2 Z - if not mergehp then& j, P& P- ]" n+ ^- O1 F0 @6 O
- removeMergeHP(hpbar)
0 w" E# m/ g# ]: x4 B2 c: A# E - hpbar.hpimg:setWidth(hpbar.track:getWidth())9 n0 r1 O, d7 |/ X
- hpbar.hpimg:getColor():setRGB(color)( g; j6 \" \2 \4 b+ b
- hpbar.pro:setMaxVal(hpmax)
' V7 v8 l2 w& a - hpbar.pro:setCurrVal(hp)
# _$ a8 S1 E. {* M# U - hpbar.pro:setVisible(hp > 0)
: n- X6 Y% S# k% Z - else
' ?' [9 M+ T, E7 c& Z - removeMergeHP(hpbar)
8 ]. M6 _1 v8 m; M; L( `' L6 Y - hpbar.hpimg:setWidth(hpbar.track:getWidth())
! ~0 f' A/ F/ R9 s - hpbar.hpimg:getColor():setRGB(color)9 j; W: A; u1 b0 @
- hp, hpmax = createMergeHP(hpbar, hp, hpmax, mergehp)6 c5 l; P7 O3 }, m
- hpbar.pro:setMaxVal(hpmax)4 m4 b& K/ Y! u3 i
- hpbar.pro:setCurrVal(hp)0 h2 I2 y' a) z& R& C$ n! L
- hpbar.pro:setVisible(hp > 0)
/ p5 h _/ t# k - end F5 q; ]& a. W7 `1 Z: O
- hpbar.count:setText(txt(hp == hpmax and "" or hp.."/"..hpmax)); n. s% v8 l) c6 ^
- else6 f( t: F k: Y1 O; |- y
- hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}
4 ~" s+ V# \* _ u, d3 e$ U - end
2 v& w! v+ e; M* D3 [% O" C: |& Y - if not role:isVisible() or (hp == hpmax and not mergehp) then4 d/ i V/ g5 O% ?
- hpbar:setVisible(true)--false)% a' E) e4 U( c; V, t" Y
- else
1 F4 p4 X C1 E& t3 k - hpbar:setVisible(true)
\, y7 q6 k8 V6 k2 v( L( O+ w - end, f5 ^7 ?1 s/ @: y! n. J
- end' C1 ^- A- W+ R) l+ D
- function delHPBar(role)4 P; p! P9 ]# u% \
- local hpbar = role.hpbar
" l J/ U4 n+ x+ R U - if hpbar then
+ Z7 @& s4 T7 |: Q P) A - hpbar.showname = nil
( c8 L1 V8 e. l, b, N - hpbar.namecolor = nil
/ ^" x5 a" e t - if hpbar.titles then
, S/ o) W" x$ S9 w7 F+ a& O - for i,v in ipairs(hpbar.titles) do
- l" e* I! Z6 N1 k- H1 G - v:removeFromParent(true)
/ Z% T6 U# Y. P4 z5 n" E - end
% _$ A+ k/ w* @3 P& f% `2 m' v - 实用工具.DeleteTable(hpbar.titles)
! d2 _0 f# p; |- O5 R" L6 \, g* K# X( ? - end- g' R1 X. H7 D: a' K, f/ u$ B
- if hpbar.nameexs then9 O% z" l5 A C9 [% ^
- for i,v in ipairs(hpbar.nameexs) do, u6 Z" C$ f$ {' j
- v:removeFromParent(true)
/ a. j9 c" u. G3 T - end3 S: s. X- t! K. r
- 实用工具.DeleteTable(hpbar.nameexs)3 r# B1 H, a7 `5 f6 R& m. r) r
- end
! D, C+ S0 C, W. R - hpbar:removeFromParent()
8 w# h( }5 p6 y( F6 ?4 } - hpbarpool[#hpbarpool] = hpbar# C/ u8 C: ~1 M1 n7 |
- role.hpbar = nil( K; h U6 u6 y8 q
- end
) V1 _5 G8 y( f- P, B - end: ^7 V2 O6 E, e3 s
- function updateHPBar(role)
: j0 z2 k( h" W2 g8 m - local hpbar = role.hpbar/ z5 P7 d6 m ^* `
- if hpbar then) M1 {) f' Q* l% a9 R" ^
- hpbar:setVisible(role:isVisible())
e `. }5 e" H- d) m" X - end
& Q+ j0 Q! D. ^$ ?7 f - if hpbar and hpbar:isVisible() then l2 D# i% |5 _7 `
- hpbar:setZOrder(-role:getPositionY())& w5 _+ j' i8 z9 N2 E
- local pt = F3DUtils:getScreenPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 20)9 q/ I( x, Z! a6 o/ J
- if pt then
; a% J( ~' ], c- C3 H. J - hpbar:setPositionX(pt.x)
# s- m' b, t- q - hpbar:setPositionY(pt.y)
% G0 K9 @' W& x* F - end
- I, {: T) s2 w8 @6 |& h - end
5 x/ o" {2 I6 t( g. o* W - end
复制代码
z8 ]6 l) D- q+ h u
. [$ g! G2 `% R. Z8 h/ | |
|