Browse Source

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

Henrique Santiago 8 years ago
parent
commit
e6bd3907e1

+ 4
- 0
modules/client_background/background.lua View File

@@ -39,3 +39,7 @@ end
39 39
 function Background.show()
40 40
   background:show()
41 41
 end
42
+
43
+function Background.hideVersionLabel()
44
+  background:getChildById('clientVersionLabel'):hide()
45
+end

+ 1
- 1
modules/client_entergame/characterlist.lua View File

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

+ 3
- 1
modules/client_entergame/entergame.lua View File

@@ -93,7 +93,9 @@ function EnterGame.init()
93 93
       addEvent(EnterGame.doLogin)
94 94
     end
95 95
   else
96
-    enterGame:hide()
96
+    if g_game.isOnline() then
97
+      enterGame:hide()
98
+    end
97 99
   end
98 100
 end
99 101
 

+ 1
- 0
modules/client_entergame/entergame.otui View File

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

+ 18
- 11
modules/client_skins/skins.lua View File

@@ -89,24 +89,22 @@ function Skins.setSkin(name)
89 89
   g_fonts.clearFonts()
90 90
   g_ui.clearStyles()
91 91
 
92
-  if name ~= defaultSkinName then
93
-    local defaultSkin = installedSkins[defaultSkinName]
94
-    if not defaultSkin then
95
-      error("Default skin is not installed.")
96
-      return false
97
-    end
98
-
99
-    Skins.loadSkin(defaultSkin)
100
-  end
101
-
102 92
   if currentSkin and currentSkin.name ~= defaultSkinName then
103 93
     g_resources.removeSearchPath(getSkinPath(currentSkin.name))
104 94
   end
95
+
105 96
   if skin.name ~= defaultSkinName then
106 97
     g_resources.addSearchPath(getSkinPath(skin.name), true)
98
+    Skins.loadSkin(skin)
99
+  end
100
+
101
+  local defaultSkin = installedSkins[defaultSkinName]
102
+  if not defaultSkin then
103
+    error("Default skin is not installed.")
104
+    return false
107 105
   end
106
+  Skins.loadSkin(defaultSkin)
108 107
 
109
-  Skins.loadSkin(skin)
110 108
   currentSkin = skin
111 109
   return true
112 110
 end
@@ -136,3 +134,12 @@ function Skins.loadSkin(skin)
136 134
     end
137 135
   end
138 136
 end
137
+
138
+function Skins.hideComboBox()
139
+  if not skinComboBox then
140
+    addEvent(Skins.hideComboBox)
141
+  else
142
+    skinComboBox:hide()
143
+    skinComboBox:setWidth(0)
144
+  end
145
+end

+ 0
- 8
modules/client_skins/skins/default/styles/messageboxes.otui View File

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

+ 4
- 4
modules/corelib/ui/uimessagebox.lua View File

@@ -13,16 +13,13 @@ function UIMessageBox.display(title, message, flags)
13 13
   local messagebox = UIMessageBox.internalCreate()
14 14
   rootWidget:addChild(messagebox)
15 15
 
16
-  messagebox:setStyle('MessageBoxWindow')
16
+  messagebox:setStyle('MainWindow')
17 17
   messagebox:setText(title)
18 18
 
19 19
   local messageLabel = g_ui.createWidget('MessageBoxLabel', messagebox)
20 20
   messageLabel:setText(message)
21 21
   messageLabel:resizeToText()
22 22
 
23
-  messagebox:setWidth(math.max(messageLabel:getWidth() + 48, messagebox:getTextSize().width + 20))
24
-  messagebox:setHeight(math.max(messageLabel:getHeight() + 64, messagebox:getHeight()))
25
-
26 23
   -- setup messagebox first button
27 24
   local buttonRight = g_ui.createWidget('MessageBoxRightButton', messagebox)
28 25
 
@@ -38,6 +35,9 @@ function UIMessageBox.display(title, message, flags)
38 35
     connect(messagebox, { onEscape = function(self) self:cancel() end })
39 36
   end
40 37
 
38
+  messagebox:setWidth(messageLabel:getWidth() + messagebox:getPaddingLeft() + messagebox:getPaddingRight())
39
+  messagebox:setHeight(messageLabel:getHeight() + messagebox:getPaddingTop() + messagebox:getPaddingBottom() + buttonRight:getHeight() + 10)
40
+
41 41
   --messagebox:lock()
42 42
 
43 43
   return messagebox

+ 3
- 2
src/framework/ui/uimanager.cpp View File

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

Loading…
Cancel
Save