|
楼主 |
发表于 2009-10-26 11:32:33
|
显示全部楼层
核心代码:
[jass]
integer SYD_MB_HpBarIconStep = 9
call MB_SetBar(多面板,进度条行,进度条开始列,进度条结束列,进度条百分比显示列,进度条百分比)
[/jass]
[jass]
function MB_GetBar_Icon takes integer val,boolean head,boolean tail returns string
local integer step = SYD_MB_HpBarIconStep
local integer i = 0
local integer iMax
if(head)then
set i = step
elseif(tail)then
set i = step*2
endif
if(val>=0 and val<step)then
return SYS_MB_HpBarString[i+val]
endif
return ""
endfunction
function MB_SetBar takes multiboard mb,integer line,integer sc,integer ec,integer vc,integer pec returns nothing
local integer tNum = ec - sc
local integer cIcon = 0
local integer step = SYD_MB_HpBarIconStep
local integer cValue = ((tNum+1)*step*pec)/100
local string sIcon
local multiboarditem mbi
set sIcon = I2S(pec)+"%"
set mbi = MultiboardGetItem(mb,line,vc)
call MultiboardSetItemStyle(mbi,true,false)
call MultiboardSetItemWidth(mbi,0.03)
call MultiboardSetItemValue(mbi,sIcon)
call MultiboardReleaseItem(mbi)
loop
exitwhen(cIcon>tNum)
set sIcon = MB_GetBar_Icon(IConfig(cValue - cIcon*step,0,step-1),cIcon==0,cIcon==tNum)
set mbi = MultiboardGetItem(mb,line,sc+cIcon)
call MultiboardSetItemStyle(mbi,false,true)
call MultiboardSetItemWidth(mbi,0.01)
call MultiboardSetItemIcon(mbi,sIcon)
call MultiboardReleaseItem(mbi)
set cIcon = cIcon + 1
endloop
set mbi = null
endfunction
[/jass] |
|