|
平常他是不显示的,默认的是只有血条,没有数字!4 T0 B$ p* O l& } W/ K
/ N. h3 O4 L3 a6 x. h3 B如果想让他这样显示按照下面方法做:0 _3 B$ n: w" ~: \: U: f" A
7 Z" M7 n2 P) L9 ~0 J& C* {
把下面的lua脚本复制到你服务端$ e# O; Z' W/ J
+ o: h1 ]$ k% O: s; b8 a, S3 X
\龙途\Flying3D\scripts\模块\主界面\主逻辑.lua
F2 P0 K. A, n% X
# G. V+ C% f I5 _里面全部覆盖,注意是全部覆盖!1 V9 R# h' a" g6 H
7 X4 ^" z( | X4 k6 q/ e然后重新打包pack- v/ `! c6 N: G3 |- K
- module(..., package.seeall), c# |- p- W4 @$ H: z
- local 实用工具 = require("公用.实用工具")
/ I6 F0 v2 v. N8 k - m_FlytextPool = {}
! t: u0 w7 \' B6 y - m_Flytexts = {}" N+ I$ w7 W- {/ d/ b
- function pushFlytext(flytext)
3 U, n. r- R. {5 V$ n) n. r+ L- ^, Z - if flytext.minus then4 P: ^6 S+ Z. y- J, G( r: L
- flytext.minus:setVisible(false)
! r* i2 |# \5 W2 S7 w5 z - end4 d$ }$ S$ n# P0 C0 U
- flytext:setAlpha(1)
% T" J% ~+ ]/ }- Z4 {; p7 a$ \/ F9 ? - flytext:reset()
0 G: @, V3 x. M# {2 M2 Z - flytext:removeFromParent(). y$ G# i" {$ p, W w
- m_Flytexts[flytext] = nil* t" A) M. A! x0 h1 z4 F
- m_FlytextPool[#m_FlytextPool+1] = flytext }/ N; A$ z9 p6 H9 U/ y6 [
- end6 ~2 i/ A8 |% [# j/ F% Y7 U
- function popFlytext()
/ p( f I5 O3 c- ` - if #m_FlytextPool > 0 then
5 i( {" r4 Z* v3 ]: U3 I - local flytext = m_FlytextPool[#m_FlytextPool]
% g' h0 a0 H: K! I# w7 E - table.remove(m_FlytextPool, #m_FlytextPool)
3 m- S8 d& v( ?* q - return flytext
8 I1 |7 \, d! p9 U - end
$ |+ m) [6 i- c ] - end
' ?; {5 U4 M# ]2 b0 P7 o - function showFlytext(role, dechp, crit)
9 @' {7 B4 H2 ]$ q j8 c- K, |7 s - if 1 then
" M# F# J i0 e- P; T) D5 x8 [ - return! n3 m! s6 M' D
- end3 P& K _7 P7 ?' K5 F( S
- local flytext = popFlytext() or F3DImage3D:new()
" S9 R7 \3 \# a4 t - if dechp == 0 then$ U8 r U7 P- g2 O: W( t
- flytext:setWidth(0)
( c1 h. J! u3 ? - flytext:setTextureFile(UIPATH.."公用/fight/miss.png")5 I5 P: ]- r& ~) E* B) U$ ~. q
- flytext:setOffset(-52, -35)* ~' {" ?0 x& E0 \8 }4 J
- elseif dechp < 0 then0 a. E- R$ V) n- z9 {1 t- [
- dechp = -dechp
]0 Q7 v5 N [( @% q- ]; Z - flytext:setTextureFile(UIPATH.."公用/fight/addHit.png")( l6 C, M3 d8 R
- flytext:setWidth(22)( Q4 h3 F3 H' V5 G( d
- if not flytext.clips then; y$ Y, N) F1 s0 m
- flytext.clips = F3DPointVector:new()3 n! _0 B- t0 |; V
- end4 m' Q& d: b; p7 g3 J8 A7 d
- flytext.clips:clear()$ i3 D8 w. }- P* |! L, |% P/ q0 w
- while dechp >= 1 do% z5 ^: Z- Q0 u, a; X
- flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22): V; u2 o5 W/ T" i, r! }
- dechp = dechp / 10
7 G8 E3 Y- ?; q" J! o* @: V4 r+ I - end6 g; D0 b( D2 H. s) z5 h
- flytext:setBatchClips(10, flytext.clips)
* e" C3 E0 s# }- w - flytext:setOffset(-22+flytext.clips:size()*11, -50)1 G* o* v8 q: s" G- Y2 ~, Y8 v' o7 K* n
- if not flytext.minus then
5 s# n) j1 q$ W5 \) e: Q - flytext.minus = F3DImage:new()# t* ]1 A, W8 O# W4 o: ]
- flytext:addChild(flytext.minus)# C5 v8 R! h9 h/ b5 U" x
- end! i( N& i- Q0 U* o, E' E+ {
- flytext.minus:setTextureFile(UIPATH.."公用/fight/addFlag.png")
& r( j! g& @: |8 q3 {$ s - flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-27)! i% @; ~$ X: `( {! n
- flytext.minus:setPositionY(4)
3 C" d! N; z' `" e/ m - flytext.minus:setVisible(true)
8 h9 j" d! t6 H - elseif crit == 1 then
m# p' g# B/ B* J# l/ w - flytext:setTextureFile(UIPATH.."公用/fight/criticalHit.png")
- m) {6 Z' p* B - flytext:setWidth(28)1 p ^0 `) F n
- if not flytext.clips then+ [! k- k$ E- {- i4 L/ D
- flytext.clips = F3DPointVector:new(): \9 i8 w9 h( a+ @& ]
- end
' W: y ^3 m, I: `% U, s - flytext.clips:clear()
( ~ T4 e! }7 B; Z - while dechp >= 1 do, ^% B8 P" i9 @8 c! e! i) ^ H/ p* P
- flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*28)1 n" n; E) Q+ h! T8 ^. ?2 J& M
- dechp = dechp / 10) x6 r9 p6 L( H0 N
- end
0 \) Q3 x0 C# t - flytext:setBatchClips(10, flytext.clips); U5 ]9 z) i* e& P) D- s, O
- flytext:setOffset(-28+flytext.clips:size()*14, -50)* [: S1 f3 Z0 p; z! X7 V7 x" H
- if not flytext.minus then
4 {( H& K/ b% k8 Q - flytext.minus = F3DImage:new()
+ X" `, H! y* u( T9 e( j4 k9 R - flytext:addChild(flytext.minus)# G7 G' ~6 U5 b) Q0 P3 l5 F! A: G
- end& C& G# i2 v* |
- flytext.minus:setTextureFile(UIPATH.."公用/fight/criticalFlag.png")
# ?1 p; K2 V/ H/ B - flytext.minus:setPositionX(-(flytext.clips:size()-1)*28-55)) U+ h( ~; }! H% X$ z; q
- flytext.minus:setPositionY(-5)* ?! b6 B o; G3 @
- flytext.minus:setVisible(true), E' `# r4 C, R
- else
% S/ L3 {! \7 A - flytext:setTextureFile(UIPATH.."公用/fight/otherHit.png")( n, b' `: c3 i7 T/ x2 [. K- u- v" j8 R1 c
- flytext:setWidth(22), y/ M6 l- Q0 @+ l ^5 Z8 D5 ?: z1 Y" [
- if not flytext.clips then Q. ]; M' K. F
- flytext.clips = F3DPointVector:new()
# ~! d- p$ l) Z" { - end
" ?. v& ] Z. v [* a- G* c* @ - flytext.clips:clear()% o7 `" F) D1 J1 I- v
- while dechp >= 1 do2 |6 v* [; ~+ P* l2 f
- flytext.clips:push(math.floor(dechp%10), -flytext.clips:size()*22)
" q% [3 n2 M4 b - dechp = dechp / 10
2 v$ s" Q: j: V; |% o3 H7 }; R: d" r - end
& a( X! h9 r# [8 W/ { - flytext:setBatchClips(10, flytext.clips)
4 t- n$ K2 Q8 M# g3 u$ q& b - flytext:setOffset(-22+flytext.clips:size()*11, -50)
- |4 k& ?' J% C* l2 c3 E+ ^ - if not flytext.minus then
) L/ V) ?1 L" W8 L5 h - flytext.minus = F3DImage:new()
z! r8 g5 l o# E2 i( w5 t' P8 j - flytext:addChild(flytext.minus)
0 `; m' Z8 S+ E - end
( S5 u+ e) `; s. [9 c3 p - flytext.minus:setTextureFile(UIPATH.."公用/fight/otherFlag.png")
3 M9 w+ M6 j! F8 H$ J - flytext.minus:setPositionX(-(flytext.clips:size()-1)*22-17)
/ ~2 I/ Y" G5 f r - flytext.minus:setPositionY(12), Y0 l; w0 q% j# n0 ^
- flytext.minus:setVisible(true)) a9 z$ v4 N- j
- end0 I2 n7 g; f& K, D X+ ^4 z
- flytext:setPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 10)+ e; I1 B) s& d# }" r
- dechpcont:addChild(flytext)4 x; x/ t \2 ~+ H
- m_Flytexts[flytext] = 1, @1 ~1 {; b) K2 p
- local prop = F3DTweenProp:new()% n" t3 _8 k8 D( } B- o9 T9 Y
- prop:push("offsetY", -100, F3DTween.TYPE_SPEEDDOWN)
- O* {$ Q$ P- s8 F - prop:push("alpha", 0, F3DTween.TYPE_LINEAR)/ V0 ? W/ R9 v5 S6 r+ C# Y" u
- F3DTween:fromPool():start(flytext, prop, 1, func_n(function()
. {: D5 {- S0 J' r2 F* `3 Y( Y, W - pushFlytext(flytext)--flytext:removeFromParent(true)/ s: `- E. D) G2 M+ v
- end))) z5 s5 T! X- T# t3 d! V; D8 D
- end) M- J7 x2 R$ s, o% j$ s7 ^
- hpbarpool = {}* g: |$ g0 m6 }
- function removeMergeHP(hpbar)' B' A1 k$ L% X7 T
- if hpbar.mergehp then3 o* C! E2 n6 `$ v, F8 T
- for i,v in ipairs(hpbar.mergehp) do
8 W/ |4 _* F/ K$ v( o& \ - v:removeFromParent(true)
! b3 z/ e J; ^3 x - end
2 Y6 U( P R1 E) Z- u2 M+ U - hpbar.mergehp = nil& E8 K6 ?3 C) ]! B# W" U* E7 g
- end/ a B+ @9 D3 T
- end
0 c Z0 K4 m. G6 ~& f - function createMergeHP(hpbar, hp, hpmax, mergehp)1 B" C; t9 W8 J& D( t" x( g7 k1 b3 x
- hpmax = hp" x5 Q4 D* T t: w7 ] J
- for i,v in ipairs(mergehp) do S2 }1 m# w3 y2 }9 e$ p
- hpmax = hpmax + (i == #mergehp and v.hpmax or v.hp)
3 f0 [& V b' @: t2 E, N U+ r9 K - end
% r; i; P0 C/ @1 n - local perc = hp / hpmax. n, \# o; w1 G& _) o% E7 S
- hpbar.hpimg:setWidth(hpbar.track:getWidth()*perc)/ w( U+ s# F9 W
- hpbar.mergehp = {}
, e6 S9 b9 |0 T; N2 S - for i,v in ipairs(mergehp) do
, b" ~0 N# ]3 k) ^5 R3 b9 I2 e$ } - local hpimg = F3DImage:new()
' @# k5 A9 G" S - local pc = (i == #mergehp and v.hpmax or v.hp) / hpmax
$ w5 y# n5 O+ y0 v - hpimg:setTextureFile("tex_white")1 E' Z! z0 R" e7 a6 b3 r4 A3 i+ \
- hpimg:setWidth(hpbar.track:getWidth()*pc-1)
+ P7 ^7 m* r: @8 o: ? - hpimg:setHeight(hpbar.track:getHeight())# K- q3 g& f3 t
- hpimg:setPositionX(hpbar.track:getWidth()*perc+1)
+ Y+ _. N9 C1 l0 [/ G - hpimg:getColor():setRGB(v.color)
3 `) C$ v+ G% j4 F; G$ h1 C - hpbar.track:addChild(hpimg)
2 h0 I# N7 C& Y- i5 F$ U - hpbar.mergehp[#hpbar.mergehp+1] = hpimg
# A# Y5 A+ y0 v4 R: }& } - perc = perc + pc2 _% B9 p: S/ {. A2 Q
- hp = hp + v.hp
# o# t% J, E; ^- I* K - end6 p( L1 Z/ C4 [: u! p# z
- return hp, hpmax
) i* s7 T: |3 Q; E3 o7 I - end! m7 l/ P) d1 r% V& d
- function onHpBarInit(e)6 {. ]0 k* ?! b2 ?
- local hpbar = e:getTarget()
8 D1 E7 N- z8 B5 Y8 k* H+ H - hpbar.name = hpbar:findComponent("name")
# q: z" V" H2 n - local ss = 实用工具.SplitString(hpbar.v.name,"\")
. _+ y" d1 m$ _' q - hpbar.name:setTitleText(txt(ss[1]))
+ J. q0 J0 ~* Y0 F! y/ _( z: m# L7 p - if #ss > 1 then) o, ]8 o; z3 n: |9 t& S1 [1 J6 N
- hpbar.nameexs = hpbar.nameexs or {}
( j& ^: v2 s8 b5 D - for i=2,#ss do9 V8 [5 }- F$ n
- local tf = hpbar.nameexs[i-1] or F3DTextField:new()$ Y1 s) h& b4 ?1 h5 B& k- a/ T
- if g_mobileMode then, @8 H7 P8 `6 {. P8 E! s
- tf:setTextFont("宋体",16,false,false,false)
x7 F, w# D0 n! u' j, _ - end2 M$ a- ~" k q0 D# ]1 B
- tf:setText(txt(ss[i]))0 p3 j! P, u0 T
- tf:setTextColor(hpbar.namecolor or 0xffffff,0)/ h8 K9 p4 S, A$ W1 i) e7 S
- tf:setPivot(0.5,0.5): ?0 Y) b/ {1 ]
- tf:setPositionX(0) u$ O+ A5 w- t; q; ~5 a+ I
- tf:setPositionY(50+(i-1)*14)
! N y9 |5 r+ j - hpbar:addChild(tf); k Y7 T' p; ~+ ]% k
- hpbar.nameexs[i-1] = tf
2 |6 A% V9 }- f! ]2 S - end7 q1 }7 [6 ^' [) l# t
- end$ r9 A. u9 Y) D: _( k* W4 p W; Y
- hpbar.name:setVisible(hpbar.showname)- L, c# h% w# x4 d; n" ]) Z
- hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)
) U# [1 P; |+ p, D$ w! h - hpbar.guildname = hpbar:findComponent("guildname")
: x+ G- r8 ~( E4 j* D - hpbar.guildname:setTitleText(txt(hpbar.v.guildname or ""))
2 N+ R s; G$ v: }( o: S - hpbar.guildname:setVisible(hpbar.showname): B( E& v% y8 D* |" d- S
- hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff): k; \8 x: C: U
- hpbar.pro = tt(hpbar:findComponent("hpbar"),F3DProgress)
, c9 V: o$ F8 R# p9 R - hpbar.track = hpbar.pro:getTrack() \+ J& |5 O' q H
- hpbar.hpimg = F3DImage:new()5 I2 f, K0 X. ^6 H9 e
- hpbar.hpimg:setTextureFile("tex_white")! G( J$ y D% \: e) u
- hpbar.hpimg:setWidth(hpbar.track:getWidth())
: H% k {8 @6 W3 T9 d, E6 K - hpbar.hpimg:setHeight(hpbar.track:getHeight())+ @. ~9 `0 B! c4 i
- hpbar.hpimg:getColor():setRGB(hpbar.v.color)
% O2 \4 h3 E. d4 a+ q - hpbar.track:addChild(hpbar.hpimg)
. G5 g' v6 g$ T- P - local count = F3DTextField:new() --创建一个文字1 H4 T' u P8 F* B) B* \
- count:setPivot(0.5,0.5) --血条文字改为居中, P' D) X0 U: a5 z# M+ F
- count:setPositionX(20)--变更一下血条x位置
& z3 s L& T$ p9 ^% t' d5 a - count:setPositionY(-10)--变更一下血条y位置. W: k: w1 {, J
- hpbar.pro:addChild(count)--跟名字绑定
9 i$ h/ b; [. K; A$ }8 p - hpbar.count = count --方便下面随时修改血量! w8 b% t/ e$ _% ^
- hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp.."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改0 w. r" @& t9 w, \, j
- --hpbar.count:setText(txt(hpbar.v.hp == hpbar.v.hpmax and "" or hpbar.v.hp .."/"..hpbar.v.hpmax))--变成血量在其它动态变更的地方都做一下修改
+ H5 s# |1 O. A- y6 B. o) w - if not hpbar.v.mergehp then
+ d- g; \/ c1 T k( z2 K" q - hpbar.mergehp = nil
) h4 o4 ~/ N6 r' k; F6 J# p - hpbar.pro:setMaxVal(hpbar.v.hpmax). T) W7 ]( a/ l( s( c; P2 c P
- hpbar.pro:setCurrVal(hpbar.v.hp)
! }5 t1 n/ E1 \, @9 @) t* s, c. \1 r - hpbar.pro:setVisible(hpbar.v.hp > 0)
: e/ {5 s' p' w- O3 c# T - else
* g, t5 l. F1 [% N5 s& z% ` - local hp, hpmax = createMergeHP(hpbar, hpbar.v.hp, hpbar.v.hpmax, hpbar.v.mergehp)
0 C/ M" Z; ]2 C6 f1 e8 i. M! j - hpbar.pro:setMaxVal(hpmax)& E Z8 C# Z- @ P
- hpbar.pro:setCurrVal(hp)/ u0 X: [/ f# v1 `' n
- hpbar.pro:setVisible(hp > 0)! H& A1 ?$ {8 U+ x; g1 G0 J; {
- end
5 |3 P5 }3 W1 a5 O6 C$ g; w - end
" q% J" c1 Q) Q- [* N - function setHPBar(role, hp, hpmax, color, name, mergehp, showname, guildname, namecolor)
4 d \, O6 I9 {; D: M* v6 m. w - local newcreate7 k6 D/ h0 v9 `0 o2 M
- local hpbar
; O9 [4 @% u! N7 s- {9 H1 [+ z% { - showname = showname or 显示名字 == 1
$ G& ]) B4 a2 C( i$ `& V - if role.hpbar then
& j$ i: R {$ y! I2 { - hpbar = role.hpbar
* Z: ]9 A+ g; b3 x" c8 q - hpbar.showname = showname
L0 M H5 s$ `: Z( S1 W# V - hpbar.namecolor = namecolor
6 e0 g& z$ E6 ?' ^' U - else
J, A# f9 c, R - if #hpbarpool == 0 then' L9 v' _4 S1 `! O& D
- hpbar = F3DLayout:new()! r6 D6 y( V" j) X5 ~6 F/ q8 O: g
- hpbar.showname = showname
. c8 O& v6 k% R9 M. j9 M6 [ - hpbar.namecolor = namecolor
# q. A# T+ J7 O2 ?, u2 P: z - hpbar:setLoadPriority(g_uiFastPriority)/ [5 x K& P' y( U
- hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}
) F5 ^8 ~" i( k* `: a, ~6 R) R - hpbar:addEventListener(F3DObjEvent.OBJ_INITED, func_oe(onHpBarInit))) B+ d& w, I2 s
- hpbar:setLayout(g_mobileMode and UIPATH.."血条UIm.layout" or UIPATH.."血条UI.layout")--IS3G and UIPATH.."血条UIn.layout" or
0 Q' ~/ m+ m! r$ L. n9 g - newcreate = true
5 }: y" I6 X' z/ D( x" k7 P+ ] - else5 w0 i3 Q5 B" a O8 T4 n- A9 f
- hpbar = hpbarpool[#hpbarpool]' P7 D% ?9 g) X/ ]0 ?. `3 I
- hpbar.showname = showname3 v6 P% c5 G3 y& z& W6 P. H
- hpbar.namecolor = namecolor
9 z( J$ l0 I5 W: _6 @. | - table.remove(hpbarpool)
& r( ]7 M/ i5 c7 h( J - end% O) R4 U/ y( [1 ?+ J* z3 j
- role.hpbar = hpbar
4 F$ Y% b# K0 U4 p2 ~* H - hpbar:setZOrder(-role:getPositionY())# }' W3 s6 u$ O: i+ ?5 g. S
- hpcont:addChild(hpbar)
5 Q. _& S8 M2 K - end3 { _. a( A6 J. c/ x: n* f
- if newcreate then+ u9 a2 _' O$ Q9 s7 g; e5 s
- elseif hpbar:isInited() then# S3 y# K; i# e9 \! q- z" \, Y
- local ss = 实用工具.SplitString(name,"\")! n9 L5 [. I; J: H1 V: u( r: X$ v
- hpbar.name:setTitleText(txt(ss[1]))
: c4 N6 P# o& m/ g$ O - if #ss > 1 then
2 v: U( e# h$ @# I2 \# r - hpbar.nameexs = hpbar.nameexs or {}
9 j- Q- R p. U4 Y6 } - for i=2,#ss do
* z1 N; q2 K1 G, |& J& A7 ? - local tf = hpbar.nameexs[i-1] or F3DTextField:new()
+ n1 m& B! q5 O/ y3 J - if g_mobileMode then
9 S4 i! I5 i' b' ^( y - tf:setTextFont("宋体",16,false,false,false)+ C0 N: ^* X( j8 {: O# o
- end2 l+ x3 y1 \5 I8 Z, Z
- tf:setText(txt(ss[i]))
( r6 a6 t. c2 `3 b* d - tf:setTextColor(hpbar.namecolor or 0xffffff,0)
2 y' o! g2 T2 }( l7 l - tf:setPivot(0.5,0.5)
8 c; z/ \" z" N h4 _3 u - tf:setPositionX(0)
0 Y6 x% j2 w# b6 ^& w - tf:setPositionY(50+(i-1)*14)
" K' t2 {5 M% ^( \, H E( U8 }2 ` - hpbar:addChild(tf)
! M- o! X' Y9 N; t" J$ M - hpbar.nameexs[i-1] = tf; o: b+ O# h# H0 i8 l
- end$ A- ]' Y$ [6 F! x$ x( _6 R4 K
- end: Y9 W9 ` E" ]2 r& U' j& t3 p
- hpbar.guildname:setTitleText(txt(guildname or ""))3 Q& }, a1 F3 ]2 M; p( l, Q
- hpbar.name:setVisible(hpbar.showname or role == g_hoverObj)
) P0 H0 G6 G# ]9 M3 t" k* ~6 Y- b - hpbar.name:setTextColor(hpbar.namecolor or 0xffffff)
5 W6 H' f5 m" s: v - hpbar.guildname:setVisible(hpbar.showname or role == g_hoverObj)
- N, v. e: y0 n) B& M - hpbar.guildname:setTextColor(hpbar.namecolor or 0xffffff)$ \ @+ [ T& _! Y# d$ G) l
- if not mergehp then
8 u8 h' u- m' R - removeMergeHP(hpbar)
5 s8 \$ ?" `* }) ?1 } - hpbar.hpimg:setWidth(hpbar.track:getWidth())/ K/ J4 Z0 G. Y/ I+ |
- hpbar.hpimg:getColor():setRGB(color)
% ~: \6 n% i' p' J. W" d8 \1 W# W - hpbar.pro:setMaxVal(hpmax). h) }3 u! t0 n# S0 E% M/ c. h% M
- hpbar.pro:setCurrVal(hp)
2 d' X2 p2 P' z3 S& }3 X k - hpbar.pro:setVisible(hp > 0)3 }1 k0 t0 i; S5 w
- else8 s# t0 c$ ?1 X5 n- c
- removeMergeHP(hpbar)2 P) O9 [: a q+ D8 J7 ?
- hpbar.hpimg:setWidth(hpbar.track:getWidth()), B" D, o, ~' ^* S% C
- hpbar.hpimg:getColor():setRGB(color)
# V: u$ e! q! ]: y) r3 |( {# L5 {1 b - hp, hpmax = createMergeHP(hpbar, hp, hpmax, mergehp)) ~( J: ~- s/ R
- hpbar.pro:setMaxVal(hpmax)
/ o& |, H, q* S: D5 Y' m4 Y - hpbar.pro:setCurrVal(hp)' h" n# o/ ~# [3 s0 Q& }0 h3 @
- hpbar.pro:setVisible(hp > 0)
# f( ?7 o5 ~! Q3 }/ E1 z& B0 U* R - end
5 O4 z' \% t5 T6 S$ }: s, q. h& J - hpbar.count:setText(txt(hp == hpmax and "" or hp.."/"..hpmax))
' y' n4 P% Z: _6 ^4 i: ?: W - else
" G T) a2 h0 p$ U, f8 V% j) B - hpbar.v = {hp = hp,hpmax = hpmax,color = color,name = name,mergehp = mergehp,guildname = guildname}
9 F# W, I$ ^5 m) F: K+ Q - end
% |9 V0 W K6 k1 ]; W* { - if not role:isVisible() or (hp == hpmax and not mergehp) then
: r8 c% l) b( F1 u. h1 q - hpbar:setVisible(true)--false)4 t/ Q* d* @9 C4 V
- else* t4 N! h7 ~( `
- hpbar:setVisible(true)
9 J0 R3 r0 |0 ^: f2 b* }1 M - end9 e( W$ J2 N8 V6 F9 c" q! N8 I
- end
: D2 z: s% k$ S" B2 n: i - function delHPBar(role)
3 Y: [, p2 H7 W% @% ? - local hpbar = role.hpbar, L: v' ~+ ~ G* u2 F% @; i
- if hpbar then% \1 \: G% }" w8 C
- hpbar.showname = nil
6 a: ^/ k2 C7 s* i- } - hpbar.namecolor = nil
) e* D2 K/ b, d6 I7 ?( q - if hpbar.titles then
" D U$ M' o. a! G - for i,v in ipairs(hpbar.titles) do2 m# q y5 Y! K- c
- v:removeFromParent(true), g- N" l: e4 h. D- V( [) D! O
- end
5 b9 E4 I0 J2 G9 { - 实用工具.DeleteTable(hpbar.titles)
& K% Z( f; Z6 L6 K5 G. A" f! g7 m - end
" h% o& J2 x* w6 @4 V Q - if hpbar.nameexs then# V# u. z6 ]' U( F) |
- for i,v in ipairs(hpbar.nameexs) do* ?3 h& j5 P; w0 v' {! u* g
- v:removeFromParent(true)
8 x, ?! x) f2 k' X0 g/ _3 v+ J - end4 _3 L! f" K' E5 p. H: l
- 实用工具.DeleteTable(hpbar.nameexs) y. l0 W' e! b
- end
U* d. K' \: W V3 U. A G% A - hpbar:removeFromParent()
4 l! A5 `: P2 Z1 c8 h - hpbarpool[#hpbarpool] = hpbar* D. U: U% I( q8 G; d
- role.hpbar = nil
0 Q& l0 T" w5 E4 [* j! z0 N - end
1 V- [/ F7 D4 b, k" s) t. b+ U) T ~ - end O- K8 R2 a( o6 w
- function updateHPBar(role)
. i+ ]+ Z) [" `% K# D4 A* Y: F - local hpbar = role.hpbar
; U" @. j: E4 W0 z. G; a0 N - if hpbar then
3 ^5 Z$ s5 a) a; D" ] - hpbar:setVisible(role:isVisible())8 K, k a, P/ w) w1 ^" A" U# X
- end
2 y1 V- x% F0 N4 y5 C - if hpbar and hpbar:isVisible() then
5 n4 `$ f- d6 T9 H' @. c+ L8 X8 i* | - hpbar:setZOrder(-role:getPositionY())0 C1 |5 w2 n; R) T) c
- local pt = F3DUtils:getScreenPosition(role:getPositionX(), role:getPositionY(), role:getPositionZ() + 100)--role:getBoxHeight() + 20)
2 V, y% b2 o5 @: ` - if pt then0 Q- m( d2 E8 h
- hpbar:setPositionX(pt.x)6 O! _) R0 }" N; V3 a/ x/ H
- hpbar:setPositionY(pt.y)
4 l0 P) k) ]( t - end1 d7 r& U; ]' B3 F% o* _
- end
Q/ q% ^. K3 p) s4 m$ h( \ - end
复制代码
( _- M) g8 f. t2 i' e! H2 v$ ^0 O0 R% @# l; d1 x+ e
|
免责
帖子地址
打造全网最多免费游戏网站,部分资源失效,私聊站长补
|