Dynamically generate Priority Frames, fixing 16 option limit
This commit is contained in:
parent
5c4bf53d17
commit
000e731fbc
161
TurnIn.xml
161
TurnIn.xml
@ -684,167 +684,6 @@
|
|||||||
<Size>
|
<Size>
|
||||||
<AbsDimension x="200" y="30"/>
|
<AbsDimension x="200" y="30"/>
|
||||||
</Size>
|
</Size>
|
||||||
|
|
||||||
<!--<Layers>
|
|
||||||
<Layer level="OVERLAY">
|
|
||||||
<FontString name="$parentText" justifyV="top" justifyH="left" inherits="GameFontNormal" text="Gossip Options">
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="TOPLEFT" />
|
|
||||||
</Anchors>
|
|
||||||
</FontString>
|
|
||||||
</Layer>
|
|
||||||
<Layer level="BACKGROUND">
|
|
||||||
<Texture name="$parent_Background" setAllPoints="true">
|
|
||||||
<Color r="0" g="1" b="0" a="0.0"/>
|
|
||||||
</Texture>
|
|
||||||
</Layer>
|
|
||||||
</Layers>-->
|
|
||||||
<Frames>
|
|
||||||
<Button name="$parent1" id="1" hidden="true" inherits="TI_PriorityList">
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="TOPLEFT">
|
|
||||||
<Offset>
|
|
||||||
<AbsDimension x="0" y="0" />
|
|
||||||
</Offset>
|
|
||||||
</Anchor>
|
|
||||||
</Anchors>
|
|
||||||
</Button>
|
|
||||||
<Button name="$parent2" id="2" hidden="true" inherits="TI_PriorityList">
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent1">
|
|
||||||
<Offset>
|
|
||||||
<AbsDimension x="0" y="0" />
|
|
||||||
</Offset>
|
|
||||||
</Anchor>
|
|
||||||
</Anchors>
|
|
||||||
</Button>
|
|
||||||
<Button name="$parent3" id="3" hidden="true" inherits="TI_PriorityList">
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent2">
|
|
||||||
<Offset>
|
|
||||||
<AbsDimension x="0" y="0" />
|
|
||||||
</Offset>
|
|
||||||
</Anchor>
|
|
||||||
</Anchors>
|
|
||||||
</Button>
|
|
||||||
<Button name="$parent4" id="4" hidden="true" inherits="TI_PriorityList">
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent3">
|
|
||||||
<Offset>
|
|
||||||
<AbsDimension x="0" y="0" />
|
|
||||||
</Offset>
|
|
||||||
</Anchor>
|
|
||||||
</Anchors>
|
|
||||||
</Button>
|
|
||||||
<Button name="$parent5" id="5" hidden="true" inherits="TI_PriorityList">
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent4">
|
|
||||||
<Offset>
|
|
||||||
<AbsDimension x="0" y="0" />
|
|
||||||
</Offset>
|
|
||||||
</Anchor>
|
|
||||||
</Anchors>
|
|
||||||
</Button>
|
|
||||||
<Button name="$parent6" id="6" hidden="true" inherits="TI_PriorityList">
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent5">
|
|
||||||
<Offset>
|
|
||||||
<AbsDimension x="0" y="0" />
|
|
||||||
</Offset>
|
|
||||||
</Anchor>
|
|
||||||
</Anchors>
|
|
||||||
</Button>
|
|
||||||
<Button name="$parent7" id="7" hidden="true" inherits="TI_PriorityList">
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent6">
|
|
||||||
<Offset>
|
|
||||||
<AbsDimension x="0" y="0" />
|
|
||||||
</Offset>
|
|
||||||
</Anchor>
|
|
||||||
</Anchors>
|
|
||||||
</Button>
|
|
||||||
<Button name="$parent8" id="8" hidden="true" inherits="TI_PriorityList">
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent7">
|
|
||||||
<Offset>
|
|
||||||
<AbsDimension x="0" y="0" />
|
|
||||||
</Offset>
|
|
||||||
</Anchor>
|
|
||||||
</Anchors>
|
|
||||||
</Button>
|
|
||||||
<Button name="$parent9" id="9" hidden="true" inherits="TI_PriorityList">
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent8">
|
|
||||||
<Offset>
|
|
||||||
<AbsDimension x="0" y="0" />
|
|
||||||
</Offset>
|
|
||||||
</Anchor>
|
|
||||||
</Anchors>
|
|
||||||
</Button>
|
|
||||||
<Button name="$parent10" id="10" hidden="true" inherits="TI_PriorityList">
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent9">
|
|
||||||
<Offset>
|
|
||||||
<AbsDimension x="0" y="0" />
|
|
||||||
</Offset>
|
|
||||||
</Anchor>
|
|
||||||
</Anchors>
|
|
||||||
</Button>
|
|
||||||
<Button name="$parent11" id="11" hidden="true" inherits="TI_PriorityList">
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent10">
|
|
||||||
<Offset>
|
|
||||||
<AbsDimension x="0" y="0" />
|
|
||||||
</Offset>
|
|
||||||
</Anchor>
|
|
||||||
</Anchors>
|
|
||||||
</Button>
|
|
||||||
<Button name="$parent12" id="12" hidden="true" inherits="TI_PriorityList">
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent11">
|
|
||||||
<Offset>
|
|
||||||
<AbsDimension x="0" y="0" />
|
|
||||||
</Offset>
|
|
||||||
</Anchor>
|
|
||||||
</Anchors>
|
|
||||||
</Button>
|
|
||||||
<Button name="$parent13" id="13" hidden="true" inherits="TI_PriorityList">
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent12">
|
|
||||||
<Offset>
|
|
||||||
<AbsDimension x="0" y="0" />
|
|
||||||
</Offset>
|
|
||||||
</Anchor>
|
|
||||||
</Anchors>
|
|
||||||
</Button>
|
|
||||||
<Button name="$parent14" id="14" hidden="true" inherits="TI_PriorityList">
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent13">
|
|
||||||
<Offset>
|
|
||||||
<AbsDimension x="0" y="0" />
|
|
||||||
</Offset>
|
|
||||||
</Anchor>
|
|
||||||
</Anchors>
|
|
||||||
</Button>
|
|
||||||
<Button name="$parent15" id="15" hidden="true" inherits="TI_PriorityList">
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent14">
|
|
||||||
<Offset>
|
|
||||||
<AbsDimension x="0" y="0" />
|
|
||||||
</Offset>
|
|
||||||
</Anchor>
|
|
||||||
</Anchors>
|
|
||||||
</Button>
|
|
||||||
<Button name="$parent16" id="16" hidden="true" inherits="TI_PriorityList">
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent15">
|
|
||||||
<Offset>
|
|
||||||
<AbsDimension x="0" y="0" />
|
|
||||||
</Offset>
|
|
||||||
</Anchor>
|
|
||||||
</Anchors>
|
|
||||||
</Button>
|
|
||||||
</Frames>
|
|
||||||
</Frame>
|
</Frame>
|
||||||
</ScrollChild>
|
</ScrollChild>
|
||||||
</ScrollFrame>
|
</ScrollFrame>
|
||||||
|
|||||||
80
TurnInUI.lua
80
TurnInUI.lua
@ -1,3 +1,30 @@
|
|||||||
|
local TI_OptionsPriorityFramePool = {};
|
||||||
|
local TI_OptionsPriorityFramePoolMax = 0;
|
||||||
|
|
||||||
|
local function TI_GetOptionsPriorityFrame(idx)
|
||||||
|
if idx > TI_OptionsPriorityFramePoolMax then
|
||||||
|
for i=TI_OptionsPriorityFramePoolMax+1, idx, 1 do
|
||||||
|
local frame = CreateFrame("Button", "TI_OptionsPriority"..i,
|
||||||
|
getglobal("TI_OptionsPriority"), "TI_PriorityList", i);
|
||||||
|
if i == 1 then
|
||||||
|
frame:SetPoint("TOPLEFT", 0, 0);
|
||||||
|
else
|
||||||
|
frame:SetPoint("TOPLEFT", "TI_OptionsPriority"..i-1, "BOTTOMLEFT", 0, 0);
|
||||||
|
end
|
||||||
|
frame:Hide();
|
||||||
|
table.insert(TI_OptionsPriorityFramePool, i, frame);
|
||||||
|
TI_OptionsPriorityFramePoolMax = TI_OptionsPriorityFramePoolMax + 1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return TI_OptionsPriorityFramePool[idx];
|
||||||
|
end
|
||||||
|
|
||||||
|
local function TI_HideUnusedOptionFrames(last)
|
||||||
|
for i=last, TI_OptionsPriorityFramePoolMax, 1 do
|
||||||
|
TI_OptionsPriorityFramePool[i]:Hide();
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function TI_PopulateOptions(arg)
|
function TI_PopulateOptions(arg)
|
||||||
TI_debug(arg);
|
TI_debug(arg);
|
||||||
local CurrOpts;
|
local CurrOpts;
|
||||||
@ -10,9 +37,9 @@ function TI_PopulateOptions(arg)
|
|||||||
end
|
end
|
||||||
|
|
||||||
for i,v in ipairs(CurrOpts) do
|
for i,v in ipairs(CurrOpts) do
|
||||||
local entry = "TI_OptionsPriority" .. i;
|
local entrybutton = TI_GetOptionsPriorityFrame(i);
|
||||||
local entrybutton = getglobal(entry);
|
local icon, entrytext = entrybutton:GetRegions();
|
||||||
local entrytext = getglobal("TI_OptionsPriority"..i.."_Text");
|
local checkbox = entrybutton:GetChildren();
|
||||||
local iconpath;
|
local iconpath;
|
||||||
if(v.name == nil) then TI_debug("oh noes") end;
|
if(v.name == nil) then TI_debug("oh noes") end;
|
||||||
entrytext:SetText(v.name);
|
entrytext:SetText(v.name);
|
||||||
@ -35,16 +62,15 @@ function TI_PopulateOptions(arg)
|
|||||||
iconpath = "Interface/GossipFrame/" .. v.type .. "GossipIcon";
|
iconpath = "Interface/GossipFrame/" .. v.type .. "GossipIcon";
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
getglobal(entry .. "_Icon"):SetTexture(iconpath);
|
icon:SetTexture(iconpath);
|
||||||
getglobal(entry .. "_Check"):SetChecked(v.state);
|
checkbox:SetChecked(v.state);
|
||||||
entrytext:SetWidth(156); --make sure to change this if you change the anchors in the XML
|
entrytext:SetWidth(156); --make sure to change this if you change the anchors in the XML
|
||||||
entrybutton:SetHeight( entrytext:GetHeight() + 6);
|
entrybutton:SetHeight( entrytext:GetHeight() + 6);
|
||||||
entrybutton:Show();
|
entrybutton:Show();
|
||||||
last = last+1;
|
last = last+1;
|
||||||
end
|
end
|
||||||
for j=last, 16, 1 do
|
TI_HideUnusedOptionFrames(last);
|
||||||
getglobal("TI_OptionsPriority" .. j):Hide();
|
|
||||||
end
|
|
||||||
TI_OptionsPriorityScrollFrame:SetVerticalScroll(0);
|
TI_OptionsPriorityScrollFrame:SetVerticalScroll(0);
|
||||||
TI_OptionsPriorityScrollFrame:UpdateScrollChildRect();
|
TI_OptionsPriorityScrollFrame:UpdateScrollChildRect();
|
||||||
TI_StatusIndicatorUpdate();
|
TI_StatusIndicatorUpdate();
|
||||||
@ -53,31 +79,6 @@ function TI_PopulateOptions(arg)
|
|||||||
TI_SettingCheckboxUpdate();
|
TI_SettingCheckboxUpdate();
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
|
||||||
function TI_PopulateOptions(arg)
|
|
||||||
TI_debug(arg);
|
|
||||||
if(TI_status and TI_status.options) then
|
|
||||||
for i,v in ipairs(TI_status.options) do
|
|
||||||
local entry = "TI_OptionsPriority" .. i;
|
|
||||||
local iconpath;
|
|
||||||
if(v.name == nil) then TI_debug("oh noes") end;
|
|
||||||
if(getglobal(entry .. "_Text") == nil) then TI_debug("wtf "..entry .. "_Text") end;
|
|
||||||
getglobal(entry .. "_Text"):SetText(v.name);
|
|
||||||
if(v.type == "activequest") then
|
|
||||||
iconpath = "Interface\\GossipFrame\\ActiveQuestIcon";
|
|
||||||
elseif(v.type == "availquest") then
|
|
||||||
iconpath = "Interface\\GossipFrame\\AvailableQuestIcon";
|
|
||||||
else
|
|
||||||
iconpath = "Interface\\GossipFrame\\" .. v.type .. "GossipIcon";
|
|
||||||
end
|
|
||||||
getglobal(entry .. "_Icon"):SetTexture(iconpath);
|
|
||||||
getglobal(entry .. "_Check"):SetChecked(v.state);
|
|
||||||
getglobal(entry):Show();
|
|
||||||
end
|
|
||||||
end
|
|
||||||
TI_NPCListScrollBarUpdate();
|
|
||||||
end
|
|
||||||
]]--
|
|
||||||
|
|
||||||
function TI_NPCListScrollBarUpdate()
|
function TI_NPCListScrollBarUpdate()
|
||||||
if(TI_NPCIndex) then
|
if(TI_NPCIndex) then
|
||||||
@ -89,19 +90,6 @@ function TI_NPCListScrollBarUpdate()
|
|||||||
local offset = FauxScrollFrame_GetOffset(TI_NPCListScrollFrame);
|
local offset = FauxScrollFrame_GetOffset(TI_NPCListScrollFrame);
|
||||||
local i=1;
|
local i=1;
|
||||||
local j=1;
|
local j=1;
|
||||||
--~ for k, v in pairs(TI_NPCDB) do
|
|
||||||
--~ if(offset <= i and i < offset+8) then
|
|
||||||
--~ if(i <= table.getn(TI_NPCDB)) then
|
|
||||||
--~ getglobal("TI_OptionsNPCContainer"..j.."_Text"):SetText(k);
|
|
||||||
--~ getglobal("TI_OptionsNPCContainer"..j.."_Check"):SetChecked(v.state);
|
|
||||||
--~ getglobal("TI_OptionsNPCContainer"..j):Show();
|
|
||||||
--~ else
|
|
||||||
--~ getglobal("TI_OptionsNPCContainer"..j):Hide();
|
|
||||||
--~ end
|
|
||||||
--~ j = j + 1;
|
|
||||||
--~ end
|
|
||||||
--~ i = i + 1;
|
|
||||||
--~ end
|
|
||||||
|
|
||||||
for line=1,8 do
|
for line=1,8 do
|
||||||
lineplusoffset = line + FauxScrollFrame_GetOffset(TI_NPCListScrollFrame);
|
lineplusoffset = line + FauxScrollFrame_GetOffset(TI_NPCListScrollFrame);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user