|
平常他是不显示的,默认的是只有血条,没有数字! + r" S8 m$ ?% ]! g/ l
1 q; @" Y3 y W; N4 _( G
如果想让他这样显示按照下面方法做: * |; }/ e) Z# S& I' x
! I" w, ~4 t7 S4 \% n. F" L
把下面的lua脚本复制到你服务端 5 Y; E3 M0 s2 v- \* X
n; V) H' e* Y5 Q8 t, K$ h) U
\龙途\Flying3D\scripts\模块\主界面\主逻辑.lua ) V# G% c' ]9 o( S# O( e
8 x# b G6 V+ M, I7 _; F/ x; M里面全部覆盖,注意是全部覆盖!
' `/ t S$ M; o3 q! L) x7 Y, ~. Z& Y& x- M- n3 E/ g
然后重新打包pack
5 t% v0 S a$ I) `! @- module(..., package.seeall): L8 p- j l! b! D) q) f
- local 实用工具 = require("公用.实用工具")
" b% O. D0 y( C* Y6 p& t - m_FlytextPool = {}
" {1 O4 P6 W& Q" I3 h! R' k$ r' ` - m_Flytexts = {}
; W. u9 x5 G4 j - function pushFlytext(flytext)
: M8 J4 y! D8 D4 j* X% o8 f( s - if flytext.minus then
- l) i; W8 f, q9 `( H4 p - flytext.minus:setVisible(false), X! n* ?2 c( ~# l* i) L, v2 C
- end
8 t* d3 A { F - flytext:setAlpha(1)
( S" ^$ f: A6 F- e) H+ ]. E - flytext:reset()
# @- n* Q) T- n1 _; Z" a9 y5 x - flytext:removeFromParent()$ F) ]% J+ W* s
- m_Flytexts[flytext] = nil/ _7 I1 g7 O6 j8 Y+ g) ^6 e
- m_FlytextPool[#m_FlytextPool+1] = flytext
5 k* f5 S6 ]' r3 k; ~+ j - end9 G1 F6 f+ v) K5 L6 r
- function popFlytext()
D8 F. w# d# }) S# ~ - if #m_FlytextPool > 0 then
6 k8 O7 ~5 r8 i - local flytext = m_FlytextPool[#m_FlytextPool]$ Q y) j+ {+ ]# X: q
- table.remove(m_FlytextPool, #m_FlytextPool)* E7 _' O# S2 g+ g4 j1 [! @
- return flytext% S/ t( h4 D1 S0 c1 {
- end) c5 m# M* y! @* B7 ^( }, u3 |
- end' _6 c$ S+ g9 s7 ?0 v
- function showFlytext(role, dechp, crit)( ~' {2 T# U) X
- if 1 then' ?! E& v) w) e5 T& ^* p
- return. c U" ]7 [( c4 F7 P
- end
; O" m0 a4 H& o- S0 L9 Y - local flytext = popFlytext() or F3DImage3D:new()
2 v5 X* O8 t! |4 l, { - if dechp == 0 then
& Q: J$ ]- r/ I M. ?$ W" R& { - flytext:setWidth(0)
6 P3 @9 m/ U! P8 o- N2 ~1 \) { - flytext:setTextureFile(UIPATH.."公用/fight/miss.png")
: Q2 @! O U4 _" X! S - flytext:setOffset(-52, -35)( M2 P$ w" m# N% h0 X/ j7 t6 ?
- elseif dechp < 0 then# b; ]. d8 |7 h# l' S
- dechp = -dechp
9 l0 z( n [* Q - flytext:setTextureFile(UIPATH.."公用/fight/addHit.png")
r2 G2 C8 g; n1 G. o - flytext:setWidth(22)
* ~: a9 h, |# D; ?$ \0 v9 {6 C) R+ U7 c - if not flytext.clips then
j5 H) S7 |- l+ Y; U+ c - flytext.clips = F3DPointVector:new()
( R- d/ Q, m/ Q' Q$ u" | - end
( `7 }. p1 f) x/ W/ [ - flytext.clips:clear()4 a% |7 q4 P" h4 B" v8 I
- while dechp >= 1 do
% x1 @# ?/ B7 L% D- _& {9 @. U; [ - flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22)" e) R9 k7 R2 b% R5 s
- dechp = dechp / 10
; B: M F' F" B1 q! Z! q; l - end" n" H" ?" V/ _* y& P/ K
- flytext:setBatchClips(10, flytext.clips)0 H6 b7 `- \! v% q$ \- R9 X& d
- flytext:setOffset(-22+flytext.clips:size()*11, -50)
. @9 q; p6 P; ] - if not flytext.minus then( [8 X/ i* @" V) p
- flytext.minus = F3DImage:new()
* g. x$ ^7 e' C/ V; ` - flytext:addChild(flytext.minus)# D2 c& ?$ q1 q; H% H3 {
- end3 A8 W" J1 u6 i# v( [
- flytext.minus:setTextureFile(UIPATH.."公用/fight/addFlag.png")' ` T4 P: u5 l6 o0 P4 V
- flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-27)9 r' Z& q: e) t: [, i) J
- flytext.minus:setPositionY(4)
P5 w3 N# D7 [8 U - flytext.minus:setVisible(true)
( A3 w( `1 F x+ A% u7 e9 q$ j - elseif crit == 1 then( ~! m9 N8 ~; A! V/ N, u8 {
- flytext:setTextureFile(UIPATH.."公用/fight/criticalHit.png")- |+ Y. T1 R; i2 _" i
- flytext:setWidth(28)
2 O% ?) ]' u) |7 M2 Y( e6 W( q - if not flytext.clips then
: A5 C: H# I. F6 \1 } - flytext.clips = F3DPointVector:new()
) Z6 z* v0 R% b8 Y1 R% M" n - end
! }/ C! }9 A: d8 N0 o( O - flytext.clips:clear()
q( S( ?9 ]1 z* {: X, M! f, [ G - while dechp >= 1 do% `! U( k, D# U+ o+ H' r$ E! Q. x7 {0 o
- flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*28)
7 O. \+ M( L0 I' W; f! Y4 c# a& @ - dechp = dechp / 10
0 j& F9 t5 ?; u# v8 y' q2 y - end
3 N& x# z/ j8 G4 g+ k8 t( F) U - flytext:setBatchClips(10, flytext.clips)
4 s- |5 }% k, {; \1 @* W8 z* \ - flytext:setOffset(-28+flytext.clips:size()*14, -50)0 j' J) x5 J$ e
- if not flytext.minus then6 m, s7 \0 _: r! J9 [, q
- flytext.minus = F3DImage:new(). v( N8 ~6 O' q6 c1 T; E+ i' J
- flytext:addChild(flytext.minus)% G$ o4 y# G% ?6 b. O
- end' O/ c# ~1 @* v3 b: F' q
- flytext.minus:setTextureFile(UIPATH.."公用/fight/criticalFlag.png")
+ ~, A7 L0 o, ]) a# y - flytext.minus:setPositionX(-(flytext.clips:size()-1)*28-55)
2 D9 `3 `; O, E- [9 x - flytext.minus:setPositionY(-5)+ W3 D( u4 p) ], v( g4 ?. h
- flytext.minus:setVisible(true)5 L/ l0 B* m$ \4 i" Q: C
- else
6 g2 ~0 W/ Q3 P Y: a - flytext:setTextureFile(UIPATH.."公用/fight/otherHit.png")
, Y8 H2 C8 R- T# r0 f8 i - flytext:setWidth(22)0 {' E" T# K% ` g6 Q; s3 q
- if not flytext.clips then1 w8 q- h; ^5 V9 K: n
- flytext.clips = F3DPointVector:new(); t9 C0 S* j- N3 ^& ^7 r
- end
& ^/ R1 y5 B7 }- ~ - flytext.clips:clear()6 S5 x( K! h" G2 S9 ~; Y
- while dechp >= 1 do# Z% o/ l5 p: \
- flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22)# Y- v2 e7 X& \6 E4 V: T5 b# S
- dechp = dechp / 10
* c8 [) Q, B5 _7 { - end
* E! o6 g, r2 e6 k; L - flytext:setBatchClips(10, flytext.clips)
8 C L- H M6 d( W/ m, F. y - flytext:setOffset(-22+flytext.clips:size()*11, -50)
* ~% Z w4 \( C6 J - if not flytext.minus then
2 b+ n9 h: {) i - flytext.minus = F3DImage:new()
5 A$ L; Y% o0 Z2 p2 ]3 x1 m3 g - flytext:addChild(flytext.minus)
, [' e. S8 o) V( {/ t) L - end, w2 E* G7 `: x- h& b2 P0 L5 b1 M
- flytext.minus:setTextureFile(UIPATH.."公用/fight/otherFlag.png")( u6 N" J* `: S1 ^8 u2 L- f0 o$ J+ z
- flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-17)
- c. P5 z. P* h" Q A - flytext.minus:setPositionY(12)
' \& \7 h6 e7 d( Y5 i" [6 Z - flytext.minus:setVisible(true)5 \0 u* t4 n( F* e# e# C: h2 c
- end5 L" Q5 F) Z6 N" Z
- flytext:setPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 10)
5 L3 @, n1 a$ b2 J% R - dechpcont:addChild(flytext)
3 |1 h( M F& ^+ X( p1 v - m_Flytexts[flytext] = 1
7 u8 m( t% r4 q! ~0 h+ p - local prop = F3DTweenProp:new(); h' x3 p/ d! U% O- d' |3 N
- prop:push("offsetY", -100, F3DTween.TYPE_SPEEDDOWN)8 f! x3 R$ @+ h- O1 `
- prop:push("alpha", 0, F3DTween.TYPE_LINEAR)4 K( E+ |- R: m6 s M3 _" r
- F3DTween:fromPool():start(flytext, prop, 1, func_n(function()
9 ]$ A8 g% {$ B7 }% Y - pushFlytext(flytext)--flytext:removeFromParent(true)) H" u2 c2 M0 `4 P# u
- end))
5 w" `: F$ V3 }. q0 f0 ` - end
; U; U( u5 u0 h' C+ l3 E8 A5 q - hpbarpool = {}+ E" h$ A; u: T! _; l$ d4 C& E
- function removeMergeHP(hpbar). a# z4 @3 j: S- r( K& f" Q
- if hpbar.mergehp then
8 H" O/ B& W% B# D - for i,v in ipairs(hpbar.mergehp) do
6 a, _$ ~. }% `- R7 |4 V, y" F9 i, x1 u - v:removeFromParent(true)
6 B$ Q& Q) y) d {: `2 c - end
! O1 _1 \. B% } - hpbar.mergehp = nil
9 ?# L; B/ C. m, D - end
8 I, @2 n0 b: H - end3 P" ]7 q$ P' \+ E$ v, c j
- function createMergeHP(hpbar, hp, hpmax, mergehp)
1 T0 `1 O1 a/ b7 ?0 V7 J) q - hpmax = hp
# K1 r/ J6 y$ `6 ?: ~3 p; ` - for i,v in ipairs(mergehp) do
% I: m3 A4 i. x: O3 {: v - hpmax = hpmax + (i == #mergehp and v.hpmax or v.hp)
" ~ t9 H3 I$ ]+ I1 D& ]7 Z - end- R3 S: p3 f5 e% a
- local perc = hp / hpmax( \3 `" j# m# [0 u
- hpbar.hpimg:setWidth(hpbar.track:getWidth()*perc)5 ]) V9 w& a0 q; D2 C
- hpbar.mergehp = {}% s1 t, B2 q) T4 c4 t
- for i,v in ipairs(mergehp) do3 X: G+ `- ~+ K3 j: Z6 S0 Z& x
- local hpimg = F3DImage:new()
0 x+ S7 `& h' X- {8 B( O. }) E9 C - local pc = (i == #mergehp and v.hpmax or v.hp) / hpmax7 l0 D {3 r2 t4 @' A
- hpimg:setTextureFile("tex_white")
1 ~; D& ?4 k8 F+ w. t9 U - hpimg:setWidth(hpbar.track:getWidth()*pc-1)! B5 D6 m' s, l4 c- u
- hpimg:setHeight(hpbar.track:getHeight())
7 O8 w; ^; K b8 m; ]7 q4 T - hpimg:setPositionX(hpbar.track:getWidth()*perc+1); x0 w0 u2 k0 \- a6 ?& ^( ~+ V
- hpimg:getColor():setRGB(v.color)' z! o2 j8 d. r
- hpbar.track:addChild(hpimg)# e8 X% g, @) M: i2 J) o
- hpbar.mergehp[#hpbar.mergehp+1] = hpimg
7 A- Q4 k, {* ]: C5 e - perc = perc + pc, B7 c6 ^* A( r6 h3 h w* n8 x9 n
- hp = hp + v.hp
3 Z, O) [& w# p3 h' f! N6 m - end
: i% c5 C# _: L - return hp, hpmax( B3 ]3 g R6 v3 R, Z# E+ k6 M
- end
* R, H' y2 r( p7 }, y - function onHpBarInit(e)
" y4 D* X9 ]6 ?' H - local hpbar = e:getTarget()" m4 R2 {2 e8 e: g' {( q& g# R* P
- hpbar.name = hpbar:findComponent("name")5 m6 N0 u2 @4 ]* z
- local ss = 实用工具.SplitString(hpbar.v.name,"\")
* j% X9 v9 c# Y) y, Z1 _9 D - hpbar.name:setTitleText(txt(ss[1]))
4 ~$ _9 u: \) ?; @1 j! o, d% G+ \ - if #ss > 1 then& v* \6 T- |1 V& _! J
- hpbar.nameexs = hpbar.nameexs or {}
& G& M" C) H) u6 f3 [# J2 Y1 ` - for i=2,#ss do
( {4 V- l: {1 G6 A0 H' b - local tf = hpbar.nameexs[i-1] or F3DTextField:new()
% @6 Q. [7 k- u - if g_mobileMode then* k; P5 a5 O. ^) c; [; S
- tf:setTextFont("宋体",16,false,false,false)
, ~6 _3 ^/ t% ?$ j2 c - end
0 _ C6 U- V* {5 A) N - tf:setText(txt(ss[i]))
2 J' ?2 Q$ Q+ e - tf:setTextColor(hpbar.namecolor or 0xffffff,0)
$ x, B% W$ r1 t J: {1 ~ - tf:setPivot(0.5,0.5)/ ]) z2 | Z0 w6 C( o( J
- tf:setPositionX(0)* d6 ~; L1 Z8 G3 B0 {
- tf:setPositionY(50+(i-1)*14)
- d2 j2 l. _0 M$ t% o7 F j - hpbar:addChild(tf)/ \3 E4 O; V: |! K" o
- hpbar.nameexs[i-1] = tf
1 q Q: n# C. u0 x3 g1 z - end4 }. D% m. `- M
- end9 n# | b! @5 O* P: h
- hpbar.name:setVisible(hpbar.showname)
. y# X' s9 i& T - hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)$ Y* R8 G$ v- d" o# A
- hpbar.guildname = hpbar:findComponent("guildname")9 b i- L/ h* V+ y v2 {) J( u% N
- hpbar.guildname:setTitleText(txt(hpbar.v.guildname or "")); `8 ]3 i* y B# c7 h
- hpbar.guildname:setVisible(hpbar.showname)4 ?) l" ]* B/ |6 n% x
- hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)) s4 f0 I/ r( U
- hpbar.pro = tt(hpbar:findComponent("hpbar"),F3DProgress)
' {; O2 e: g9 @! f( h+ Z- w - hpbar.track = hpbar.pro:getTrack()
1 m) r7 B) F* e; H0 c! E - hpbar.hpimg = F3DImage:new()* p, b3 K E9 l+ v8 i' {8 w4 B
- hpbar.hpimg:setTextureFile("tex_white")
: `! q5 J- ^- a' Y- J5 h: z6 n - hpbar.hpimg:setWidth(hpbar.track:getWidth())$ e( j/ T/ b8 N
- hpbar.hpimg:setHeight(hpbar.track:getHeight())
_0 ~3 U+ i0 F* k6 E1 L% e9 s - hpbar.hpimg:getColor():setRGB(hpbar.v.color): Q- j* h3 _" }9 ^. w+ e
- hpbar.track:addChild(hpbar.hpimg)
3 g6 A0 s u# c, p7 W3 K8 T - local count = F3DTextField:new() --创建一个文字
9 H. j# G0 q0 U! Y5 {% _$ e - count:setPivot(0.5,0.5) --血条文字改为居中
4 \9 k4 j8 X* x/ `) I# q - count:setPositionX(20)--变更一下血条x位置
7 Z! u. a0 I$ R( O6 [% ] - count:setPositionY(-10)--变更一下血条y位置3 U8 m8 m- b) \! a! c4 n) j
- hpbar.pro:addChild(count)--跟名字绑定
8 K# c" Q5 ^' f9 r - hpbar.count = count --方便下面随时修改血量
8 @; s6 o! x# v# \ w0 m' t- z n - hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp.."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改
) F5 q5 \: d2 @ n - --hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp .."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改7 a' k$ C0 w! X& |4 V8 }
- if not hpbar.v.mergehp then
+ _$ b+ n1 [7 K8 L4 h' ?4 G0 | - hpbar.mergehp = nil
. C: s1 O$ @! @& N+ l - hpbar.pro:setMaxVal(hpbar.v.hpmax)" C6 S6 O$ B7 r$ m+ J
- hpbar.pro:setCurrVal(hpbar.v.hp)3 E2 r; ?' r; d
- hpbar.pro:setVisible(hpbar.v.hp > 0)9 y6 T. H. U6 Q7 y. e$ {
- else. A5 o/ l, }1 F# b6 c9 G
- local hp, hpmax = createMergeHP(hpbar, hpbar.v.hp, hpbar.v.hpmax, hpbar.v.mergehp)
. q1 k2 W# ~# Q; v6 e - hpbar.pro:setMaxVal(hpmax)& w/ n! y6 T O; q
- hpbar.pro:setCurrVal(hp)
: _* J t* `8 { - hpbar.pro:setVisible(hp > 0)9 G5 c7 w' E# @' Q
- end
6 C) i1 S2 F9 A5 V( B7 a" ~ - end
/ p' T n+ i3 Y6 g: ?, ^6 c - function setHPBar(role, hp, hpmax, color, name, mergehp, showname, guildname, namecolor)
Z* \1 m) n; k$ t$ y# j2 L: L- G3 k - local newcreate* e# g& y% t% ]
- local hpbar
! ~# d3 G( M4 t$ V5 y4 m ^# f3 } - showname = showname or 显示名字 == 1
! I o+ L3 @- ]" `/ f+ t: y9 N5 O2 j - if role.hpbar then9 g8 Y' _+ P9 P2 S- w _7 J
- hpbar = role.hpbar/ _' J1 m% R* d& x4 j& s
- hpbar.showname = showname& ]' c3 B# C5 G1 p8 p2 o2 L1 e2 L
- hpbar.namecolor = namecolor% u& A9 F. x) i
- else- M7 @8 k6 M8 @7 O8 z6 {+ q! r( F
- if #hpbarpool == 0 then* Z' l9 b1 D+ `+ v9 m. R
- hpbar = F3DLayout:new(); A) T5 \7 c, f: l
- hpbar.showname = showname
7 p L- T8 B1 q0 v x+ ]* G - hpbar.namecolor = namecolor1 W0 v( n' k4 s5 N. \6 W6 F
- hpbar:setLoadPriority(g_uiFastPriority); ?+ Q0 n9 {+ W2 Q, b4 _
- hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}9 ~3 t6 q# x G4 V9 F O
- hpbar:addEventListener(F3DObjEvent.OBJ_INITED, func_oe(onHpBarInit))
) O, a& k9 D/ U4 g/ P - hpbar:setLayout(g_mobileMode and UIPATH.."血条UIm.layout" or UIPATH.."血条UI.layout")--IS3G and UIPATH.."血条UIn.layout" or * K0 f7 ~" X ]/ f5 _
- newcreate = true+ `- ?+ ^4 g# \( N2 H# p
- else2 j0 T% U3 d# {" u& ?$ U
- hpbar = hpbarpool[#hpbarpool]
/ V9 ~. i* n! ]( x$ f - hpbar.showname = showname
( v# v9 [5 l9 D3 s+ d7 b" R - hpbar.namecolor = namecolor7 j2 \+ f2 T$ p6 j4 n
- table.remove(hpbarpool)( {, v0 F4 d }) b, i
- end
9 I/ D/ y2 c, T1 ^' A5 Q( P9 j - role.hpbar = hpbar( J4 z' m: T1 W
- hpbar:setZOrder(-role:getPositionY())2 i1 K" U) Z0 F
- hpcont:addChild(hpbar)6 f l2 {* X$ ~# U# w
- end+ ^' A% I1 w5 U
- if newcreate then. X" `9 x9 y& Y* R/ n! w
- elseif hpbar:isInited() then
- W, ?. D$ O" t! ~3 l+ j5 C - local ss = 实用工具.SplitString(name,"\")
4 l9 f! b+ N$ E; j - hpbar.name:setTitleText(txt(ss[1]))4 \+ L, m w- k8 h. R
- if #ss > 1 then
8 ~; A! @0 L8 w) f1 e1 | - hpbar.nameexs = hpbar.nameexs or {}. t `6 v9 A+ R- r! K2 q0 G7 e
- for i=2,#ss do
/ v. o2 d+ Y$ _5 ]: Q9 c8 r - local tf = hpbar.nameexs[i-1] or F3DTextField:new()" f0 V8 g7 W$ _, C
- if g_mobileMode then! v* ]6 E# O/ d8 ]& G; N7 E
- tf:setTextFont("宋体",16,false,false,false); ^# x7 @* X( g$ W2 Y
- end
: m+ l0 ~ n E' A! Q3 S. d. t, x- q - tf:setText(txt(ss[i])): @8 N' H( D2 N8 G3 T
- tf:setTextColor(hpbar.namecolor or 0xffffff,0). w1 D, [+ I/ A% x# K0 ^
- tf:setPivot(0.5,0.5)
7 [7 m4 B& K8 x8 ~ - tf:setPositionX(0)
2 ?: m; \4 S+ H+ B* z# B- x/ v - tf:setPositionY(50+(i-1)*14)
P6 P2 F: p3 [2 W5 h5 ^; E& K - hpbar:addChild(tf)6 k! v/ A: T; p l
- hpbar.nameexs[i-1] = tf& p" t, _/ \: P( x, _5 _/ [3 u5 S
- end% E; G/ {# j2 v" d
- end
7 ?0 Y h, a) ` - hpbar.guildname:setTitleText(txt(guildname or ""))( q5 n, T2 k1 h
- hpbar.name:setVisible(hpbar.showname or role == g_hoverObj)
7 r* ?$ d$ v5 S3 K3 f% ?* K0 w - hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)0 }! {6 g% l: ~$ c4 m
- hpbar.guildname:setVisible(hpbar.showname or role == g_hoverObj)
9 H* ^" \5 I& {$ b8 @& F6 N - hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)
: n n$ G" {. r' d: v3 ? - if not mergehp then) W) k" I( R. W% d6 Q
- removeMergeHP(hpbar)6 _$ ?5 T0 M4 L, g1 l6 ^1 c+ n
- hpbar.hpimg:setWidth(hpbar.track:getWidth())
7 M& t, D- v- ~+ v; i- l: h( M f$ ^ - hpbar.hpimg:getColor():setRGB(color)
6 J( ~! z2 p% P2 z - hpbar.pro:setMaxVal(hpmax)
z0 N+ {& A4 x& Z% G/ C8 i - hpbar.pro:setCurrVal(hp)
: e" M; d* y7 v( ^ - hpbar.pro:setVisible(hp > 0)1 w: D; o! t, A# i' W9 I/ _
- else
' L* ?; I. d. J& l8 o. S( N- D - removeMergeHP(hpbar)) [ e2 j: I6 G; J. L) {; j
- hpbar.hpimg:setWidth(hpbar.track:getWidth())
' X3 J5 D2 }2 g. B2 ` - hpbar.hpimg:getColor():setRGB(color) Y( l/ N6 @# w: ~7 i, z
- hp, hpmax = createMergeHP(hpbar, hp, hpmax, mergehp)& m3 }5 H' @# R5 J' i' v( e6 s
- hpbar.pro:setMaxVal(hpmax)
3 k' \0 v; C f+ n& ?! T ?& Y5 { - hpbar.pro:setCurrVal(hp)
& L+ c- G, E# i" M, m - hpbar.pro:setVisible(hp > 0)7 s! g( h5 r# I: M) q! k
- end+ {, q1 W* @+ F: Q" r. C
- hpbar.count:setText(txt(hp == hpmax and "" or hp.."/"..hpmax)) J+ Y+ a7 |. K' K# V
- else
5 _/ \- f0 G# c* B1 c* Y0 v: O6 E - hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}# n% K9 ?7 s* _7 p% D7 K% @: L, d
- end
" C1 f [$ B' h# z$ Y - if not role:isVisible() or (hp == hpmax and not mergehp) then, Y7 {6 h: w6 p0 c
- hpbar:setVisible(true)--false)
4 R/ ?2 b1 @3 X- m - else
; l) U1 H0 ]7 c% i - hpbar:setVisible(true)( Q1 ^2 O2 Z% M( V4 T
- end$ o) e L6 T: r! E' A
- end
* V L b# ~! X% G" C) c j - function delHPBar(role)
7 S0 n4 K2 x5 m! N! U$ W - local hpbar = role.hpbar
7 ~2 { w! h" m - if hpbar then
: q" H! O6 j2 w, V- F - hpbar.showname = nil
! T5 U/ ]; @' y' M9 _ - hpbar.namecolor = nil0 C3 ]- o4 f2 b, _/ ?) I
- if hpbar.titles then4 e5 R" \+ \/ d% z7 o& W
- for i,v in ipairs(hpbar.titles) do M! g) w O) b+ q6 `9 ?
- v:removeFromParent(true)
) G1 P5 x4 l! B( O+ p - end3 N, w* J: j J- |2 c* o" e" B- Q
- 实用工具.DeleteTable(hpbar.titles)* H) b( o7 [ j* a+ ? w1 X' @. _
- end# t: F: S2 C# \( |# O
- if hpbar.nameexs then5 |% f6 _2 W& }5 @3 t
- for i,v in ipairs(hpbar.nameexs) do
$ u9 z& ^' v2 R# O* Q7 F - v:removeFromParent(true); u) H6 `, ]* y% Y2 f5 H0 G+ }
- end
% U" p3 c8 m4 `" a U8 g+ |' |2 P - 实用工具.DeleteTable(hpbar.nameexs)) ]0 H; R# L/ G( e" k- p
- end5 I' F9 y. B& O/ J$ x% ?
- hpbar:removeFromParent()
f; h6 i D) H% e0 y+ p2 B" Z - hpbarpool[#hpbarpool] = hpbar5 K) A3 I \* L: m" I
- role.hpbar = nil
/ R6 W7 {. p8 n1 F8 T - end; M. c( {# |% z( a( `9 { W
- end
' P5 j! t* I+ o; } - function updateHPBar(role): j0 R9 y4 T2 W- Y& \/ E- x
- local hpbar = role.hpbar5 h7 F; G2 ^ l4 L: m' Z, r! d) T5 f
- if hpbar then( r1 O/ L5 d1 d2 p
- hpbar:setVisible(role:isVisible()). d' q% D0 n9 u. b0 u
- end
+ v* b4 n( G0 O: b; X1 z - if hpbar and hpbar:isVisible() then
; K2 X L9 u9 [ - hpbar:setZOrder(-role:getPositionY())
: L, \5 [. d. U - local pt = F3DUtils:getScreenPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 20)0 A' ^; |: ? T% ^- }
- if pt then) D! q8 F6 F, B; Y
- hpbar:setPositionX(pt.x)
{8 x$ ?9 B, p* c$ ?9 p | - hpbar:setPositionY(pt.y)
. o4 H' [( A$ d- A - end# L5 F) A0 t, G6 \2 ?: i! }/ l
- end
$ J# Y2 s) {; ?* C% \; X/ a' V) G - end
复制代码 ) Q2 \# E7 d5 T5 s3 L& s
$ W1 w0 B, [3 G1 ^
|
|