📄 countdoomlayout.lua
字号:
CountDoomLayouts = {};
local CDL = {};
---------------------------------------
--
-- CountDoom's default text only layout
--
---------------------------------------
-- Common button attributes
CDL.button = {};
CDL.button.visible = true;
CDL.button.width = 30;
CDL.button.height = 15;
CDL.button.point = "TOPLEFT";
CDL.button.relativeObject = "previous";
CDL.button.relativePoint = "BOTTOMLEFT";
CDL.button.xoffset = 0;
CDL.button.yoffset = 0;
-- Overrides for specific buttons
CDL.button0 = {};
CDL.button0.relativeObject = "frame";
CDL.button0.relativePoint = "TOPLEFT";
CDL.button0.xoffset = 5;
CDL.button0.yoffset = -5;
-- Texture/Icon settings
CDL.texture = {};
CDL.texture.visible = false;
CDL.texture.width = 30;
CDL.texture.height = 15;
-- Text settings
CDL.text = {};
CDL.text.visible = true;
CDL.text.point = "LEFT";
CDL.text.relativeObject = "button";
CDL.text.relativePoint = "LEFT";
CDL.text.xoffset = 0;
CDL.text.yoffset = 0;
CDL.text.formatString = "$ti";
-- Frame settings
CDL.frame = {};
CDL.frame.visible = false;
CDL.frame.point = "TOP";
CDL.frame.relativeObject = "UIParent";
CDL.frame.relativePoint = nil;
CDL.frame.xoffset = 150;
CDL.frame.yoffset = -50;
CDL.frame.widthPerTimer = 0;
CDL.frame.widthBase = 5 + 5 + 250;
CDL.frame.heightPerTimer = 15;
CDL.frame.heightBase = 5 + 5;
-- Store this in our table
CountDoomLayouts.textonly = CDL;
CDL = {};
---------------------------------------
--
-- CountDoom's default horizontal layout
--
---------------------------------------
-- Common button attributes
CDL.button = {};
CDL.button.visible = true;
CDL.button.width = 30;
CDL.button.height = 30;
CDL.button.point = "TOPLEFT";
CDL.button.relativeObject = "previous";
CDL.button.relativePoint = "TOPRIGHT";
CDL.button.xoffset = 0;
CDL.button.yoffset = 0;
-- Overrides for specific buttons
CDL.button0 = {};
CDL.button0.relativeObject = "frame";
CDL.button0.relativePoint = "TOPLEFT";
CDL.button0.xoffset = 5;
CDL.button0.yoffset = -5;
-- Texture/Icon settings
CDL.texture = {};
CDL.texture.visible = true;
CDL.texture.width = 30;
CDL.texture.height = 30;
-- Text settings
CDL.text = {};
CDL.text.visible = true;
CDL.text.point = "LEFT";
CDL.text.relativeObject = "button";
CDL.text.relativePoint = "LEFT";
CDL.text.xoffset = 0;
CDL.text.yoffset = -(5 + (CDL.button.height/2));
CDL.text.formatString = "$ti";
-- Frame settings
CDL.frame = {};
CDL.frame.visible = false;
CDL.frame.point = "TOP";
CDL.frame.relativeObject = "UIParent";
CDL.frame.relativePoint = nil;
CDL.frame.xoffset = 150;
CDL.frame.yoffset = -50;
CDL.frame.widthPerTimer = CDL.button.width;
CDL.frame.widthBase = 5 + 5;
CDL.frame.heightPerTimer = 0;
CDL.frame.heightBase = 5 + 5 + CDL.button.height + 12;
-- Store this in our table
CountDoomLayouts.horizontal = CDL;
CDL = {};
---------------------------------------
--
-- CountDoom's default vertical layout
--
---------------------------------------
-- Common button attributes
CDL.button = {};
CDL.button.visible = true;
CDL.button.width = 30;
CDL.button.height = 30;
CDL.button.point = "TOPLEFT";
CDL.button.relativeObject = "previous";
CDL.button.relativePoint = "BOTTOMLEFT";
CDL.button.xoffset = 0;
CDL.button.yoffset = 0;
-- Overrides for specific buttons
CDL.button0 = {};
CDL.button0.relativeObject = "frame";
CDL.button0.relativePoint = "TOPLEFT";
CDL.button0.xoffset = 5;
CDL.button0.yoffset = -5;
-- Texture/Icon settingsCDL.
CDL.texture = {};
CDL.texture.visible = true;
CDL.texture.width = 30;
CDL.texture.height = 30;
-- Text settings
CDL.text = {};
CDL.text.visible = true;
CDL.text.point = "LEFT";
CDL.text.relativeObject = "button";
CDL.text.relativePoint = "LEFT";
CDL.text.xoffset = CDL.button.width + 10;
CDL.text.yoffset = -7;
CDL.text.formatString = "$ti";
-- Frame settings
CDL.frame = {};
CDL.frame.visible = false;
CDL.frame.point = "TOP";
CDL.frame.relativeObject = "UIParent";
CDL.frame.relativePoint = nil;
CDL.frame.xoffset = 150;
CDL.frame.yoffset = -50;
CDL.frame.widthPerTimer = 0;
CDL.frame.widthBase = 5 + 5 + CDL.button.width + 40;
CDL.frame.heightPerTimer = CDL.button.height;
CDL.frame.heightBase = 5 + 5;
-- Store this in our table
CountDoomLayouts.vertical = CDL;
CDL = {};
CountDoomLayout = {};
-- Function to set the parameters on a frame
CountDoomLayout.LoadFrameSettings = function( CDL )
local numTimers = CDTimer_maxButtons;
if numTimers == 0 then
numTimers = 1;
end
-- Set the frame parameters
local frame = CDL.frame;
if frame ~= nil then
local obj = CountDoomFrame;
--[[
-- The frame is enabled/disabled when timers are active or unlocked.
if frame.visible then
obj:Show();
else
obj:Hide();
end
--]]
---
--- Set width
---
local width = 0;
if frame.widthPerTimer ~= nil then
width = frame.widthPerTimer * numTimers;
end
if frame.widthBase ~= nil then
width = width + frame.widthBase;
end
if width ~= 0 then
obj:SetWidth( width );
end
---
--- Set height
---
local height = 0;
if frame.heightPerTimer ~= nil then
height = frame.heightPerTimer * numTimers;
end
if frame.heightBase ~= nil then
height = height + frame.heightBase;
end
if height ~= 0 then
obj:SetHeight( height );
end
--[[
CDL.frame = {};
CDL.frame.point = "TOP";
CDL.frame.relativeObject = "UIParent";
CDL.frame.relativePoint = nil;
CDL.frame.xoffset = 150;
CDL.frame.yoffset = -50;
--]]
end;
end;
CountDoomLayout.LoadButtonSettings = function( CDL )
local buttonID = 0;
local prevObj = nil;
if CDL.button == nil then
CountDoom.ChatPrint( "No button settings found." );
return;
end;
for buttonID = 0, CDTimer_maxButtons - 1 do
local obj = getglobal( "CDTimerButton" .. buttonID);
if obj ~= nil then
local overrideString = "button" .. buttonID;
local point = CDL.button.point;
if CDL[overrideString] ~= nil and
CDL[overrideString].point ~= nil then
point = CDL[overrideString].point;
end;
local relativeObjectString = CDL.button.relativeObject;
if CDL[overrideString] ~= nil and
CDL[overrideString].relativeObject ~= nil then
relativeObjectString = CDL[overrideString].relativeObject;
end;
local relativePoint = CDL.button.relativePoint;
if CDL[overrideString] ~= nil and
CDL[overrideString].relativePoint ~= nil then
relativePoint = CDL[overrideString].relativePoint;
end;
local xoffset = CDL.button.xoffset;
if CDL[overrideString] ~= nil and
CDL[overrideString].xoffset ~= nil then
xoffset = CDL[overrideString].xoffset;
end;
local yoffset = CDL.button.yoffset;
if CDL[overrideString] ~= nil and
CDL[overrideString].yoffset ~= nil then
yoffset = CDL[overrideString].yoffset;
end;
if relativeObjectString == "previous" then
relativeObject = prevObj;
elseif relativeObjectString == "frame" then
relativeObject = CountDoomFrame;
else
relativeObject = getglobal( relativeObjectString );
end;
if point ~= nil and
relativeObject ~= nil and
relativePoint ~= nil and
xoffset ~= nil and
yoffset ~= nil then
--
-- Set this button's anchor information
obj:ClearAllPoints();
obj:SetPoint(point, relativeObject, relativePoint, xoffset, yoffset);
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -