Market fix, and a few other things:
* Added 'button' param to g_mouse.bindPress * Added 'lower' param to table.contains * UIComboBox:onOptionChange should signalcall? * Changed the experience bar color * Market buy/sell 'amount' window will now show the cost of the amount you are selecting
This commit is contained in:
parent
8f9055f48b
commit
cb42481edd
|
@ -200,6 +200,7 @@ function setOption(key, value)
|
||||||
audioButton:setIcon('/images/topbuttons/audio_mute')
|
audioButton:setIcon('/images/topbuttons/audio_mute')
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
panel = audioPanel
|
||||||
elseif key == 'enableMusicSound' then
|
elseif key == 'enableMusicSound' then
|
||||||
g_sounds.getChannel(SoundChannels.Music):setEnabled(value)
|
g_sounds.getChannel(SoundChannels.Music):setEnabled(value)
|
||||||
elseif key == 'musicSoundVolume' then
|
elseif key == 'musicSoundVolume' then
|
||||||
|
|
|
@ -25,9 +25,12 @@ function g_mouse.bindPressMove(widget, callback)
|
||||||
end })
|
end })
|
||||||
end
|
end
|
||||||
|
|
||||||
function g_mouse.bindPress(widget, callback)
|
function g_mouse.bindPress(widget, callback, button)
|
||||||
connect(widget, { onMousePress = function(widget, mousePos, mouseButton)
|
connect(widget, { onMousePress = function(widget, mousePos, mouseButton)
|
||||||
|
if not button or button == mouseButton then
|
||||||
callback(mousePos, mouseButton)
|
callback(mousePos, mouseButton)
|
||||||
return true
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
end })
|
end })
|
||||||
end
|
end
|
||||||
|
|
|
@ -65,8 +65,8 @@ function table.findbykey(t, key, lowercase)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function table.contains(t, value)
|
function table.contains(t, value, lowercase)
|
||||||
return table.find(t, value) ~= nil
|
return table.find(t, value, lowercase) ~= nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function table.findkey(t, key)
|
function table.findkey(t, key)
|
||||||
|
|
|
@ -31,7 +31,7 @@ function UIComboBox:setCurrentOption(text)
|
||||||
if v.text == text and self.currentIndex ~= i then
|
if v.text == text and self.currentIndex ~= i then
|
||||||
self.currentIndex = i
|
self.currentIndex = i
|
||||||
self:setText(text)
|
self:setText(text)
|
||||||
self:onOptionChange(text, v.data)
|
signalcall(self.onOptionChange, self, text, v.data)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -43,7 +43,7 @@ function UIComboBox:setCurrentOptionByData(data)
|
||||||
if v.data == data and self.currentIndex ~= i then
|
if v.data == data and self.currentIndex ~= i then
|
||||||
self.currentIndex = i
|
self.currentIndex = i
|
||||||
self:setText(v.text)
|
self:setText(v.text)
|
||||||
self:onOptionChange(v.text, v.data)
|
signalcall(self.onOptionChange, self, v.text, v.data)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -54,7 +54,7 @@ function UIComboBox:setCurrentIndex(index)
|
||||||
local v = self.options[index]
|
local v = self.options[index]
|
||||||
self.currentIndex = index
|
self.currentIndex = index
|
||||||
self:setText(v.text)
|
self:setText(v.text)
|
||||||
self:onOptionChange(v.text, v.data)
|
signalcall(self.onOptionChange, self, v.text, v.data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -140,7 +140,3 @@ end
|
||||||
function UIComboBox:canMouseScroll()
|
function UIComboBox:canMouseScroll()
|
||||||
return self.mouseScroll
|
return self.mouseScroll
|
||||||
end
|
end
|
||||||
|
|
||||||
function UIComboBox:onOptionChange(optionText, optionData)
|
|
||||||
-- nothing todo
|
|
||||||
end
|
|
||||||
|
|
|
@ -96,8 +96,6 @@ MiniWindow
|
||||||
anchors.top: groupIconSpecial.bottom
|
anchors.top: groupIconSpecial.bottom
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
//border-width: 1
|
|
||||||
//border-color: #00000077
|
|
||||||
background-color: #ffffff11
|
background-color: #ffffff11
|
||||||
|
|
||||||
|
|
|
@ -15,11 +15,13 @@ ManaBar < ProgressBar
|
||||||
|
|
||||||
ExperienceBar < ProgressBar
|
ExperienceBar < ProgressBar
|
||||||
id: experienceBar
|
id: experienceBar
|
||||||
background-color: yellow
|
background-color: #B6E866
|
||||||
anchors.top: prev.bottom
|
anchors.top: prev.bottom
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
margin-top: 3
|
margin-top: 3
|
||||||
|
//margin-top: 6
|
||||||
|
//height: 12
|
||||||
|
|
||||||
SoulLabel < GameLabel
|
SoulLabel < GameLabel
|
||||||
id: soulLabel
|
id: soulLabel
|
||||||
|
|
|
@ -408,34 +408,40 @@ local function openAmountWindow(callback, type, actionText)
|
||||||
end
|
end
|
||||||
amountWindow = g_ui.createWidget('AmountWindow', rootWidget)
|
amountWindow = g_ui.createWidget('AmountWindow', rootWidget)
|
||||||
amountWindow:lock()
|
amountWindow:lock()
|
||||||
local max = selectedOffer[type]:getAmount()
|
local item = selectedOffer[type]:getItem()
|
||||||
|
|
||||||
|
local max = selectedOffer[type]:getAmount(item:getId())
|
||||||
if type == MarketAction.Sell then
|
if type == MarketAction.Sell then
|
||||||
local depot = Market.depotContains(selectedOffer[type]:getItem():getId())
|
local depot = Market.depotContains()
|
||||||
if max > depot then
|
if max > depot then
|
||||||
max = depot
|
max = depot
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local spinbox = amountWindow:getChildById('amountSpinBox')
|
local itembox = amountWindow:getChildById('item')
|
||||||
spinbox:setMaximum(max)
|
itembox:setItemId(item:getId())
|
||||||
spinbox:setMinimum(1)
|
itembox:setText(1)
|
||||||
spinbox:setValue(1)
|
|
||||||
|
|
||||||
local scrollbar = amountWindow:getChildById('amountScrollBar')
|
local scrollbar = amountWindow:getChildById('amountScrollBar')
|
||||||
|
scrollbar:setText(tostring(selectedOffer[type]:getPrice())..'gp')
|
||||||
scrollbar:setMaximum(max)
|
scrollbar:setMaximum(max)
|
||||||
scrollbar:setMinimum(1)
|
scrollbar:setMinimum(1)
|
||||||
scrollbar:setValue(1)
|
scrollbar:setValue(1)
|
||||||
|
|
||||||
scrollbar.onValueChange = function(self, value) spinbox:setValue(value) end
|
scrollbar.onValueChange = function(widget, value)
|
||||||
spinbox.onValueChange = function(self, value) scrollbar:setValue(value) end
|
widget:setText(tostring(value*selectedOffer[type]:getPrice())..'gp')
|
||||||
|
itembox:setText(tostring(value))
|
||||||
|
end
|
||||||
|
|
||||||
local okButton = amountWindow:getChildById('buttonOk')
|
local okButton = amountWindow:getChildById('buttonOk')
|
||||||
if actionText ~= '' then okButton:setText(actionText) end
|
if actionText ~= '' then
|
||||||
|
okButton:setText(actionText)
|
||||||
|
end
|
||||||
|
|
||||||
local okFunc = function()
|
local okFunc = function()
|
||||||
local counter = selectedOffer[type]:getCounter()
|
local counter = selectedOffer[type]:getCounter()
|
||||||
local timestamp = selectedOffer[type]:getTimeStamp()
|
local timestamp = selectedOffer[type]:getTimeStamp()
|
||||||
callback(spinbox:getValue(), timestamp, counter)
|
callback(scrollbar:getValue(), timestamp, counter)
|
||||||
okButton:getParent():destroy()
|
okButton:getParent():destroy()
|
||||||
amountWindow = nil
|
amountWindow = nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,39 +1,45 @@
|
||||||
AmountWindow < MainWindow
|
AmountWindow < MainWindow
|
||||||
id: amountWindow
|
id: amountWindow
|
||||||
!text: tr('Amount')
|
!text: tr('Amount')
|
||||||
size: 196 112
|
size: 196 80
|
||||||
|
|
||||||
Label
|
Item
|
||||||
!text: tr('Amount:')
|
id: item
|
||||||
width: 64
|
text-offset: 0 22
|
||||||
|
text-align: right
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
margin-top: 2
|
margin-top: 2
|
||||||
|
margin-left: -4
|
||||||
SpinBox
|
focusable: false
|
||||||
id: amountSpinBox
|
virtual: true
|
||||||
anchors.left: prev.right
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.top: parent.top
|
|
||||||
|
|
||||||
HorizontalScrollBar
|
HorizontalScrollBar
|
||||||
id: amountScrollBar
|
id: amountScrollBar
|
||||||
anchors.left: parent.left
|
anchors.left: prev.right
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: prev.bottom
|
anchors.top: prev.top
|
||||||
margin-top: 8
|
margin-left: 10
|
||||||
|
margin-top: -2
|
||||||
Button
|
focusable: false
|
||||||
id: buttonOk
|
|
||||||
!text: tr('Ok')
|
|
||||||
width: 64
|
|
||||||
anchors.right: next.left
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
margin-right: 5
|
|
||||||
|
|
||||||
Button
|
Button
|
||||||
id: buttonCancel
|
id: buttonCancel
|
||||||
!text: tr('Cancel')
|
!text: tr('Cancel')
|
||||||
width: 64
|
height: 20
|
||||||
anchors.right: parent.right
|
anchors.left: amountScrollBar.horizontalCenter
|
||||||
anchors.bottom: parent.bottom
|
anchors.right: amountScrollBar.right
|
||||||
|
anchors.top: amountScrollBar.bottom
|
||||||
|
margin-top: 7
|
||||||
|
focusable: false
|
||||||
|
|
||||||
|
Button
|
||||||
|
id: buttonOk
|
||||||
|
!text: tr('Ok')
|
||||||
|
height: 20
|
||||||
|
anchors.right: amountScrollBar.horizontalCenter
|
||||||
|
anchors.left: amountScrollBar.left
|
||||||
|
anchors.top: amountScrollBar.bottom
|
||||||
|
margin-top: 7
|
||||||
|
margin-right: 6
|
||||||
|
focusable: false
|
||||||
|
|
|
@ -176,7 +176,7 @@ Panel
|
||||||
margin-bottom: 6
|
margin-bottom: 6
|
||||||
@onSetup: self:setChecked(false)
|
@onSetup: self:setChecked(false)
|
||||||
height: 16
|
height: 16
|
||||||
width: 70
|
width: 90
|
||||||
|
|
||||||
Label
|
Label
|
||||||
id: feeLabel
|
id: feeLabel
|
||||||
|
|
|
@ -8,7 +8,8 @@ MarketItemBox < UICheckBox
|
||||||
Item
|
Item
|
||||||
id: item
|
id: item
|
||||||
phantom: true
|
phantom: true
|
||||||
text-offset: 0 13
|
virtual: true
|
||||||
|
text-offset: 0 22
|
||||||
text-align: right
|
text-align: right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
Loading…
Reference in New Issue