otclient-redemption/modules/client_background/background.lua

64 lines
1.4 KiB
Lua
Raw Permalink Normal View History

2011-11-02 01:02:56 -02:00
-- private variables
local background
local clientVersionLabel
2011-11-02 01:02:56 -02:00
-- public functions
function init()
2021-07-19 19:24:59 -03:00
background = g_ui.displayUI('background')
background:lower()
clientVersionLabel = background:getChildById('clientVersionLabel')
2022-04-29 23:14:24 -03:00
clientVersionLabel:setText(g_app.getName() .. ' ' .. g_app.getVersion() .. '\n' .. 'Rev ' ..
g_app.getBuildRevision() .. ' (' .. g_app.getBuildCommit() .. ')\n' .. 'Built on ' ..
2022-06-03 13:31:48 -03:00
g_app.getBuildDate() .. '\n' .. g_app.getBuildCompiler() .. ' - ' ..
g_app.getBuildArch())
2022-04-29 23:14:24 -03:00
if not g_game.isOnline() then
addEvent(function()
g_effects.fadeIn(clientVersionLabel, 1500)
end)
end
2022-04-29 23:14:24 -03:00
connect(g_game, {
onGameStart = hide
})
connect(g_game, {
onGameEnd = show
})
2011-11-02 01:02:56 -02:00
end
function terminate()
2022-04-29 23:14:24 -03:00
disconnect(g_game, {
onGameStart = hide
})
disconnect(g_game, {
onGameEnd = show
})
2021-07-19 19:24:59 -03:00
g_effects.cancelFade(background:getChildById('clientVersionLabel'))
background:destroy()
2021-07-19 19:24:59 -03:00
background = nil
clientVersionLabel = nil
2011-11-02 01:02:56 -02:00
end
function hide()
background:hide()
end
2011-11-02 01:02:56 -02:00
function show()
background:show()
end
function hideVersionLabel()
background:getChildById('clientVersionLabel'):hide()
end
function setVersionText(text)
clientVersionLabel:setText(text)
end
function getBackground()
return background
end