some controlflow utils
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
Aux.buy = {}
|
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 entries
|
||||||
local selectedEntries = {}
|
local selectedEntries = {}
|
||||||
local search_query
|
local search_query
|
||||||
@@ -123,6 +123,43 @@ function set_message(msg)
|
|||||||
end
|
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()
|
function AuxBuyEntry_OnClick()
|
||||||
local express_mode = IsControlKeyDown()
|
local express_mode = IsControlKeyDown()
|
||||||
@@ -133,29 +170,11 @@ function AuxBuyEntry_OnClick()
|
|||||||
local entry = entries[entry_index]
|
local entry = entries[entry_index]
|
||||||
|
|
||||||
if not express_mode then
|
if not express_mode then
|
||||||
AuxBuyBuyoutDialogBuyButton:Disable()
|
if arg1 == "LeftButton" then
|
||||||
AuxBuyBuyoutDialogHTML:SetText(string.format(
|
show_buyout_dialog(entry.hyperlink, entry.stack_size, entry.buyout_price)
|
||||||
[[
|
elseif arg1 == "RightButton" then
|
||||||
<html>
|
show_bid_dialog(entry.hyperlink, entry.stack_size, entry.buyout_price)
|
||||||
<body>
|
end
|
||||||
<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()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
PlaySound("igMainMenuOptionCheckBoxOn")
|
PlaySound("igMainMenuOptionCheckBoxOn")
|
||||||
|
|||||||
@@ -12,6 +12,11 @@
|
|||||||
|
|
||||||
<Button name="AuxBuyEntryTemplate" virtual="true" hidden="true">
|
<Button name="AuxBuyEntryTemplate" virtual="true" hidden="true">
|
||||||
<Size><AbsDimension y="16"/></Size>
|
<Size><AbsDimension y="16"/></Size>
|
||||||
|
<Scripts>
|
||||||
|
<OnLoad>
|
||||||
|
this:RegisterForClicks("LeftButtonUp", "RightButtonUp")
|
||||||
|
</OnLoad>
|
||||||
|
</Scripts>
|
||||||
<Frames>
|
<Frames>
|
||||||
<Frame>
|
<Frame>
|
||||||
<Size><AbsDimension x="120" y="16" /></Size>
|
<Size><AbsDimension x="120" y="16" /></Size>
|
||||||
@@ -381,16 +386,30 @@
|
|||||||
<TileSize><AbsValue val="32"/></TileSize>
|
<TileSize><AbsValue val="32"/></TileSize>
|
||||||
<EdgeSize><AbsValue val="32"/></EdgeSize>
|
<EdgeSize><AbsValue val="32"/></EdgeSize>
|
||||||
</Backdrop>
|
</Backdrop>
|
||||||
|
|
||||||
<Frames>
|
<Frames>
|
||||||
<SimpleHTML name="$parentHTML">
|
<SimpleHTML name="$parentHTML">
|
||||||
<Size><AbsDimension x="420" y="420" /></Size>
|
<Size><AbsDimension x="260" y="160" /></Size>
|
||||||
<Anchors>
|
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-30"/></Offset></Anchor></Anchors>
|
||||||
<Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-30"/></Offset></Anchor>
|
<FontStringHeader1 inherits="GameFontNormalWhite"/>
|
||||||
</Anchors>
|
|
||||||
<FontString inherits="GameFontHighlightSmall"/>
|
|
||||||
<FontStringHeader1 inherits="GameFontNormal"/>
|
|
||||||
</SimpleHTML>
|
</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">
|
<Button name="$parentBuyButton" inherits="UIPanelButtonTemplate" text="Buy" disabled="true">
|
||||||
<Size><AbsDimension x="100" y="22"/> </Size>
|
<Size><AbsDimension x="100" y="22"/> </Size>
|
||||||
<Anchors><Anchor point="BOTTOMLEFT"><Offset><AbsDimension x="20" y="15"/></Offset></Anchor></Anchors>
|
<Anchors><Anchor point="BOTTOMLEFT"><Offset><AbsDimension x="20" y="15"/></Offset></Anchor></Anchors>
|
||||||
@@ -411,6 +430,51 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</Frames>
|
</Frames>
|
||||||
</Frame>
|
</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>
|
</Frames>
|
||||||
</Frame>
|
</Frame>
|
||||||
|
|
||||||
@@ -427,11 +491,7 @@
|
|||||||
<Frames>
|
<Frames>
|
||||||
<SimpleHTML name="AuxBuyReportHTML">
|
<SimpleHTML name="AuxBuyReportHTML">
|
||||||
<Size><AbsDimension x="420" y="420" /></Size>
|
<Size><AbsDimension x="420" y="420" /></Size>
|
||||||
<Anchors>
|
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-30"/></Offset></Anchor></Anchors>
|
||||||
<Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-30"/></Offset></Anchor>
|
|
||||||
</Anchors>
|
|
||||||
<FontString inherits="GameFontHighlightSmall"/>
|
|
||||||
<FontStringHeader1 inherits="GameFontNormal"/>
|
|
||||||
</SimpleHTML>
|
</SimpleHTML>
|
||||||
|
|
||||||
<Button inherits="UIPanelButtonTemplate" text="Close">
|
<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