implement motd button

This commit is contained in:
Eduardo Bart 2011-11-16 16:08:42 -02:00
parent c584426f24
commit 4341bf91a6
4 changed files with 32 additions and 49 deletions

View File

@ -16,6 +16,7 @@ end
local function onMotd(protocol, motd) local function onMotd(protocol, motd)
motdNumber = tonumber(string.sub(motd, 0, string.find(motd, "\n"))) motdNumber = tonumber(string.sub(motd, 0, string.find(motd, "\n")))
motdMessage = string.sub(motd, string.find(motd, "\n") + 1, string.len(motd)) motdMessage = string.sub(motd, string.find(motd, "\n") + 1, string.len(motd))
TopMenu.getButton('motdButton'):show()
end end
local function onCharacterList(protocol, characters, premDays) local function onCharacterList(protocol, characters, premDays)
@ -68,3 +69,7 @@ function EnterGame.doLogin()
protocolLogin:login(EnterGame.account, EnterGame.password) protocolLogin:login(EnterGame.account, EnterGame.password)
end end
function EnterGame.displayMotd()
displayInfoBox("Message of the day", motdMessage)
end

View File

@ -11,4 +11,8 @@ end
function TopMenu.destroy() function TopMenu.destroy()
topMenu:destroy() topMenu:destroy()
topMenu = nil topMenu = nil
end
function TopMenu.getButton(id)
return topMenu:getChildById(id)
end end

View File

@ -37,7 +37,8 @@ TopPanel
margin.left: 6 margin.left: 6
tooltip: Message of the day tooltip: Message of the day
icon: /core_styles/icons/motd.png icon: /core_styles/icons/motd.png
@onClick: visible: false
@onClick: EnterGame.displayMotd()
TopButton TopButton
anchors.top: parent.top anchors.top: parent.top

View File

@ -788,73 +788,46 @@ void UIWidget::onStyleApply(const OTMLNodePtr& styleNode)
image->loadFromOTML(node); image->loadFromOTML(node);
setImage(image); setImage(image);
} }
else if(node->tag() == "border-image") { else if(node->tag() == "border-image")
setImage(BorderImage::loadFromOTML(node)); setImage(BorderImage::loadFromOTML(node));
} else if(node->tag() == "font")
// font
else if(node->tag() == "font") {
setFont(g_fonts.getFont(node->value())); setFont(g_fonts.getFont(node->value()));
} else if(node->tag() == "color")
// foreground color
else if(node->tag() == "color") {
setForegroundColor(node->value<Color>()); setForegroundColor(node->value<Color>());
} else if(node->tag() == "background-color")
// background color
else if(node->tag() == "background-color") {
setBackgroundColor(node->value<Color>()); setBackgroundColor(node->value<Color>());
} else if(node->tag() == "opacity")
// opacity
else if(node->tag() == "opacity") {
setOpacity(node->value<int>()); setOpacity(node->value<int>());
} else if(node->tag() == "enabled")
// enabled
else if(node->tag() == "enabled") {
setEnabled(node->value<bool>()); setEnabled(node->value<bool>());
} else if(node->tag() == "visible")
// focusable setVisible(node->value<bool>());
else if(node->tag() == "focusable") { else if(node->tag() == "focusable")
setFocusable(node->value<bool>()); setFocusable(node->value<bool>());
} else if(node->tag() == "phantom")
// focusable
else if(node->tag() == "phantom") {
setPhantom(node->value<bool>()); setPhantom(node->value<bool>());
} else if(node->tag() == "size")
// size
else if(node->tag() == "size") {
resize(node->value<Size>()); resize(node->value<Size>());
} else if(node->tag() == "width")
else if(node->tag() == "width") {
setWidth(node->value<int>()); setWidth(node->value<int>());
} else if(node->tag() == "height")
else if(node->tag() == "height") {
setHeight(node->value<int>()); setHeight(node->value<int>());
} else if(node->tag() == "size fixed")
else if(node->tag() == "size fixed") {
setSizeFixed(node->value<bool>()); setSizeFixed(node->value<bool>());
} else if(node->tag() == "position")
// absolute position
else if(node->tag() == "position") {
moveTo(node->value<Point>()); moveTo(node->value<Point>());
} else if(node->tag() == "x")
else if(node->tag() == "x") {
setX(node->value<int>()); setX(node->value<int>());
} else if(node->tag() == "y")
else if(node->tag() == "y") {
setY(node->value<int>()); setY(node->value<int>());
} else if(node->tag() == "margin.left")
// margins
else if(node->tag() == "margin.left") {
setMarginLeft(node->value<int>()); setMarginLeft(node->value<int>());
} else if(node->tag() == "margin.right")
else if(node->tag() == "margin.right") {
setMarginRight(node->value<int>()); setMarginRight(node->value<int>());
} else if(node->tag() == "margin.top")
else if(node->tag() == "margin.top") {
setMarginTop(node->value<int>()); setMarginTop(node->value<int>());
} else if(node->tag() == "margin.bottom")
else if(node->tag() == "margin.bottom") {
setMarginBottom(node->value<int>()); setMarginBottom(node->value<int>());
}
// layouts // layouts
else if(node->tag() == "layout") { else if(node->tag() == "layout") {
// layout is set only once // layout is set only once