|
[jass]
function FreshDelayTime takes nothing returns nothing
local string s="|cff00ff00"
if GetLocalPlayer()==Player(0) then
call StoreInteger(gc,"GameTime","GetDelay",GetStoredInteger(gc,"GameTime","GetDelay")-1)
endif
if GetStoredInteger(gc,"GameTime","GetDelay")>500 then
set s="|cffff0000"
elseif GetStoredInteger(gc,"GameTime","GetDelay")>250 then
set s="|cffffff00"
endif
call MultiboardSetTitleText(mb,"|cffffffff网络延迟: |r"+s+I2S(GetStoredInteger(gc,"GameTime","GetDelay"))+"|r |cffffffffms|r")
endfunction
function GetDelayTime takes nothing returns nothing
if GetStoredInteger(gc,"GameTime","LastDelay")!=GetStoredInteger(gc,"GameTime","Delay") then
call StoreInteger(gc,"GameTime","GetDelay",ms-GetStoredInteger(gc,"GameTime","Delay"))
call StoreInteger(gc,"GameTime","LastDelay",GetStoredInteger(gc,"GameTime","Delay"))
call FreshDelayTime()
endif
endfunction
function DelayTime takes nothing returns nothing
if GetLocalPlayer()==Player(0) then
call StoreInteger(gc,"GameTime","Delay",ms)
call SyncStoredInteger(gc,"GameTime","Delay")
endif
endfunction
function TimeClock takes nothing returns nothing
set ms=ms+1
endfunction
function ClockTime takes nothing returns nothing
call TimerStart(Clock,0.001,true,function TimeClock)
call TimerStart(CreateTimer(),1,true,function DelayTime)
call TimerStart(DelayClock,0.001,true,function GetDelayTime)
endfunction
[/jass]
以上为全部代码,其中ms为自定义的全局整型变量,gc为自定义的全局游戏缓存变量,mb是自定义的全局多面板变量.Clock和DelayClock是自定义的全局计时器变量
不明白的同学请不要随便乱用额.可能引起掉线. |
评分
-
查看全部评分
|