Market fixes
- Market now works after reloading - Fixed button / tab styles - MarketRightTabBarButton now inherits the base style - Fixed amountWindow buttons being hardly clickable - "All" search filter is now on by default
This commit is contained in:
parent
8542f8bfd4
commit
b5cea41f87
|
@ -36,10 +36,11 @@ TabBar < UITabBar
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
TabBarPanel < Panel
|
TabBarPanel < Panel
|
||||||
TabBarButton < UIButton
|
TabBarButton < UIButton
|
||||||
size: 22 23
|
size: 20 21
|
||||||
|
image-source: /images/ui/tabbutton_square
|
||||||
image-source: /images/ui/tabbutton_square
|
image-source: /images/ui/tabbutton_square
|
||||||
image-color: #dfdfdf
|
image-color: #dfdfdf
|
||||||
image-clip: 0 0 22 23
|
image-clip: 0 0 20 21
|
||||||
image-border: 3
|
image-border: 3
|
||||||
image-border-bottom: 0
|
image-border-bottom: 0
|
||||||
icon-color: #dfdfdf
|
icon-color: #dfdfdf
|
||||||
|
@ -55,7 +56,7 @@ TabBarButton < UIButton
|
||||||
margin-left: 5
|
margin-left: 5
|
||||||
|
|
||||||
$hover !checked:
|
$hover !checked:
|
||||||
image-clip: 0 23 22 23
|
image-clip: 0 21 20 21
|
||||||
color: #dfdfdf
|
color: #dfdfdf
|
||||||
|
|
||||||
$disabled:
|
$disabled:
|
||||||
|
@ -63,7 +64,7 @@ TabBarButton < UIButton
|
||||||
icon-color: #dfdfdf
|
icon-color: #dfdfdf
|
||||||
|
|
||||||
$checked:
|
$checked:
|
||||||
image-clip: 0 46 22 23
|
image-clip: 0 42 20 21
|
||||||
color: #dfdfdf
|
color: #dfdfdf
|
||||||
|
|
||||||
$on !checked:
|
$on !checked:
|
||||||
|
@ -73,6 +74,14 @@ TabBarRounded < TabBar
|
||||||
TabBarRoundedPanel < TabBarPanel
|
TabBarRoundedPanel < TabBarPanel
|
||||||
TabBarRoundedButton < TabBarButton
|
TabBarRoundedButton < TabBarButton
|
||||||
image-source: /images/ui/tabbutton_rounded
|
image-source: /images/ui/tabbutton_rounded
|
||||||
|
size: 22 23
|
||||||
|
image-clip: 0 0 22 23
|
||||||
|
|
||||||
|
$hover !checked:
|
||||||
|
image-clip: 0 23 22 23
|
||||||
|
|
||||||
|
$checked:
|
||||||
|
image-clip: 0 46 22 23
|
||||||
|
|
||||||
TabBarVertical < UITabBar
|
TabBarVertical < UITabBar
|
||||||
width: 96
|
width: 96
|
||||||
|
|
|
@ -38,6 +38,7 @@ function UITabBar:addTab(text, panel, icon)
|
||||||
end
|
end
|
||||||
|
|
||||||
local tab = g_ui.createWidget(self:getStyleName() .. 'Button', self.buttonsPanel)
|
local tab = g_ui.createWidget(self:getStyleName() .. 'Button', self.buttonsPanel)
|
||||||
|
|
||||||
panel.isTab = true
|
panel.isTab = true
|
||||||
tab.tabPanel = panel
|
tab.tabPanel = panel
|
||||||
tab.tabBar = self
|
tab.tabBar = self
|
||||||
|
|
|
@ -147,8 +147,8 @@ end
|
||||||
|
|
||||||
local function clearFilters()
|
local function clearFilters()
|
||||||
for _, filter in pairs(filterButtons) do
|
for _, filter in pairs(filterButtons) do
|
||||||
if filter and filter:isChecked() then
|
if filter and filter:isChecked() ~= filter.default then
|
||||||
filter:setChecked(false)
|
filter:setChecked(filter.default)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -400,6 +400,13 @@ local function updateFee(price, amount)
|
||||||
feeLabel:resizeToText()
|
feeLabel:resizeToText()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function destroyAmountWindow()
|
||||||
|
if amountWindow then
|
||||||
|
amountWindow:destroy()
|
||||||
|
amountWindow = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function openAmountWindow(callback, type, actionText)
|
local function openAmountWindow(callback, type, actionText)
|
||||||
local actionText = actionText or ''
|
local actionText = actionText or ''
|
||||||
if not Market.isOfferSelected(type) then
|
if not Market.isOfferSelected(type) then
|
||||||
|
@ -441,14 +448,12 @@ local function openAmountWindow(callback, type, actionText)
|
||||||
local counter = selectedOffer[type]:getCounter()
|
local counter = selectedOffer[type]:getCounter()
|
||||||
local timestamp = selectedOffer[type]:getTimeStamp()
|
local timestamp = selectedOffer[type]:getTimeStamp()
|
||||||
callback(scrollbar:getValue(), timestamp, counter)
|
callback(scrollbar:getValue(), timestamp, counter)
|
||||||
okButton:getParent():destroy()
|
destroyAmountWindow()
|
||||||
amountWindow = nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local cancelButton = amountWindow:getChildById('buttonCancel')
|
local cancelButton = amountWindow:getChildById('buttonCancel')
|
||||||
local cancelFunc = function()
|
local cancelFunc = function()
|
||||||
cancelButton:getParent():destroy()
|
destroyAmountWindow()
|
||||||
amountWindow = nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
amountWindow.onEnter = okFunc
|
amountWindow.onEnter = okFunc
|
||||||
|
@ -624,8 +629,10 @@ local function initInterface()
|
||||||
browsePanel = g_ui.loadUI('ui/marketoffers/browse')
|
browsePanel = g_ui.loadUI('ui/marketoffers/browse')
|
||||||
selectionTabBar:addTab(tr('Browse'), browsePanel)
|
selectionTabBar:addTab(tr('Browse'), browsePanel)
|
||||||
|
|
||||||
overviewPanel = g_ui.loadUI('ui/marketoffers/overview')
|
-- Currently not used
|
||||||
selectionTabBar:addTab(tr('Overview'), overviewPanel)
|
-- "Reserved for more functionality later"
|
||||||
|
--overviewPanel = g_ui.loadUI('ui/marketoffers/overview')
|
||||||
|
--selectionTabBar:addTab(tr('Overview'), overviewPanel)
|
||||||
|
|
||||||
displaysTabBar = marketOffersPanel:getChildById('rightTabBar')
|
displaysTabBar = marketOffersPanel:getChildById('rightTabBar')
|
||||||
displaysTabBar:setContentWidget(marketOffersPanel:getChildById('rightTabContent'))
|
displaysTabBar:setContentWidget(marketOffersPanel:getChildById('rightTabContent'))
|
||||||
|
@ -690,6 +697,14 @@ local function initInterface()
|
||||||
filterButtons[MarketFilters.Depot] = browsePanel:getChildById('filterDepot')
|
filterButtons[MarketFilters.Depot] = browsePanel:getChildById('filterDepot')
|
||||||
filterButtons[MarketFilters.SearchAll] = browsePanel:getChildById('filterSearchAll')
|
filterButtons[MarketFilters.SearchAll] = browsePanel:getChildById('filterSearchAll')
|
||||||
|
|
||||||
|
-- set filter default values
|
||||||
|
clearFilters()
|
||||||
|
|
||||||
|
-- hook filters
|
||||||
|
for _, filter in pairs(filterButtons) do
|
||||||
|
filter.onCheckChange = Market.updateCurrentItems
|
||||||
|
end
|
||||||
|
|
||||||
searchEdit = browsePanel:getChildById('searchEdit')
|
searchEdit = browsePanel:getChildById('searchEdit')
|
||||||
categoryList = browsePanel:getChildById('categoryComboBox')
|
categoryList = browsePanel:getChildById('categoryComboBox')
|
||||||
subCategoryList = browsePanel:getChildById('subCategoryComboBox')
|
subCategoryList = browsePanel:getChildById('subCategoryComboBox')
|
||||||
|
@ -744,10 +759,13 @@ function init()
|
||||||
end
|
end
|
||||||
|
|
||||||
function terminate()
|
function terminate()
|
||||||
|
Market.close()
|
||||||
|
|
||||||
protocol.terminateProtocol()
|
protocol.terminateProtocol()
|
||||||
disconnect(g_game, { onGameEnd = Market.reset })
|
disconnect(g_game, { onGameEnd = Market.reset })
|
||||||
disconnect(g_game, { onGameEnd = Market.close })
|
disconnect(g_game, { onGameEnd = Market.close })
|
||||||
|
|
||||||
|
destroyAmountWindow()
|
||||||
marketWindow:destroy()
|
marketWindow:destroy()
|
||||||
|
|
||||||
Market = nil
|
Market = nil
|
||||||
|
|
|
@ -3,7 +3,7 @@ MarketWindow < MainWindow
|
||||||
!text: tr('Market')
|
!text: tr('Market')
|
||||||
size: 700 530
|
size: 700 530
|
||||||
|
|
||||||
@onEscape: Market.close(true)
|
@onEscape: Market.close()
|
||||||
|
|
||||||
// Main Panel Window
|
// Main Panel Window
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ MarketWindow < MainWindow
|
||||||
Button
|
Button
|
||||||
id: resetButton
|
id: resetButton
|
||||||
!text: tr('Reset Market')
|
!text: tr('Reset Market')
|
||||||
|
!tooltip: tr('Reset selection, filters & search')
|
||||||
anchors.top: mainTabContent.bottom
|
anchors.top: mainTabContent.bottom
|
||||||
anchors.left: mainTabContent.left
|
anchors.left: mainTabContent.left
|
||||||
margin-top: 5
|
margin-top: 5
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
AmountWindow < MainWindow
|
AmountWindow < MainWindow
|
||||||
id: amountWindow
|
id: amountWindow
|
||||||
!text: tr('Amount')
|
!text: tr('Amount')
|
||||||
size: 270 80
|
size: 270 90
|
||||||
|
|
||||||
Item
|
Item
|
||||||
id: item
|
id: item
|
||||||
|
|
|
@ -4,7 +4,6 @@ MarketButtonBox < ButtonBoxRounded
|
||||||
size: 106 22
|
size: 106 22
|
||||||
text-offset: 0 2
|
text-offset: 0 2
|
||||||
text-align: center
|
text-align: center
|
||||||
image-border: 2
|
|
||||||
|
|
||||||
$checked:
|
$checked:
|
||||||
color: white
|
color: white
|
||||||
|
|
|
@ -10,15 +10,9 @@ MarketTabBarButton < TabBarButton
|
||||||
margin-left: 0
|
margin-left: 0
|
||||||
|
|
||||||
$hover !checked:
|
$hover !checked:
|
||||||
image-clip: 0 20 20 20
|
color: #ffffff
|
||||||
color: white
|
|
||||||
|
|
||||||
$disabled:
|
|
||||||
image-color: #ffffff66
|
|
||||||
icon-color: #888888
|
|
||||||
|
|
||||||
$checked:
|
$checked:
|
||||||
image-clip: 0 20 20 20
|
|
||||||
color: #ffffff
|
color: #ffffff
|
||||||
|
|
||||||
$on !checked:
|
$on !checked:
|
||||||
|
@ -26,36 +20,24 @@ MarketTabBarButton < TabBarButton
|
||||||
|
|
||||||
MarketRightTabBar < TabBar
|
MarketRightTabBar < TabBar
|
||||||
MarketRightTabBarPanel < TabBarPanel
|
MarketRightTabBarPanel < TabBarPanel
|
||||||
// TODO: inherit style from TabBarButton and adjust it
|
MarketRightTabBarButton < TabBarButton
|
||||||
// anchors.left: none did not seem to work for me
|
|
||||||
MarketRightTabBarButton < UIButton
|
|
||||||
size: 20 25
|
size: 20 25
|
||||||
font: verdana-11px-rounded
|
font: verdana-11px-rounded
|
||||||
text-offset: 0 2
|
text-offset: 0 2
|
||||||
image-source: /images/ui/tabbutton_square
|
color: #929292
|
||||||
image-color: white
|
|
||||||
image-clip: 0 0 20 20
|
|
||||||
image-border: 3
|
|
||||||
icon-color: white
|
|
||||||
color: #aaaaaa
|
|
||||||
anchors.top: parent.top
|
|
||||||
padding: 5
|
|
||||||
|
|
||||||
anchors.right: prev.left
|
|
||||||
|
|
||||||
$first:
|
$first:
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
anchors.left: none
|
||||||
|
|
||||||
|
$!first:
|
||||||
|
anchors.right: prev.left
|
||||||
|
anchors.left: none
|
||||||
|
|
||||||
$hover !checked:
|
$hover !checked:
|
||||||
image-clip: 0 20 20 20
|
color: #ffffff
|
||||||
color: white
|
|
||||||
|
|
||||||
$disabled:
|
|
||||||
image-color: #ffffff66
|
|
||||||
icon-color: #888888
|
|
||||||
|
|
||||||
$checked:
|
$checked:
|
||||||
image-clip: 0 20 20 20
|
|
||||||
color: #ffffff
|
color: #ffffff
|
||||||
|
|
||||||
$on !checked:
|
$on !checked:
|
||||||
|
|
|
@ -52,7 +52,7 @@ Panel
|
||||||
|
|
||||||
MarketButtonBox
|
MarketButtonBox
|
||||||
id: filterLevel
|
id: filterLevel
|
||||||
checked: false
|
&default: false
|
||||||
!text: tr('Level')
|
!text: tr('Level')
|
||||||
!tooltip: tr('Filter list to match your level')
|
!tooltip: tr('Filter list to match your level')
|
||||||
anchors.top: prev.bottom
|
anchors.top: prev.bottom
|
||||||
|
@ -62,11 +62,10 @@ Panel
|
||||||
margin-left: 3
|
margin-left: 3
|
||||||
width: 40
|
width: 40
|
||||||
height: 20
|
height: 20
|
||||||
@onCheckChange: Market.updateCurrentItems()
|
|
||||||
|
|
||||||
MarketButtonBox
|
MarketButtonBox
|
||||||
id: filterVocation
|
id: filterVocation
|
||||||
checked: false
|
&default: false
|
||||||
!text: tr('Voc.')
|
!text: tr('Voc.')
|
||||||
!tooltip: tr('Filter list to match your vocation')
|
!tooltip: tr('Filter list to match your vocation')
|
||||||
anchors.top: prev.top
|
anchors.top: prev.top
|
||||||
|
@ -75,7 +74,6 @@ Panel
|
||||||
margin-left: 3
|
margin-left: 3
|
||||||
width: 34
|
width: 34
|
||||||
height: 20
|
height: 20
|
||||||
@onCheckChange: Market.updateCurrentItems()
|
|
||||||
|
|
||||||
MarketComboBox
|
MarketComboBox
|
||||||
id: slotComboBox
|
id: slotComboBox
|
||||||
|
@ -90,7 +88,7 @@ Panel
|
||||||
|
|
||||||
MarketButtonBox
|
MarketButtonBox
|
||||||
id: filterDepot
|
id: filterDepot
|
||||||
checked: false
|
&default: false
|
||||||
!text: tr('Show Depot Only')
|
!text: tr('Show Depot Only')
|
||||||
!tooltip: tr('Show your depot items only')
|
!tooltip: tr('Show your depot items only')
|
||||||
anchors.top: prev.bottom
|
anchors.top: prev.bottom
|
||||||
|
@ -99,7 +97,6 @@ Panel
|
||||||
margin-top: 6
|
margin-top: 6
|
||||||
margin-right: 3
|
margin-right: 3
|
||||||
margin-left: 3
|
margin-left: 3
|
||||||
@onCheckChange: Market.updateCurrentItems()
|
|
||||||
|
|
||||||
Panel
|
Panel
|
||||||
id: itemsContainer
|
id: itemsContainer
|
||||||
|
@ -152,11 +149,10 @@ Panel
|
||||||
|
|
||||||
MarketButtonBox
|
MarketButtonBox
|
||||||
id: filterSearchAll
|
id: filterSearchAll
|
||||||
checked: false
|
&default: true
|
||||||
!text: tr('All')
|
!text: tr('All')
|
||||||
!tooltip: tr('Search all items')
|
!tooltip: tr('Search all items')
|
||||||
anchors.verticalCenter: prev.verticalCenter
|
anchors.verticalCenter: prev.verticalCenter
|
||||||
anchors.left: prev.right
|
anchors.left: prev.right
|
||||||
anchors.right: itemsContainer.right
|
anchors.right: itemsContainer.right
|
||||||
margin-left: 3
|
margin-left: 3
|
||||||
@onCheckChange: Market.updateCurrentItems()
|
|
||||||
|
|
Loading…
Reference in New Issue