fixes to npctrade
This commit is contained in:
parent
8d0f07255d
commit
170d4fd365
|
@ -148,13 +148,15 @@ local function refreshTradeItems()
|
|||
for key,item in pairs(currentTradeItems) do
|
||||
local itemBox = createWidget('NPCItemBox', itemsPanel)
|
||||
itemBox.item = item
|
||||
itemBox:getChildById('item'):setItem(item.ptr)
|
||||
itemBox:getChildById('nameLabel'):setText(item.name)
|
||||
itemBox:getChildById('weightLabel'):setText(string.format('%.2f', item.weight) .. ' ' .. WEIGHT_UNIT)
|
||||
itemBox:getChildById('priceLabel'):setText(item.price .. ' ' .. CURRENCY)
|
||||
|
||||
local name = item.name
|
||||
local weight = string.format('%.2f', item.weight) .. ' ' .. WEIGHT_UNIT
|
||||
local price = item.price .. ' ' .. CURRENCY
|
||||
itemBox:setText(name .. '\n' .. weight .. '\n' .. price)
|
||||
|
||||
itemBox.onMouseRelease = NPCTrade.itemPopup
|
||||
itemBox:getChildById('item').onMouseRelease = function(self, mousePosition, mouseButton) NPCTrade.itemPopup(itemBox, mousePosition, mouseButton) end
|
||||
local itemWidget = itemBox:getChildById('item')
|
||||
itemWidget:setItem(item.ptr)
|
||||
itemWidget.onMouseRelease = NPCTrade.itemPopup
|
||||
|
||||
radioItems:addWidget(itemBox)
|
||||
end
|
||||
|
@ -344,9 +346,11 @@ end
|
|||
function NPCTrade.itemPopup(self, mousePosition, mouseButton)
|
||||
if mouseButton == MouseRightButton then
|
||||
local menu = createWidget('PopupMenu')
|
||||
menu:addOption(tr('Look'), function() return g_game.inspectNpcTrade(self.offer[1]) end)
|
||||
menu:addOption(tr('Look'), function() return g_game.inspectNpcTrade(self:getItem()) end)
|
||||
menu:display(mousePosition)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function NPCTrade.onBuyWithBackpackChange()
|
||||
|
|
|
@ -7,6 +7,9 @@ NPCOfferLabel < Label
|
|||
NPCItemBox < UICheckBox
|
||||
border-width: 1
|
||||
border-color: #000000
|
||||
color: #aaaaaa
|
||||
text-align: center
|
||||
text-offset: 0 20
|
||||
@onCheckChange: NPCTrade.onItemBoxChecked(self)
|
||||
|
||||
Item
|
||||
|
@ -14,37 +17,17 @@ NPCItemBox < UICheckBox
|
|||
phantom: true
|
||||
anchors.top: parent.top
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
margin-top: 3
|
||||
|
||||
Label
|
||||
id: nameLabel
|
||||
phantom: true
|
||||
anchors.top: prev.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text-auto-resize: true
|
||||
margin-top: 3
|
||||
|
||||
Label
|
||||
id: weightLabel
|
||||
phantom: true
|
||||
anchors.top: prev.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text-auto-resize: true
|
||||
margin-top: 3
|
||||
|
||||
Label
|
||||
id: priceLabel
|
||||
phantom: true
|
||||
anchors.top: prev.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text-auto-resize: true
|
||||
margin-top: 3
|
||||
margin-top: 5
|
||||
|
||||
$checked:
|
||||
border-color: #FFFFFF
|
||||
border-color: #ffffff
|
||||
|
||||
$hover !checked:
|
||||
border-color: #AAAAAA
|
||||
border-color: #aaaaaa
|
||||
|
||||
$disabled:
|
||||
image-color: #ffffff88
|
||||
color: #aaaaaa88
|
||||
|
||||
MainWindow
|
||||
id: npcWindow
|
||||
|
|
Loading…
Reference in New Issue