Fix to spin box button fit and npc trade:
* Fit spin box buttons properly * NPC trade you can now look at items you can sell/buy (Waiting for ed to implement a way to set item image color before its completed)
This commit is contained in:
parent
a2ddb472f5
commit
c7ff744dcd
|
@ -1,6 +1,7 @@
|
|||
SpinBox < TextEdit
|
||||
__class: UISpinBox
|
||||
size: 86 20
|
||||
padding: 0
|
||||
|
||||
Button
|
||||
id: up
|
||||
|
|
|
@ -33,6 +33,8 @@ tradeItems = {}
|
|||
playerItems = nil
|
||||
selectedItem = nil
|
||||
|
||||
mouseWidget = nil
|
||||
|
||||
function init()
|
||||
npcWindow = g_ui.displayUI('npctrade')
|
||||
npcWindow:setVisible(false)
|
||||
|
@ -63,6 +65,11 @@ function init()
|
|||
radioTabs:selectWidget(buyTab)
|
||||
radioTabs.onSelectionChange = onTradeTypeChange
|
||||
|
||||
mouseWidget = g_ui.createWidget('UIButton')
|
||||
mouseWidget:setVisible(false)
|
||||
mouseWidget:setFocusable(false)
|
||||
mouseWidget.cancelNextRelease = false
|
||||
|
||||
if g_game.isOnline() then
|
||||
playerFreeCapacity = g_game.getLocalPlayer():getFreeCapacity()
|
||||
end
|
||||
|
@ -150,11 +157,21 @@ function onSearchTextChange()
|
|||
end
|
||||
|
||||
function itemPopup(self, mousePosition, mouseButton)
|
||||
if mouseWidget.cancelNextRelease then
|
||||
mouseWidget.cancelNextRelease = false
|
||||
return false
|
||||
end
|
||||
|
||||
if mouseButton == MouseRightButton then
|
||||
local menu = g_ui.createWidget('PopupMenu')
|
||||
menu:addOption(tr('Look'), function() return g_game.inspectNpcTrade(self:getItem()) end)
|
||||
menu:display(mousePosition)
|
||||
return true
|
||||
elseif ((g_mouse.isPressed(MouseLeftButton) and mouseButton == MouseRightButton)
|
||||
or (g_mouse.isPressed(MouseRightButton) and mouseButton == MouseLeftButton)) then
|
||||
mouseWidget.cancelNextRelease = true
|
||||
g_game.inspectNpcTrade(self:getItem())
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
@ -339,7 +356,7 @@ function refreshPlayerGoods()
|
|||
local item = itemWidget.item
|
||||
|
||||
local canTrade = canTradeItem(item)
|
||||
itemWidget:setEnabled(canTrade)
|
||||
itemWidget:setOn(canTrade)
|
||||
|
||||
local searchCondition = (searchFilter == '') or (searchFilter ~= '' and string.find(item.name:lower(), searchFilter) ~= nil)
|
||||
local showAllItemsCondition = (currentTradeType == BUY) or (showAllItems:isChecked()) or (currentTradeType == SELL and not showAllItems:isChecked() and canTrade)
|
||||
|
@ -426,4 +443,3 @@ function onInventoryChange(inventory, item, oldItem)
|
|||
refreshItem(selectedItem)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -17,15 +17,16 @@ NPCItemBox < UICheckBox
|
|||
phantom: true
|
||||
anchors.top: parent.top
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
image-color: #ffffffff
|
||||
margin-top: 5
|
||||
|
||||
$checked:
|
||||
$checked on:
|
||||
border-color: #ffffff
|
||||
|
||||
$hover !checked:
|
||||
border-color: #aaaaaa
|
||||
$!checked:
|
||||
border-color: #000000
|
||||
|
||||
$disabled:
|
||||
$!on:
|
||||
image-color: #ffffff88
|
||||
color: #aaaaaa88
|
||||
|
||||
|
|
Loading…
Reference in New Issue