some controlflow utils
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
Aux.buy = {}
|
||||
|
||||
local record_auction, set_message, report, tooltip_match
|
||||
local record_auction, set_message, report, tooltip_match, show_buyout_dialog, show_bid_dialog
|
||||
local entries
|
||||
local selectedEntries = {}
|
||||
local search_query
|
||||
@@ -123,6 +123,43 @@ function set_message(msg)
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
function show_buyout_dialog(hyperlink, stack_size, buyout_price)
|
||||
AuxBuyBuyoutDialogBuyButton:Disable()
|
||||
AuxBuyBuyoutDialogHTML:SetFontObject('h1', GameFontWhite)
|
||||
AuxBuyBuyoutDialogHTML:SetScript('OnHyperlinkClick', function() SetItemRef(arg1) end)
|
||||
AuxBuyBuyoutDialogHTML:SetText(string.format(
|
||||
[[
|
||||
<html>
|
||||
<body>
|
||||
<h1>%s x %i</h1>
|
||||
</body>
|
||||
</html>
|
||||
]],
|
||||
hyperlink,
|
||||
stack_size
|
||||
))
|
||||
--MoneyFrame_Update('AuxBuyBuyoutDialogBuyoutPrice', Aux_Round(buyout_price))
|
||||
AuxBuyBuyoutDialog:Show()
|
||||
end
|
||||
|
||||
function show_bid_dialog(hyperlink, stack_size, bid)
|
||||
AuxBuyBidDialogBidButton:Disable()
|
||||
AuxBuyBidDialogHTML:SetFontObject('h1', GameFontWhite)
|
||||
AuxBuyBidDialogHTML:SetScript('OnHyperlinkClick', function() SetItemRef(arg1) end)
|
||||
AuxBuyBidDialogHTML:SetText(string.format(
|
||||
[[
|
||||
<html>
|
||||
<body>
|
||||
<h1>%s x %i</h1>
|
||||
</body>
|
||||
</html>
|
||||
]],
|
||||
hyperlink,
|
||||
stack_size
|
||||
))
|
||||
AuxBuyBidDialog:Show()
|
||||
MoneyInputFrame_SetCopper(AuxBuyBidDialogBid, 5)
|
||||
end
|
||||
|
||||
function AuxBuyEntry_OnClick()
|
||||
local express_mode = IsControlKeyDown()
|
||||
@@ -133,29 +170,11 @@ function AuxBuyEntry_OnClick()
|
||||
local entry = entries[entry_index]
|
||||
|
||||
if not express_mode then
|
||||
AuxBuyBuyoutDialogBuyButton:Disable()
|
||||
AuxBuyBuyoutDialogHTML:SetText(string.format(
|
||||
[[
|
||||
<html>
|
||||
<body>
|
||||
<h1>%s</h1>
|
||||
<br/>
|
||||
<p>
|
||||
Stack Size: %i
|
||||
<br/><br/>
|
||||
Buyout Price: %s
|
||||
<br/><br/>
|
||||
Unit Price: %s
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
]],
|
||||
entry.name,
|
||||
entry.stack_size,
|
||||
Aux.util.format_money(entry.buyout_price),
|
||||
Aux.util.format_money(entry.item_price)
|
||||
))
|
||||
AuxBuyBuyoutDialog:Show()
|
||||
if arg1 == "LeftButton" then
|
||||
show_buyout_dialog(entry.hyperlink, entry.stack_size, entry.buyout_price)
|
||||
elseif arg1 == "RightButton" then
|
||||
show_bid_dialog(entry.hyperlink, entry.stack_size, entry.buyout_price)
|
||||
end
|
||||
end
|
||||
|
||||
PlaySound("igMainMenuOptionCheckBoxOn")
|
||||
|
||||
@@ -12,6 +12,11 @@
|
||||
|
||||
<Button name="AuxBuyEntryTemplate" virtual="true" hidden="true">
|
||||
<Size><AbsDimension y="16"/></Size>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
this:RegisterForClicks("LeftButtonUp", "RightButtonUp")
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
<Frames>
|
||||
<Frame>
|
||||
<Size><AbsDimension x="120" y="16" /></Size>
|
||||
@@ -370,7 +375,7 @@
|
||||
<Frame name="AuxBuyBuyoutDialog" frameStrata="FULLSCREEN_DIALOG" toplevel="true" enableMouse="true" hidden="true" movable="true">
|
||||
<Size><AbsDimension x="260" y="160" /></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="300" y="-150"/></Offset></Anchor></Anchors>
|
||||
|
||||
|
||||
<Scripts>
|
||||
<OnLoad>this:RegisterForDrag("LeftButton")</OnLoad>
|
||||
<OnDragStart>this:StartMoving()</OnDragStart>
|
||||
@@ -380,17 +385,31 @@
|
||||
<BackgroundInsets><AbsInset left="11" right="12" top="12" bottom="11"/></BackgroundInsets>
|
||||
<TileSize><AbsValue val="32"/></TileSize>
|
||||
<EdgeSize><AbsValue val="32"/></EdgeSize>
|
||||
</Backdrop>
|
||||
|
||||
</Backdrop>
|
||||
<Frames>
|
||||
<SimpleHTML name="$parentHTML">
|
||||
<Size><AbsDimension x="420" y="420" /></Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-30"/></Offset></Anchor>
|
||||
</Anchors>
|
||||
<FontString inherits="GameFontHighlightSmall"/>
|
||||
<FontStringHeader1 inherits="GameFontNormal"/>
|
||||
</SimpleHTML>
|
||||
<Size><AbsDimension x="260" y="160" /></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-30"/></Offset></Anchor></Anchors>
|
||||
<FontStringHeader1 inherits="GameFontNormalWhite"/>
|
||||
</SimpleHTML>
|
||||
<Frame>
|
||||
<Frame>
|
||||
<Size><AbsDimension x="120" y="16" /></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-70"/></Offset></Anchor></Anchors>
|
||||
<Frames>
|
||||
<Frame name="$parentBuyoutPrice" inherits="SmallMoneyFrameTemplate">
|
||||
<Anchors><Anchor point="RIGHT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
SmallMoneyFrame_OnLoad()
|
||||
MoneyFrame_SetType("STATIC")
|
||||
snipe.log('kek'..this:GetName())
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frame>
|
||||
</Frame>
|
||||
<Button name="$parentBuyButton" inherits="UIPanelButtonTemplate" text="Buy" disabled="true">
|
||||
<Size><AbsDimension x="100" y="22"/> </Size>
|
||||
<Anchors><Anchor point="BOTTOMLEFT"><Offset><AbsDimension x="20" y="15"/></Offset></Anchor></Anchors>
|
||||
@@ -411,6 +430,51 @@
|
||||
</Button>
|
||||
</Frames>
|
||||
</Frame>
|
||||
|
||||
<Frame name="AuxBuyBidDialog" frameStrata="FULLSCREEN_DIALOG" toplevel="true" enableMouse="true" hidden="true" movable="true">
|
||||
|
||||
<Size><AbsDimension x="260" y="160" /></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="300" y="-150"/></Offset></Anchor></Anchors>
|
||||
|
||||
<Scripts>
|
||||
<OnLoad>this:RegisterForDrag("LeftButton")</OnLoad>
|
||||
<OnDragStart>this:StartMoving()</OnDragStart>
|
||||
<OnDragStop>this:StopMovingOrSizing()</OnDragStop>
|
||||
</Scripts>
|
||||
<Backdrop bgFile="Interface\CharacterFrame\UI-Party-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
|
||||
<BackgroundInsets><AbsInset left="11" right="12" top="12" bottom="11"/></BackgroundInsets>
|
||||
<TileSize><AbsValue val="32"/></TileSize>
|
||||
<EdgeSize><AbsValue val="32"/></EdgeSize>
|
||||
</Backdrop>
|
||||
|
||||
<Frames>
|
||||
<SimpleHTML name="$parentHTML">
|
||||
<Size><AbsDimension x="260" y="160" /></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-30"/></Offset></Anchor></Anchors>
|
||||
</SimpleHTML>
|
||||
<Frame name="$parentBid" inherits="MoneyInputFrameTemplate">
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-70"/></Offset></Anchor></Anchors>
|
||||
</Frame>
|
||||
<Button name="$parentBidButton" inherits="UIPanelButtonTemplate" text="Bid" disabled="true">
|
||||
<Size><AbsDimension x="100" y="22"/> </Size>
|
||||
<Anchors><Anchor point="BOTTOMLEFT"><Offset><AbsDimension x="20" y="15"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Aux.buy.bid_dialog_bid()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
<Button name="$parentCancelButton" inherits="UIPanelButtonTemplate" text="Cancel">
|
||||
<Size><AbsDimension x="100" y="22"/> </Size>
|
||||
<Anchors><Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="-20" y="15"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Aux.buy.bid_dialog_cancel()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
</Frames>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frame>
|
||||
|
||||
@@ -427,11 +491,7 @@
|
||||
<Frames>
|
||||
<SimpleHTML name="AuxBuyReportHTML">
|
||||
<Size><AbsDimension x="420" y="420" /></Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-30"/></Offset></Anchor>
|
||||
</Anchors>
|
||||
<FontString inherits="GameFontHighlightSmall"/>
|
||||
<FontStringHeader1 inherits="GameFontNormal"/>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-30"/></Offset></Anchor></Anchors>
|
||||
</SimpleHTML>
|
||||
|
||||
<Button inherits="UIPanelButtonTemplate" text="Close">
|
||||
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
Aux.control = {}
|
||||
|
||||
local events = {}
|
||||
|
||||
local event_listeners = {}
|
||||
|
||||
local update_listeners = {}
|
||||
|
||||
function Aux.util.controller()
|
||||
local ready, continuation
|
||||
return {
|
||||
|
||||
}
|
||||
end
|
||||
|
||||
function Aux.util.event_listener(event, action)
|
||||
return {
|
||||
start = function()
|
||||
tinsert(events, f)
|
||||
end,
|
||||
stop = function()
|
||||
Aux.util.remove(events, f)
|
||||
end
|
||||
|
||||
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function Aux.control.onevent()
|
||||
|
||||
end
|
||||
|
||||
|
||||
function Aux.control.onupdate()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
local listen_for_event(listener)
|
||||
tinsert(event_listeners, listener)
|
||||
return function()
|
||||
Aux.util.remove(event_listeners, listener)
|
||||
end
|
||||
end
|
||||
|
||||
function wait_for_event(event)
|
||||
return function
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user