Save miniwindows states

This commit is contained in:
Henrique Santiago
2012-06-21 16:31:22 -03:00
parent 96c363d997
commit a7c17cec2e
22 changed files with 317 additions and 60 deletions

View File

@@ -35,7 +35,7 @@ function Skills.init()
onSkillChange = Skills.onSkillChange
})
skillsWindow = displayUI('skills.otui', GameInterface.getLeftPanel())
skillsWindow = displayUI('skills.otui', GameInterface.getRightPanel())
skillsButton = TopMenu.addGameToggleButton('skillsButton', tr('Skills') .. ' (Ctrl+S)', 'skills.png', Skills.toggle)
skillsButton:setOn(true)
Keyboard.bindKeyDown('Ctrl+S', Skills.toggle)
@@ -84,9 +84,17 @@ function Skills.refresh()
end
function Skills.toggle()
local visible = not skillsWindow:isExplicitlyVisible()
skillsWindow:setVisible(visible)
skillsButton:setOn(visible)
if skillsButton:isOn() then
skillsWindow:close()
skillsButton:setOn(false)
else
skillsWindow:open()
skillsButton:setOn(true)
end
end
function Skills.onMiniWindowClose()
skillsButton:setOn(false)
end
function Skills.onSkillButtonClick(button)

View File

@@ -33,9 +33,9 @@ SkillPercentPanel < ProgressBar
MiniWindow
id: skillWindow
!text: tr('Skills')
height: 350
height: 150
icon: skills.png
@onClose: Skills.toggle()
@onClose: Skills.onMiniWindowClose()
MiniWindowContents
anchors.fill: parent