mirror of
https://github.com/edubart/otclient.git
synced 2025-10-18 21:43:26 +02:00
Save miniwindows states
This commit is contained in:
@@ -35,7 +35,7 @@ function HealthBar.init()
|
||||
|
||||
connect(g_game, { onGameEnd = HealthBar.offline })
|
||||
|
||||
healthBarWindow = displayUI('healthbar.otui', GameInterface.getLeftPanel())
|
||||
healthBarWindow = displayUI('healthbar.otui', GameInterface.getRightPanel())
|
||||
healthBarButton = TopMenu.addGameToggleButton('healthBarButton', tr('Health Bar'), 'healthbar.png', HealthBar.toggle)
|
||||
healthBarButton:setOn(true)
|
||||
healthBar = healthBarWindow:recursiveGetChildById('healthBar')
|
||||
@@ -71,9 +71,17 @@ function HealthBar.terminate()
|
||||
end
|
||||
|
||||
function HealthBar.toggle()
|
||||
local visible = not healthBarWindow:isExplicitlyVisible()
|
||||
healthBarWindow:setVisible(visible)
|
||||
healthBarButton:setOn(visible)
|
||||
if healthBarButton:isOn() then
|
||||
healthBarWindow:close()
|
||||
healthBarButton:setOn(false)
|
||||
else
|
||||
healthBarWindow:open()
|
||||
healthBarButton:setOn(true)
|
||||
end
|
||||
end
|
||||
|
||||
function HealthBar.onMiniWindowClose()
|
||||
healthBarButton:setOn(false)
|
||||
end
|
||||
|
||||
function HealthBar.offline()
|
||||
|
@@ -45,7 +45,7 @@ MiniWindow
|
||||
id: healthBarWindow
|
||||
!text: tr('Health Bar')
|
||||
height: 86
|
||||
@onClose: HealthBar.toggle()
|
||||
@onClose: HealthBar.onMiniWindowClose()
|
||||
|
||||
MiniWindowContents
|
||||
HealthBar
|
||||
@@ -61,4 +61,3 @@ MiniWindow
|
||||
margin-top: 5
|
||||
anchors.top: prev.bottom
|
||||
anchors.horizontalcenter: parent.horizontalcenter
|
||||
|
||||
|
Reference in New Issue
Block a user