mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-10-14 06:34:55 +02:00
Resolve "Merge the best from 7.40 branch"
This commit is contained in:
35
SabrehavenOTClient/modules/game_stats/stats.lua
Normal file
35
SabrehavenOTClient/modules/game_stats/stats.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
ui = nil
|
||||
updateEvent = nil
|
||||
|
||||
function init()
|
||||
ui = g_ui.loadUI('stats', modules.game_interface.getMapPanel())
|
||||
|
||||
if not modules.client_options.getOption("showFps") then
|
||||
ui.fps:hide()
|
||||
end
|
||||
if not modules.client_options.getOption("showPing") then
|
||||
ui.ping:hide()
|
||||
end
|
||||
|
||||
updateEvent = scheduleEvent(update, 200)
|
||||
end
|
||||
|
||||
function terminate()
|
||||
removeEvent(updateEvent)
|
||||
end
|
||||
|
||||
function update()
|
||||
updateEvent = scheduleEvent(update, 500)
|
||||
if ui:isHidden() then return end
|
||||
|
||||
text = 'FPS: ' .. g_app.getFps()
|
||||
ui.fps:setText(text)
|
||||
end
|
||||
|
||||
function show()
|
||||
ui:setVisible(true)
|
||||
end
|
||||
|
||||
function hide()
|
||||
ui:setVisible(false)
|
||||
end
|
9
SabrehavenOTClient/modules/game_stats/stats.otmod
Normal file
9
SabrehavenOTClient/modules/game_stats/stats.otmod
Normal file
@@ -0,0 +1,9 @@
|
||||
Module
|
||||
name: game_stats
|
||||
description: Display ping and fps
|
||||
author: otclient.ovh
|
||||
website: http://otclient.ovh
|
||||
sandboxed: true
|
||||
scripts: [ stats ]
|
||||
@onLoad: init()
|
||||
@onUnload: terminate()
|
17
SabrehavenOTClient/modules/game_stats/stats.otui
Normal file
17
SabrehavenOTClient/modules/game_stats/stats.otui
Normal file
@@ -0,0 +1,17 @@
|
||||
UIWidget
|
||||
id: game_stats
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
margin-left: 3
|
||||
size: 100 100
|
||||
visible: false
|
||||
layout:
|
||||
type: verticalBox
|
||||
|
||||
Label
|
||||
id: fps
|
||||
font: verdana-11px-rounded
|
||||
|
||||
Label
|
||||
id: ping
|
||||
font: verdana-11px-rounded
|
Reference in New Issue
Block a user