post refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-07-26 04:49:26 +02:00
parent 552ca3f596
commit 77f7f36ec6
6 changed files with 89 additions and 85 deletions
+9 -9
View File
@@ -276,10 +276,10 @@ function private.update_item_configuration()
if not m.selected_item then
m.refresh_button:Disable()
AuxPostItemIconTexture:SetTexture(nil)
AuxPostItemCount:SetText()
AuxPostItemName:SetTextColor(unpack(Aux.gui.config.label_color.enabled))
AuxPostItemName:SetText('No item selected')
m.item.texture:SetTexture(nil)
m.item.count:SetText()
m.item.name:SetTextColor(unpack(Aux.gui.config.label_color.enabled))
m.item.name:SetText('No item selected')
m.unit_start_price:Hide()
m.unit_buyout_price:Hide()
@@ -299,14 +299,14 @@ function private.update_item_configuration()
m.historical_value_button:Show()
m.hide_checkbox:Show()
AuxPostItemIconTexture:SetTexture(m.selected_item.texture)
AuxPostItemName:SetText('['..m.selected_item.name..']')
m.item.texture:SetTexture(m.selected_item.texture)
m.item.name:SetText('['..m.selected_item.name..']')
local color = ITEM_QUALITY_COLORS[m.selected_item.quality]
AuxPostItemName:SetTextColor(color.r, color.g, color.b)
m.item.name:SetTextColor(color.r, color.g, color.b)
if m.selected_item.aux_quantity > 1 then
AuxPostItemCount:SetText(m.selected_item.aux_quantity)
m.item.count:SetText(m.selected_item.aux_quantity)
else
AuxPostItemCount:SetText()
m.item.count:SetText()
end
m.stack_size_slider.editbox:SetNumber(m.stack_size_slider:GetValue())
+35 -33
View File
@@ -19,44 +19,11 @@ Aux.post_tab.FRAMES(function(m, public, private)
m.frame.parameters:SetPoint('TOPLEFT', m.frame.inventory, 'TOPRIGHT', 2.5, 0)
m.frame.parameters:SetPoint('TOPRIGHT', 0, 0)
m.frame.parameters.item = CreateFrame('Button', 'AuxPostItem', m.frame.parameters, 'AuxItemTemplate')
m.frame.parameters.item:SetPoint('TOPLEFT', 10, -10)
m.frame.auctions = Aux.gui.panel(m.frame.content)
m.frame.auctions:SetHeight(228)
m.frame.auctions:SetPoint('BOTTOMLEFT', m.frame.inventory, 'BOTTOMRIGHT', 2.5, 0)
m.frame.auctions:SetPoint('BOTTOMRIGHT', 0, 0)
m.frame.parameters.item:EnableMouse()
m.frame.parameters.item:SetScript('OnReceiveDrag', function()
local item_info = Aux.cursor_item()
if item_info then
m.select_item(item_info.item_key)
end
ClearCursor()
end)
m.frame.parameters.item:SetScript('OnClick', function()
local item_info = Aux.cursor_item()
if item_info then
m.select_item(item_info.item_key)
end
ClearCursor()
end)
local highlight = m.frame.parameters.item:CreateTexture()
highlight:SetAllPoints(m.frame.parameters.item)
highlight:Hide()
highlight:SetTexture(1, .9, .9, .1)
m.frame.parameters.item:SetScript('OnEnter', function()
highlight:Show()
if m.selected_item then
Aux.info.set_tooltip(m.selected_item.itemstring, this, 'ANCHOR_RIGHT')
end
end)
m.frame.parameters.item:SetScript('OnLeave', function()
highlight:Hide()
GameTooltip:Hide()
end)
do
local checkbox = CreateFrame('CheckButton', nil, m.frame.inventory, 'UICheckButtonTemplate')
checkbox:SetWidth(22)
@@ -150,6 +117,41 @@ Aux.post_tab.FRAMES(function(m, public, private)
end)
private.refresh_button = btn
end
do
local item = Aux.gui.item(m.frame.parameters)
item:SetPoint('TOPLEFT', 10, -10)
item:EnableMouse()
item:SetScript('OnReceiveDrag', function()
local item_info = Aux.cursor_item()
if item_info then
m.select_item(item_info.item_key)
end
ClearCursor()
end)
item:SetScript('OnClick', function()
local item_info = Aux.cursor_item()
if item_info then
m.select_item(item_info.item_key)
end
ClearCursor()
end)
local highlight = item:CreateTexture()
highlight:SetPoint('TOPLEFT', -2, 2)
highlight:SetPoint('BOTTOMRIGHT', 2, -2)
highlight:Hide()
highlight:SetTexture(1, .9, .9, .1)
item:SetScript('OnEnter', function()
highlight:Show()
if m.selected_item then
Aux.info.set_tooltip(m.selected_item.itemstring, this, 'ANCHOR_RIGHT')
end
end)
item:SetScript('OnLeave', function()
highlight:Hide()
GameTooltip:Hide()
end)
private.item = item
end
do
local slider = Aux.gui.slider(m.frame.parameters)
slider:SetValueStep(1)