mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 03:24:55 +02:00
save window position and size
This commit is contained in:
@@ -19,7 +19,7 @@ end
|
||||
|
||||
local function setSkillValue(id, value)
|
||||
local skill = skillWindow:recursiveGetChildById(id)
|
||||
|
||||
|
||||
if skill then
|
||||
local widget = skill:getChildById('value')
|
||||
widget:setText(value)
|
||||
@@ -28,11 +28,11 @@ end
|
||||
|
||||
local function setSkillPercent(id, percent, tooltip)
|
||||
local skill = skillWindow:recursiveGetChildById(id)
|
||||
|
||||
|
||||
if skill then
|
||||
local widget = skill:getChildById('percent')
|
||||
widget:setPercent(percent)
|
||||
|
||||
|
||||
if tooltip then
|
||||
widget:setTooltip(tooltip)
|
||||
end
|
||||
@@ -49,6 +49,19 @@ function Skills.destroy()
|
||||
skillWindow = nil
|
||||
end
|
||||
|
||||
function Skills.onSkillButtonClick(button)
|
||||
local percentBar = button:getChildById('percent')
|
||||
if percentBar then
|
||||
percentBar:setVisible(not percentBar:isVisible())
|
||||
if percentBar:isVisible() then
|
||||
button:setHeight(21)
|
||||
else
|
||||
button:setHeight(21 - 6)
|
||||
end
|
||||
button:updateParentLayout()
|
||||
end
|
||||
end
|
||||
|
||||
-- hooked events
|
||||
function Skills.onExperienceChange(value)
|
||||
setSkillValue('experience', getNumberString(value))
|
||||
@@ -82,7 +95,7 @@ function Skills.onStaminaChange(stamina)
|
||||
minutes = '0' .. minutes
|
||||
end
|
||||
local percent = 100 * stamina / (42 * 60) -- max is 42 hours
|
||||
|
||||
|
||||
setSkillValue('stamina', hours .. ":" .. minutes)
|
||||
setSkillPercent('stamina', percent, 'You have ' .. percent .. ' percent')
|
||||
end
|
||||
|
@@ -5,20 +5,7 @@ SkillButton < UIButton
|
||||
margin-top: 3
|
||||
margin-left: 10
|
||||
margin-right: 10
|
||||
|
||||
@onClick: |
|
||||
function(self)
|
||||
local percentBar = self:getChildById('percent')
|
||||
if percentBar then
|
||||
percentBar:setVisible(not percentBar:isVisible())
|
||||
if percentBar:isVisible() then
|
||||
self:setHeight(21)
|
||||
else
|
||||
self:setHeight(21 - 6)
|
||||
end
|
||||
self:updateParentLayout()
|
||||
end
|
||||
end
|
||||
&onClick: Skills.onSkillButtonClick
|
||||
|
||||
SkillNameLabel < GameLabel
|
||||
font: verdana-11px-monochrome
|
||||
|
Reference in New Issue
Block a user