master
parent
44a20222bb
commit
de0e4a1acf
@ -1,27 +0,0 @@
|
|||||||
PingBar = {}
|
|
||||||
|
|
||||||
local pingLabel
|
|
||||||
|
|
||||||
-- public functions
|
|
||||||
function PingBar.init()
|
|
||||||
pingLabel = createWidget('UILabel', rootWidget:recursiveGetChildById('leftButtonsPanel'))
|
|
||||||
pingLabel:applyStyle({ ['anchors.left'] = 'prev.right',
|
|
||||||
['anchors.top'] = 'parent.top',
|
|
||||||
['margin-top'] = 12,
|
|
||||||
['margin-left'] = 20,
|
|
||||||
font = 'verdana-11px-rounded',
|
|
||||||
color = '#FE6500',
|
|
||||||
width = 120,
|
|
||||||
height = 16})
|
|
||||||
end
|
|
||||||
|
|
||||||
function PingBar.terminate()
|
|
||||||
pingLabel:destroy()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- hooked events
|
|
||||||
local function onGamePingUpdate(ping)
|
|
||||||
pingLabel:setText('Ping: ' .. ping .. ' ms')
|
|
||||||
end
|
|
||||||
|
|
||||||
connect(Game, { onWalkPingUpdate = onGamePingUpdate })
|
|
@ -1,15 +0,0 @@
|
|||||||
Module
|
|
||||||
name: pingbar
|
|
||||||
description: Show ping in game
|
|
||||||
author: OTClient team
|
|
||||||
website: https://github.com/edubart/otclient
|
|
||||||
|
|
||||||
autoLoad: true
|
|
||||||
autoLoadAntecedence: 1000
|
|
||||||
|
|
||||||
onLoad: |
|
|
||||||
require 'pingbar'
|
|
||||||
PingBar.init()
|
|
||||||
|
|
||||||
onUnload: |
|
|
||||||
PingBar.terminate()
|
|
Loading…
Reference in new issue