expand skills percent progress bar
This commit is contained in:
parent
91572b4802
commit
ff7f152522
|
@ -17,13 +17,18 @@ function Skills.create()
|
||||||
|
|
||||||
-- create skills
|
-- create skills
|
||||||
for i=1,#skills,1 do
|
for i=1,#skills,1 do
|
||||||
|
local skillButton = UIButton.create()
|
||||||
|
skillPanel:addChild(skillButton)
|
||||||
|
skillButton:setStyle('SkillButton')
|
||||||
|
|
||||||
local nameLabel = UILabel.create()
|
local nameLabel = UILabel.create()
|
||||||
skillPanel:addChild(nameLabel)
|
skillButton :addChild(nameLabel)
|
||||||
nameLabel:setStyle('SkillNameLabel')
|
nameLabel:setStyle('SkillNameLabel')
|
||||||
nameLabel:setText(skills[i])
|
nameLabel:setText(skills[i])
|
||||||
|
nameLabel:resizeToText()
|
||||||
|
|
||||||
local levelLabel = UILabel.create()
|
local levelLabel = UILabel.create()
|
||||||
skillPanel:addChild(levelLabel)
|
skillButton :addChild(levelLabel)
|
||||||
levelLabel:setStyle('SkillLevelLabel')
|
levelLabel:setStyle('SkillLevelLabel')
|
||||||
levelLabel:setId('skillLevelId' .. i)
|
levelLabel:setId('skillLevelId' .. i)
|
||||||
levelLabel:setText('0')
|
levelLabel:setText('0')
|
||||||
|
@ -32,6 +37,12 @@ function Skills.create()
|
||||||
skillPanel:addChild(percentBar)
|
skillPanel:addChild(percentBar)
|
||||||
percentBar:setStyle('SkillPercentPanel')
|
percentBar:setStyle('SkillPercentPanel')
|
||||||
percentBar:setId('skillPercentId' .. i)
|
percentBar:setId('skillPercentId' .. i)
|
||||||
|
|
||||||
|
skillButton.onClick = function(self)
|
||||||
|
percentBar:setVisible(not percentBar:isVisible())
|
||||||
|
self:updateParentLayout()
|
||||||
|
return true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -42,9 +53,9 @@ end
|
||||||
|
|
||||||
-- hooked events
|
-- hooked events
|
||||||
function Game.onSkillUpdate(id, level, percent)
|
function Game.onSkillUpdate(id, level, percent)
|
||||||
local skillPanel = skillWindow:getChildById('skillPanel')
|
local skillPanel = skillWindow:recursiveGetChildById('skillPanel')
|
||||||
|
|
||||||
local levelLabel = skillPanel:getChildById('skillLevelId' .. (id + 1))
|
local levelLabel = skillPanel:recursiveGetChildById('skillLevelId' .. (id + 1))
|
||||||
levelLabel:setText(level)
|
levelLabel:setText(level)
|
||||||
|
|
||||||
local percentBar = skillPanel:getChildById('skillPercentId' .. (id + 1))
|
local percentBar = skillPanel:getChildById('skillPercentId' .. (id + 1))
|
||||||
|
|
|
@ -1,24 +1,23 @@
|
||||||
SkillFirstWidget < UIWidget
|
SkillFirstWidget < UIWidget
|
||||||
anchors.top: parent.top
|
|
||||||
|
|
||||||
SkillNameLabel < Label
|
|
||||||
font: verdana-11px-monochrome
|
|
||||||
|
|
||||||
|
SkillButton < UIButton
|
||||||
|
height: 14
|
||||||
margin.top: 4
|
margin.top: 4
|
||||||
margin.left: 10
|
margin.left: 10
|
||||||
margin.right: 10
|
margin.right: 10
|
||||||
anchors.top: prev.bottom
|
|
||||||
|
SkillNameLabel < Label
|
||||||
|
font: verdana-11px-monochrome
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
SkillLevelLabel < Label
|
SkillLevelLabel < Label
|
||||||
font: verdana-11px-monochrome
|
font: verdana-11px-monochrome
|
||||||
align: right
|
align: right
|
||||||
margin.left: 10
|
|
||||||
margin.right: 10
|
|
||||||
anchors.top: prev.top
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
SkillPercentPanel < UIProgressBar
|
SkillPercentPanel < UIProgressBar
|
||||||
color: black
|
color: black
|
||||||
|
@ -28,9 +27,6 @@ SkillPercentPanel < UIProgressBar
|
||||||
margin.top: 3
|
margin.top: 3
|
||||||
margin.left: 10
|
margin.left: 10
|
||||||
margin.right: 10
|
margin.right: 10
|
||||||
anchors.top: prev.bottom
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
|
|
||||||
MiniWindow
|
MiniWindow
|
||||||
id: skillWindow
|
id: skillWindow
|
||||||
|
@ -44,3 +40,4 @@ MiniWindow
|
||||||
margin.bottom: 3
|
margin.bottom: 3
|
||||||
margin.left: 3
|
margin.left: 3
|
||||||
margin.right: 3
|
margin.right: 3
|
||||||
|
layout: verticalBox
|
||||||
|
|
|
@ -85,6 +85,7 @@ void LuaInterface::registerFunctions()
|
||||||
g_lua.bindClassMemberFunction<UIWidget>("unlock", &UIWidget::unlock);
|
g_lua.bindClassMemberFunction<UIWidget>("unlock", &UIWidget::unlock);
|
||||||
g_lua.bindClassMemberFunction<UIWidget>("focus", &UIWidget::focus);
|
g_lua.bindClassMemberFunction<UIWidget>("focus", &UIWidget::focus);
|
||||||
g_lua.bindClassMemberFunction<UIWidget>("getChildren", &UIWidget::getChildren);
|
g_lua.bindClassMemberFunction<UIWidget>("getChildren", &UIWidget::getChildren);
|
||||||
|
g_lua.bindClassMemberFunction<UIWidget>("recursiveGetChildById", &UIWidget::recursiveGetChildById);
|
||||||
g_lua.bindClassMemberFunction<UIWidget>("getChildById", &UIWidget::getChildById);
|
g_lua.bindClassMemberFunction<UIWidget>("getChildById", &UIWidget::getChildById);
|
||||||
g_lua.bindClassMemberFunction<UIWidget>("getChildByIndex", &UIWidget::getChildByIndex);
|
g_lua.bindClassMemberFunction<UIWidget>("getChildByIndex", &UIWidget::getChildByIndex);
|
||||||
g_lua.bindClassMemberFunction<UIWidget>("getChildCount", &UIWidget::getChildCount);
|
g_lua.bindClassMemberFunction<UIWidget>("getChildCount", &UIWidget::getChildCount);
|
||||||
|
|
|
@ -56,6 +56,7 @@ void UIVerticalLayout::update()
|
||||||
for(const UIWidgetPtr& widget : widgets) {
|
for(const UIWidgetPtr& widget : widgets) {
|
||||||
if(!widget->isExplicitlyVisible())
|
if(!widget->isExplicitlyVisible())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Size size = widget->getSize();
|
Size size = widget->getSize();
|
||||||
pos.y += (m_alignBottom) ? -(widget->getMarginBottom()+widget->getHeight()) : widget->getMarginTop();
|
pos.y += (m_alignBottom) ? -(widget->getMarginBottom()+widget->getHeight()) : widget->getMarginTop();
|
||||||
if(widget->isSizeFixed()) {
|
if(widget->isSizeFixed()) {
|
||||||
|
|
Loading…
Reference in New Issue