Background label hide function, Skins fix and combobox hide, messagebox changes, show entergame when reload

This commit is contained in:
Henrique Santiago 2012-08-06 16:15:20 -03:00
parent 9cb4cb9a58
commit e6bd3907e1
8 changed files with 34 additions and 27 deletions

View File

@ -39,3 +39,7 @@ end
function Background.show()
background:show()
end
function Background.hideVersionLabel()
background:getChildById('clientVersionLabel'):hide()
end

View File

@ -229,7 +229,7 @@ function CharacterList.destroy()
end
function CharacterList.show()
if not loadBox and not errorBox then
if not loadBox and not errorBox and charactersWindow then
charactersWindow:show()
charactersWindow:raise()
charactersWindow:focus()

View File

@ -93,7 +93,9 @@ function EnterGame.init()
addEvent(EnterGame.doLogin)
end
else
enterGame:hide()
if g_game.isOnline() then
enterGame:hide()
end
end
end

View File

@ -1,6 +1,7 @@
MainWindow
id: enterGame
!text: tr('Enter Game')
margin-top: 100
size: 236 274
@onEnter: EnterGame.doLogin()
@onEscape: EnterGame.hide()

View File

@ -89,24 +89,22 @@ function Skins.setSkin(name)
g_fonts.clearFonts()
g_ui.clearStyles()
if name ~= defaultSkinName then
local defaultSkin = installedSkins[defaultSkinName]
if not defaultSkin then
error("Default skin is not installed.")
return false
end
Skins.loadSkin(defaultSkin)
end
if currentSkin and currentSkin.name ~= defaultSkinName then
g_resources.removeSearchPath(getSkinPath(currentSkin.name))
end
if skin.name ~= defaultSkinName then
g_resources.addSearchPath(getSkinPath(skin.name), true)
Skins.loadSkin(skin)
end
Skins.loadSkin(skin)
local defaultSkin = installedSkins[defaultSkinName]
if not defaultSkin then
error("Default skin is not installed.")
return false
end
Skins.loadSkin(defaultSkin)
currentSkin = skin
return true
end
@ -136,3 +134,12 @@ function Skins.loadSkin(skin)
end
end
end
function Skins.hideComboBox()
if not skinComboBox then
addEvent(Skins.hideComboBox)
else
skinComboBox:hide()
skinComboBox:setWidth(0)
end
end

View File

@ -1,11 +1,3 @@
MessageBoxWindow < MainWindow
id: messageBoxWindow
anchors.centerIn: parent
height: 60
width: 80
padding-bottom: 10
padding-right: 10
MessageBoxLabel < Label
id: messageBoxLabel
anchors.horizontalCenter: parent.horizontalCenter

View File

@ -13,16 +13,13 @@ function UIMessageBox.display(title, message, flags)
local messagebox = UIMessageBox.internalCreate()
rootWidget:addChild(messagebox)
messagebox:setStyle('MessageBoxWindow')
messagebox:setStyle('MainWindow')
messagebox:setText(title)
local messageLabel = g_ui.createWidget('MessageBoxLabel', messagebox)
messageLabel:setText(message)
messageLabel:resizeToText()
messagebox:setWidth(math.max(messageLabel:getWidth() + 48, messagebox:getTextSize().width + 20))
messagebox:setHeight(math.max(messageLabel:getHeight() + 64, messagebox:getHeight()))
-- setup messagebox first button
local buttonRight = g_ui.createWidget('MessageBoxRightButton', messagebox)
@ -38,6 +35,9 @@ function UIMessageBox.display(title, message, flags)
connect(messagebox, { onEscape = function(self) self:cancel() end })
end
messagebox:setWidth(messageLabel:getWidth() + messagebox:getPaddingLeft() + messagebox:getPaddingRight())
messagebox:setHeight(messageLabel:getHeight() + messagebox:getPaddingTop() + messagebox:getPaddingBottom() + buttonRight:getHeight() + 10)
--messagebox:lock()
return messagebox

View File

@ -340,14 +340,15 @@ void UIManager::importStyleFromOTML(const OTMLNodePtr& styleNode)
styleNode->writeAt("__unique", true);
}
OTMLNodePtr oldStyle = m_styles[name];
// Warn about redefined styles
if(!g_app.isRunning() && !unique) {
if(!g_app.isRunning() && (oldStyle && !oldStyle->valueAt("__unique", false))) {
auto it = m_styles.find(name);
if(it != m_styles.end())
g_logger.warning(stdext::format("style '%s' is being redefined", name));
}
OTMLNodePtr oldStyle = m_styles[name];
if(!oldStyle || !oldStyle->valueAt("__unique", false) || unique) {
OTMLNodePtr originalStyle = getStyle(base);
if(!originalStyle)