Background label hide function, Skins fix and combobox hide, messagebox changes, show entergame when reload
This commit is contained in:
parent
9cb4cb9a58
commit
e6bd3907e1
|
@ -39,3 +39,7 @@ end
|
||||||
function Background.show()
|
function Background.show()
|
||||||
background:show()
|
background:show()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Background.hideVersionLabel()
|
||||||
|
background:getChildById('clientVersionLabel'):hide()
|
||||||
|
end
|
||||||
|
|
|
@ -229,7 +229,7 @@ function CharacterList.destroy()
|
||||||
end
|
end
|
||||||
|
|
||||||
function CharacterList.show()
|
function CharacterList.show()
|
||||||
if not loadBox and not errorBox then
|
if not loadBox and not errorBox and charactersWindow then
|
||||||
charactersWindow:show()
|
charactersWindow:show()
|
||||||
charactersWindow:raise()
|
charactersWindow:raise()
|
||||||
charactersWindow:focus()
|
charactersWindow:focus()
|
||||||
|
|
|
@ -93,8 +93,10 @@ function EnterGame.init()
|
||||||
addEvent(EnterGame.doLogin)
|
addEvent(EnterGame.doLogin)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
if g_game.isOnline() then
|
||||||
enterGame:hide()
|
enterGame:hide()
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function EnterGame.terminate()
|
function EnterGame.terminate()
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
MainWindow
|
MainWindow
|
||||||
id: enterGame
|
id: enterGame
|
||||||
!text: tr('Enter Game')
|
!text: tr('Enter Game')
|
||||||
|
margin-top: 100
|
||||||
size: 236 274
|
size: 236 274
|
||||||
@onEnter: EnterGame.doLogin()
|
@onEnter: EnterGame.doLogin()
|
||||||
@onEscape: EnterGame.hide()
|
@onEscape: EnterGame.hide()
|
||||||
|
|
|
@ -89,24 +89,22 @@ function Skins.setSkin(name)
|
||||||
g_fonts.clearFonts()
|
g_fonts.clearFonts()
|
||||||
g_ui.clearStyles()
|
g_ui.clearStyles()
|
||||||
|
|
||||||
if name ~= defaultSkinName then
|
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
|
||||||
|
|
||||||
local defaultSkin = installedSkins[defaultSkinName]
|
local defaultSkin = installedSkins[defaultSkinName]
|
||||||
if not defaultSkin then
|
if not defaultSkin then
|
||||||
error("Default skin is not installed.")
|
error("Default skin is not installed.")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
Skins.loadSkin(defaultSkin)
|
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)
|
|
||||||
end
|
|
||||||
|
|
||||||
Skins.loadSkin(skin)
|
|
||||||
currentSkin = skin
|
currentSkin = skin
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -136,3 +134,12 @@ function Skins.loadSkin(skin)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Skins.hideComboBox()
|
||||||
|
if not skinComboBox then
|
||||||
|
addEvent(Skins.hideComboBox)
|
||||||
|
else
|
||||||
|
skinComboBox:hide()
|
||||||
|
skinComboBox:setWidth(0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
MessageBoxWindow < MainWindow
|
|
||||||
id: messageBoxWindow
|
|
||||||
anchors.centerIn: parent
|
|
||||||
height: 60
|
|
||||||
width: 80
|
|
||||||
padding-bottom: 10
|
|
||||||
padding-right: 10
|
|
||||||
|
|
||||||
MessageBoxLabel < Label
|
MessageBoxLabel < Label
|
||||||
id: messageBoxLabel
|
id: messageBoxLabel
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
|
@ -13,16 +13,13 @@ function UIMessageBox.display(title, message, flags)
|
||||||
local messagebox = UIMessageBox.internalCreate()
|
local messagebox = UIMessageBox.internalCreate()
|
||||||
rootWidget:addChild(messagebox)
|
rootWidget:addChild(messagebox)
|
||||||
|
|
||||||
messagebox:setStyle('MessageBoxWindow')
|
messagebox:setStyle('MainWindow')
|
||||||
messagebox:setText(title)
|
messagebox:setText(title)
|
||||||
|
|
||||||
local messageLabel = g_ui.createWidget('MessageBoxLabel', messagebox)
|
local messageLabel = g_ui.createWidget('MessageBoxLabel', messagebox)
|
||||||
messageLabel:setText(message)
|
messageLabel:setText(message)
|
||||||
messageLabel:resizeToText()
|
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
|
-- setup messagebox first button
|
||||||
local buttonRight = g_ui.createWidget('MessageBoxRightButton', messagebox)
|
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 })
|
connect(messagebox, { onEscape = function(self) self:cancel() end })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
messagebox:setWidth(messageLabel:getWidth() + messagebox:getPaddingLeft() + messagebox:getPaddingRight())
|
||||||
|
messagebox:setHeight(messageLabel:getHeight() + messagebox:getPaddingTop() + messagebox:getPaddingBottom() + buttonRight:getHeight() + 10)
|
||||||
|
|
||||||
--messagebox:lock()
|
--messagebox:lock()
|
||||||
|
|
||||||
return messagebox
|
return messagebox
|
||||||
|
|
|
@ -340,14 +340,15 @@ void UIManager::importStyleFromOTML(const OTMLNodePtr& styleNode)
|
||||||
styleNode->writeAt("__unique", true);
|
styleNode->writeAt("__unique", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OTMLNodePtr oldStyle = m_styles[name];
|
||||||
|
|
||||||
// Warn about redefined styles
|
// Warn about redefined styles
|
||||||
if(!g_app.isRunning() && !unique) {
|
if(!g_app.isRunning() && (oldStyle && !oldStyle->valueAt("__unique", false))) {
|
||||||
auto it = m_styles.find(name);
|
auto it = m_styles.find(name);
|
||||||
if(it != m_styles.end())
|
if(it != m_styles.end())
|
||||||
g_logger.warning(stdext::format("style '%s' is being redefined", name));
|
g_logger.warning(stdext::format("style '%s' is being redefined", name));
|
||||||
}
|
}
|
||||||
|
|
||||||
OTMLNodePtr oldStyle = m_styles[name];
|
|
||||||
if(!oldStyle || !oldStyle->valueAt("__unique", false) || unique) {
|
if(!oldStyle || !oldStyle->valueAt("__unique", false) || unique) {
|
||||||
OTMLNodePtr originalStyle = getStyle(base);
|
OTMLNodePtr originalStyle = getStyle(base);
|
||||||
if(!originalStyle)
|
if(!originalStyle)
|
||||||
|
|
Loading…
Reference in New Issue