diff --git a/modules/client_skins/skins/default/styles/buttons.otui b/modules/client_skins/skins/default/styles/buttons.otui index bbbcb629..690fb6ee 100644 --- a/modules/client_skins/skins/default/styles/buttons.otui +++ b/modules/client_skins/skins/default/styles/buttons.otui @@ -39,3 +39,23 @@ TabButton < UIButton $on: image-clip: 0 40 20 20 color: #80c7f8 + +BrowseButton < Button + size: 20 29 + icon-clip: 0 0 12 21 + + $hover !disabled: + icon-clip: 0 21 12 21 + + $pressed: + icon-clip: 0 22 12 21 + + $disabled: + image-color: #ffffff55 + icon-color: #ffffff55 + +NextButton < BrowseButton + icon-source: /images/arrow_right.png + +PreviousButton < BrowseButton + icon-source: /images/arrow_left.png diff --git a/modules/corelib/ui/uispinbox.lua b/modules/corelib/ui/uispinbox.lua index efd476f9..20aeb48f 100644 --- a/modules/corelib/ui/uispinbox.lua +++ b/modules/corelib/ui/uispinbox.lua @@ -27,9 +27,17 @@ function UISpinBox:onTextChange(text, oldText) end local number = tonumber(text) - if not number or number > self.maximum or number < self.minimum then - self:setText(oldText) + if not number then + self:setText(number) return + else + if number < self.minimum then + self:setText(self.minimum) + return + elseif number > self.maximum then + self:setText(self.maximum) + return + end end self:setValue(number) @@ -42,9 +50,11 @@ end function UISpinBox:onStyleApply(styleName, styleNode) for name, value in pairs(styleNode) do if name == 'maximum' then - self:setMaximum(value) + addEvent(function() self:setMaximum(value) + end) elseif name == 'minimum' then - self:setMinimum(value) + addEvent(function() self:setMinimum(value) + end) end end end @@ -61,6 +71,9 @@ end function UISpinBox:setMinimum(minimum) self.minimum = minimum + if self.minimum > self.maximum then + self.maximum = self.minimum + end if self.value < minimum then self:setValue(minimum) end @@ -73,4 +86,6 @@ function UISpinBox:setMaximum(maximum) end end -function UISpinBox:getValue() return self.value end +function UISpinBox:getValue() + return self.value +end diff --git a/modules/corelib/ui/uitable.lua b/modules/corelib/ui/uitable.lua index 801cef4c..f6ac66ff 100644 --- a/modules/corelib/ui/uitable.lua +++ b/modules/corelib/ui/uitable.lua @@ -11,19 +11,14 @@ local HEADER_ID = 'row0' function UITable.create() local table = UITable.internalCreate() - table.headerRow = nil table.dataSpace = nil - table.rows = {} table.rowBaseStyle = nil - table.columns = {} table.columBaseStyle = nil - table.headerRowBaseStyle = nil table.headerColumnBaseStyle = nil - table.selectedRow = nil return table end @@ -119,7 +114,7 @@ function UITable:removeHeaderRow() self.headerRow = nil end -function UITable:addRow(data, height) +function UITable:addRow(data, ref, height) if not self.dataSpace then g_logger.error('UITable:addRow - table data space has not been set, cannot add rows.') return @@ -130,11 +125,11 @@ function UITable:addRow(data, height) end local row = g_ui.createWidget(self.rowBaseStyle, self.dataSpace) + if ref then row.ref = ref end if height then row:setHeight(height) end + local rowId = #self.rows - while rowId < 1 do rowId = rowId + 1 end - rowId = 'row'..rowId - row:setId(rowId) + row:setId('row'..(rowId < 1 and 1 or rowId)) for _, column in pairs(data) do local col = g_ui.createWidget(self.columBaseStyle, row) @@ -149,7 +144,10 @@ function UITable:addRow(data, height) end self.columns[rowId] = col end - row.onClick = function(row) self:selectRow(row) end + + row.onFocusChange = function(row, focused) + if focused then self:selectRow(row) end + end table.insert(self.rows, row) return row end diff --git a/modules/game_interface/gameinterface.lua b/modules/game_interface/gameinterface.lua index 96826f83..54893e80 100644 --- a/modules/game_interface/gameinterface.lua +++ b/modules/game_interface/gameinterface.lua @@ -113,7 +113,7 @@ function hide() Background.show() end -function exit() +function forceExit() if g_game.isOnline() then g_game.forceLogout() scheduleEvent(exit, 10) @@ -131,7 +131,7 @@ function tryExit() local cancelButton = exitWindow:getChildById('buttonCancel') local exitFunc = function() - exit() + forceExit() end local logoutFunc = function() logout() diff --git a/modules/game_outfit/outfitwindow.otui b/modules/game_outfit/outfitwindow.otui index 034684eb..3c98113b 100644 --- a/modules/game_outfit/outfitwindow.otui +++ b/modules/game_outfit/outfitwindow.otui @@ -1,26 +1,13 @@ -BrowseButton < Button - size: 20 29 - icon-clip: 0 0 12 21 - - $hover !disabled: - icon-clip: 0 21 12 21 - - $pressed: - icon-clip: 0 22 12 21 - - $disabled: - color: #f0ad4d88 - -NextOutfitButton < BrowseButton +NextOutfitButton < NextButton icon-source: /images/arrow_right.png -PrevOutfitButton < BrowseButton +PrevOutfitButton < PreviousButton icon-source: /images/arrow_left.png -NextMountButton < BrowseButton +NextMountButton < NextButton icon-source: /images/arrow_right.png -PrevMountButton < BrowseButton +PrevMountButton < PreviousButton icon-source: /images/arrow_left.png Window