📄 options.lua
字号:
--The Options Page variables and functions
--Set color functions
local DSCTOptionsFrame_SetColorFunc = {
["SHOWHIT"] = function(x) DSCTOptionsFrame_SetColor("SHOWHIT") end,
["SHOWMISS"] = function(x) DSCTOptionsFrame_SetColor("SHOWMISS") end,
["SHOWDODGE"] = function(x) DSCTOptionsFrame_SetColor("SHOWDODGE") end,
["SHOWPARRY"] = function(x) DSCTOptionsFrame_SetColor("SHOWPARRY") end,
["SHOWBLOCK"] = function(x) DSCTOptionsFrame_SetColor("SHOWBLOCK") end,
["SHOWRESIST"] = function(x) DSCTOptionsFrame_SetColor("SHOWRESIST") end,
["SHOWABSORB"] = function(x) DSCTOptionsFrame_SetColor("SHOWABSORB") end,
["SHOWCOMBATIN"] = function(x) DSCTOptionsFrame_SetColor("SHOWCOMBATIN") end,
["SHOWCOMBATOUT"] = function(x) DSCTOptionsFrame_SetColor("SHOWCOMBATOUT") end,
["SHOWSPELLCRIT"] = function(x) DSCTOptionsFrame_SetColor("SHOWSPELLCRIT") end,
["SHOWDMGCRIT"] = function(x) DSCTOptionsFrame_SetColor("SHOWDMGCRIT") end,
["SHOWLOWHP"] = function(x) DSCTOptionsFrame_SetColor("SHOWLOWHP") end,
["SHOWLOWMANA"] = function(x) DSCTOptionsFrame_SetColor("SHOWLOWMANA") end,
["SHOWSPELL"] = function(x) DSCTOptionsFrame_SetColor("SHOWSPELL") end,
["SHOWHEAL"] = function(x) DSCTOptionsFrame_SetColor("SHOWHEAL") end,
["SHOWDEBUFF"] = function(x) DSCTOptionsFrame_SetColor("SHOWDEBUFF") end,
["SHOWBUFF"] = function(x) DSCTOptionsFrame_SetColor("SHOWBUFF") end,
["SHOWFADE"] = function(x) DSCTOptionsFrame_SetColor("SHOWFADE") end,
["SHOWPOWER"] = function(x) DSCTOptionsFrame_SetColor("SHOWPOWER") end,
["SHOWCOMBOPOINTS"] = function(x) DSCTOptionsFrame_SetColor("SHOWCOMBOPOINTS") end,
["SHOWHONOR_DSCT"] = function(x) DSCTOptionsFrame_SetColor("SHOWHONOR_DSCT") end,
["SHOWEMOTE"] = function(x) DSCTOptionsFrame_SetColor("SHOWEMOTE") end,
["SHOWSPELLALERT"] = function(x) DSCTOptionsFrame_SetColor("SHOWSPELLALERT") end,
["SPELLALERT_MOB_COLOR"] = function(x) DSCTOptionsFrame_SetColor("SPELLALERT_MOB_COLOR") end,
["SPELLALERT_SPELL_COLOR"] = function(x) DSCTOptionsFrame_SetColor("SPELLALERT_SPELL_COLOR") end,
["SHOWYELL"] = function(x) DSCTOptionsFrame_SetColor("SHOWYELL") end,
["SHOWEXECUTE"] = function(x) DSCTOptionsFrame_SetColor("SHOWEXECUTE") end,
};
local DSCTOptionsFrame_CancelColorFunc = {
["SHOWHIT"] = function(x) DSCTOptionsFrame_CancelColor("SHOWHIT",x) end,
["SHOWMISS"] = function(x) DSCTOptionsFrame_CancelColor("SHOWMISS",x) end,
["SHOWDODGE"] = function(x) DSCTOptionsFrame_CancelColor("SHOWDODGE",x) end,
["SHOWPARRY"] = function(x) DSCTOptionsFrame_CancelColor("SHOWPARRY",x) end,
["SHOWBLOCK"] = function(x) DSCTOptionsFrame_CancelColor("SHOWBLOCK",x) end,
["SHOWRESIST"] = function(x) DSCTOptionsFrame_CancelColor("SHOWRESIST",x) end,
["SHOWABSORB"] = function(x) DSCTOptionsFrame_CancelColor("SHOWABSORB",x) end,
["SHOWCOMBATIN"] = function(x) DSCTOptionsFrame_CancelColor("SHOWCOMBATIN",x) end,
["SHOWCOMBATOUT"] = function(x) DSCTOptionsFrame_CancelColor("SHOWCOMBATOUT",x) end,
["SHOWSPELLCRIT"] = function(x) DSCTOptionsFrame_CancelColor("SHOWSPELLCRIT",x) end,
["SHOWDMGCRIT"] = function(x) DSCTOptionsFrame_CancelColor("SHOWDMGCRIT",x) end,
["SHOWLOWHP"] = function(x) DSCTOptionsFrame_CancelColor("SHOWLOWHP",x) end,
["SHOWLOWMANA"] = function(x) DSCTOptionsFrame_CancelColor("SHOWLOWMANA",x) end,
["SHOWSPELL"] = function(x) DSCTOptionsFrame_CancelColor("SHOWSPELL",x) end,
["SHOWHEAL"] = function(x) DSCTOptionsFrame_CancelColor("SHOWHEAL",x) end,
["SHOWDEBUFF"] = function(x) DSCTOptionsFrame_CancelColor("SHOWDEBUFF",x) end,
["SHOWBUFF"] = function(x) DSCTOptionsFrame_CancelColor("SHOWBUFF",x) end,
["SHOWFADE"] = function(x) DSCTOptionsFrame_CancelColor("SHOWFADE",x) end,
["SHOWPOWER"] = function(x) DSCTOptionsFrame_CancelColor("SHOWPOWER",x) end,
["SHOWCOMBOPOINTS"] = function(x) DSCTOptionsFrame_CancelColor("SHOWCOMBOPOINTS",x) end,
["SHOWHONOR_DSCT"] = function(x) DSCTOptionsFrame_CancelColor("SHOWHONOR_DSCT",x) end,
["SHOWEMOTE"] = function(x) DSCTOptionsFrame_CancelColor("SHOWEMOTE",x) end,
["SHOWSPELLALERT"] = function(x) DSCTOptionsFrame_CancelColor("SHOWSPELLALERT",x) end,
["SPELLALERT_MOB_COLOR"] = function(x) DSCTOptionsFrame_CancelColor("SPELLALERT_MOB_COLOR",x) end,
["SPELLALERT_SPELL_COLOR"] = function(x) DSCTOptionsFrame_CancelColor("SPELLALERT_SPELL_COLOR",x) end,
["SHOWYELL"] = function(x) DSCTOptionsFrame_CancelColor("SHOWYELL",x) end,
["SHOWEXECUTE"] = function(x) DSCTOptionsFrame_CancelColor("SHOWEXECUTE",x) end,
};
function DSCTOptions_HideAll()
DSCTOptions_HideEnevt();
DSCTOptions_HideMisc();
DSCTOptions_HideText();
DSCTOptions_HideMSGText();
DSCTOptions_HideWarning();
DSCTOptions_HideSpellAlert();
end
function DSCTOptions_HideEnevt()
local frame = getglobal("DSCTOptions_EventsFrame");
frame:Hide();
end
function DSCTOptions_ShowEnevt()
local frame = getglobal("DSCTOptions_EventsFrame");
frame:Show();
end
function DSCTOptions_HideMisc()
local frame = getglobal("DSCTOptions_MiscFrame");
frame:Hide();
end
function DSCTOptions_ShowMisc()
local frame = getglobal("DSCTOptions_MiscFrame");
frame:Show();
end
function DSCTOptions_HideText()
local frame = getglobal("DSCTOptions_TextFrame");
frame:Hide();
end
function DSCTOptions_ShowText()
local frame = getglobal("DSCTOptions_TextFrame");
frame:Show();
end
function DSCTOptions_HideMSGText()
local frame = getglobal("DSCTOptions_MSGTextFrame");
frame:Hide();
end
function DSCTOptions_ShowMSGText()
local frame = getglobal("DSCTOptions_MSGTextFrame");
frame:Show();
end
function DSCTOptions_HideWarning()
local frame = getglobal("DSCTOptions_WarningFrame");
frame:Hide();
end
function DSCTOptions_ShowWarning()
local frame = getglobal("DSCTOptions_WarningFrame");
frame:Show();
end
function DSCTOptions_HideSpellAlert()
local frame = getglobal("DSCTOptions_SpellAlertFrame");
if frame then frame:Hide();end
end
function DSCTOptions_ShowSpellAlert()
local frame = getglobal("DSCTOptions_SpellAlertFrame");
if frame then frame:Show();end
end
function DSCT_RefreshCheckButton(name)
local button = getglobal(name);
local str = getglobal(name.."Text");
local checked = nil;
--button.disabled = nil;
if ( DSCT_Get(name) == 1 ) then
checked = 1;
else
checked = 0;
end
OptionsFrame_EnableCheckBox(button);
button:SetChecked(checked);
str:SetText(DSCTOptionsFrameCheckButtons[name].title);
button.tooltipText = DSCTOptionsFrameCheckButtons[name].tooltipText;
end
function DSCT_ConfigColorPicker(name)
local frame,swatch,sRed,sGreen,sBlue,sColor;
frame = getglobal(name);
swatch = getglobal(name.."_ColorSwatchNormalTexture");
sColor = DSCT_nGetColor(name);
sRed = sColor.r;
sGreen = sColor.g;
sBlue = sColor.b;
frame.r = sRed;
frame.g = sGreen;
frame.b = sBlue;
frame.swatchFunc = DSCTOptionsFrame_SetColorFunc[name];
frame.cancelFunc = DSCTOptionsFrame_CancelColorFunc[name];
swatch:SetVertexColor(sRed,sGreen,sBlue);
end
function DSCT_RefreshColorPickerEx(name)
local str = getglobal(name.."_Text");
str:SetText(DSCTOptionsColorPickerEx[name].title);
DSCT_ConfigColorPicker(name);
end
function DSCT_RefreshEventFrames(name)
local button = getglobal(name.."_Button");
local text = getglobal(name.."_Text");
local val = DSCT_Get(name);
local ani = DSCT_Get("ANIMODE");
if val > 4 then val = 4;end
if val < 0 then val = 0;end
button.tooltipText = DSCTOptionsFrameEventFrames[name].tooltipText;
if DSCT_Get("ANIMODE") == 0 or DSCT_Get("ANIMODE") == 1 or DSCT_Get("ANIMODE") == 2 then
if val + 1 == 4 then
button:SetText(DSCT_EVENTTYPE[ani + 1][3]);
else
button:SetText(DSCT_EVENTTYPE[ani + 1][val + 1]);
end
else
button:SetText(DSCT_EVENTTYPE[ani + 1][val + 1]);
end
if val == 0 then text:SetTextColor(0.4,0.4,0.4);else text:SetTextColor(1.0,0.82,0);end
text:SetText(DSCTOptionsFrameEventFrames[name].title);
--Color Swatch
DSCT_ConfigColorPicker(name);
DSCT_InitCustomEvent();
end
function DSCT_RefreshFrameSliders(name)
local slider = getglobal(name);
local str = getglobal(name.."Text");
local low = getglobal(name.."Low");
local high = getglobal(name.."High");
local value = DSCTOptionsFrameSliders[name];
slider.titlebak = value.title;
slider:SetMinMaxValues(value.minValue, value.maxValue);
slider:SetValueStep(value.valueStep);
slider:SetValue( DSCT_Get(name) );
str:SetText(slider.titlebak);
low:SetText(value.minText);
high:SetText(value.maxText);
slider.tooltipText = value.tooltipText;
OptionsFrame_EnableSlider(slider);
DSCT_OptionsSliderRefreshTitle(name);
end
function DSCT_RefreshFrameList(name)
local obj = getglobal(name);
local tilename = getglobal(name.."_TileText");
local valname = getglobal(name.."_Text");
local p = DSCTOptionsFrameListFrames[name];
tilename:SetText(p.title);
obj.tooltipText = p.tooltipText;
for key, value in p.list do
if value.val == DSCT_Get(name) then
valname:SetText(value.name);
end
end
if name == "ANIMODE" then
local type = DSCT_Get("ANIMODE");
local pamamNum = 1;
local Yoffset = -80;
ANIMODE_Frame_Param1:Hide();
ANIMODE_Frame_Param2:Hide();
for key ,value in DSCTAniModeParamsSliders[type] do
local sliderName = "ANIMODE_Param"..pamamNum;
local frame = getglobal("ANIMODE_Frame_Param"..pamamNum);
local slider = getglobal(sliderName);
local str = getglobal(sliderName.."Text");
local low = getglobal(sliderName.."Low");
local high = getglobal(sliderName.."High");
slider.titlebak = value.title;
slider:SetMinMaxValues(0.2, 3);
slider:SetValueStep(0.1);
local paramList = DSCT_Get("ANIMODE_ParamList");
slider:SetValue( paramList[type][pamamNum] );
str:SetText(slider.titlebak);
low:SetText("20%");
high:SetText("300%");
slider.tooltipText = value.tooltipText;
slider:SetPoint("TOPLEFT", "DSCTOptions_TextFrame_BG2", "TOPLEFT", 15 ,Yoffset );
OptionsFrame_EnableSlider(slider);
DSCT_OptionsSliderRefreshTitle(sliderName);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -