Explorar el Código

Dynamically generate Priority Frames, fixing 16 option limit

tags/2.3.2
SabinDeus hace 2 años
padre
commit
000e731fbc
Se han modificado 2 ficheros con 35 adiciones y 208 borrados
  1. 0
    161
      TurnIn.xml
  2. 35
    47
      TurnInUI.lua

+ 0
- 161
TurnIn.xml Ver fichero

@@ -684,167 +684,6 @@
<Size>
<AbsDimension x="200" y="30"/>
</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>
</ScrollChild>
</ScrollFrame>

+ 35
- 47
TurnInUI.lua Ver fichero

@@ -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)
TI_debug(arg);
local CurrOpts;
@@ -10,9 +37,9 @@ function TI_PopulateOptions(arg)
end
for i,v in ipairs(CurrOpts) do
local entry = "TI_OptionsPriority" .. i;
local entrybutton = getglobal(entry);
local entrytext = getglobal("TI_OptionsPriority"..i.."_Text");
local entrybutton = TI_GetOptionsPriorityFrame(i);
local icon, entrytext = entrybutton:GetRegions();
local checkbox = entrybutton:GetChildren();
local iconpath;
if(v.name == nil) then TI_debug("oh noes") end;
entrytext:SetText(v.name);
@@ -35,16 +62,15 @@ function TI_PopulateOptions(arg)
iconpath = "Interface/GossipFrame/" .. v.type .. "GossipIcon";
end
end
getglobal(entry .. "_Icon"):SetTexture(iconpath);
getglobal(entry .. "_Check"):SetChecked(v.state);
icon:SetTexture(iconpath);
checkbox:SetChecked(v.state);
entrytext:SetWidth(156); --make sure to change this if you change the anchors in the XML
entrybutton:SetHeight( entrytext:GetHeight() + 6);
entrybutton:Show();
last = last+1;
end
for j=last, 16, 1 do
getglobal("TI_OptionsPriority" .. j):Hide();
end
TI_HideUnusedOptionFrames(last);

TI_OptionsPriorityScrollFrame:SetVerticalScroll(0);
TI_OptionsPriorityScrollFrame:UpdateScrollChildRect();
TI_StatusIndicatorUpdate();
@@ -53,31 +79,6 @@ function TI_PopulateOptions(arg)
TI_SettingCheckboxUpdate();
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()
if(TI_NPCIndex) then
@@ -89,20 +90,7 @@ function TI_NPCListScrollBarUpdate()
local offset = FauxScrollFrame_GetOffset(TI_NPCListScrollFrame);
local i=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
lineplusoffset = line + FauxScrollFrame_GetOffset(TI_NPCListScrollFrame);
if(lineplusoffset <= table.getn(TI_NPCIndex)) then

Cargando…
Cancelar
Guardar