📄 tipbuddy_optionsframe.lua
字号:
function TipBuddy_TipStyleDropDown_OnLoad( type )
this.type = type;
if (not TipBuddy_SavedVars[this.type].off) then
TipBuddy_SavedVars[this.type].off = 0;
end
TB_AddMessage( this.type.." : "..TipBuddy_SavedVars[this.type].off );
--TB_AddMessage( this.type );
UIDropDownMenu_Initialize(this, TipBuddy_TipStyleDropDown_Initialize, nil, this.type );
UIDropDownMenu_SetSelectedValue(this, TipBuddy_SavedVars[this.type].off);
UIDropDownMenu_SetWidth(120, TipBuddy_TipStyleDropDown);
TipBuddy_TipStyleDropDown_SetFrameVisibility(this, TipBuddy_SavedVars[this.type].off);
--/script DEFAULT_CHAT_FRAME:AddMessage(UIDropDownMenu_GetSelectedValue(TB_NPCNeutral_TipStyleDropDown));
end
function TipBuddy_TipStyleDropDown_OnClick()
TB_AddMessage( this.owner:GetName() );
UIDropDownMenu_SetSelectedValue(this.owner, this.value);
TipBuddy_SavedVars[this.owner.type].off = UIDropDownMenu_GetSelectedValue(this.owner);
TipBuddy_TipStyleDropDown_SetFrameVisibility(this.owner, this.value)
end
function TB_TipStyle_OptionsToggleFrames( value, type, colornum )
if (value == 0) then
getglobal("TipBuddy_OptionsFrame_"..type.."_Options_Checks"):Show();
getglobal("TipBuddy_OptionsFrame_"..type.."_Options_EB"):Hide();
getglobal("TB_"..type.."_BDBColorDropDown"):Show();
TipBuddy_BDBColorDropDown_SetFrameVisibility(getglobal("TB_"..type.."_BDBColorDropDown"), UIDropDownMenu_GetSelectedValue(getglobal("TB_"..type.."_BDBColorDropDown")));
elseif (value == 1) then
getglobal("TipBuddy_OptionsFrame_"..type.."_Options_Checks"):Show();
getglobal("TipBuddy_OptionsFrame_"..type.."_Options_EB"):Hide();
getglobal("TB_"..type.."_BDBColorDropDown"):Hide();
getglobal("TipBuddy_OptionsFrame_ColorPicker"..colornum):Hide();
getglobal("TipBuddy_OptionsFrame_"..type.."_Options"):SetBackdropBorderColor(0, 0, 0, 1);
else
getglobal("TipBuddy_OptionsFrame_"..type.."_Options_Checks"):Hide();
getglobal("TipBuddy_OptionsFrame_"..type.."_Options_EB"):Show();
getglobal("TB_"..type.."_BDBColorDropDown"):Show();
TipBuddy_BDBColorDropDown_SetFrameVisibility(getglobal("TB_"..type.."_BDBColorDropDown"), UIDropDownMenu_GetSelectedValue(getglobal("TB_"..type.."_BDBColorDropDown")));
end
end
function TipBuddy_TipStyleDropDown_SetFrameVisibility(frame, value)
if (frame.type == "pc_friend") then
TB_TipStyle_OptionsToggleFrames( value, "PCFriend", 11 );
elseif (frame.type == "pc_party") then
TB_TipStyle_OptionsToggleFrames( value, "PCParty", 12 );
elseif (frame.type == "pc_enemy") then
TB_TipStyle_OptionsToggleFrames( value, "PCEnemy", 13 );
elseif (frame.type == "npc_friend") then
TB_TipStyle_OptionsToggleFrames( value, "NPCFriend", 14 );
elseif (frame.type == "npc_neutral") then
TB_TipStyle_OptionsToggleFrames( value, "NPCNeutral", 15 );
elseif (frame.type == "npc_enemy") then
TB_TipStyle_OptionsToggleFrames( value, "NPCEnemy", 16 );
elseif (frame.type == "pet_friend") then
TB_TipStyle_OptionsToggleFrames( value, "PETFriend", 17 );
elseif (frame.type == "pet_enemy") then
TB_TipStyle_OptionsToggleFrames( value, "PETEnemy", 18 );
elseif (frame.type == "corpse") then
TB_TipStyle_OptionsToggleFrames( value, "CORPSE", 20 );
else
end
end
function TipBuddy_TipStyleDropDown_Initialize()
local selectedValue = UIDropDownMenu_GetSelectedValue(this);
local info;
info = {};
info.text = TipBuddy_TipStyle[1];
info.func = TipBuddy_TipStyleDropDown_OnClick;
info.value = 0;
info.owner = this:GetParent();
if ( info.value == selectedValue ) then
info.checked = 1;
end
info.tooltipTitle = "在暴雪自身信息框的基礎上增強";
UIDropDownMenu_AddButton(info);
info = {};
info.text = TipBuddy_TipStyle[2];
info.func = TipBuddy_TipStyleDropDown_OnClick;
info.value = 1;
info.owner = this:GetParent();
if ( info.value == selectedValue ) then
info.checked = 1;
end
info.tooltipTitle = "簡潔小巧的樣式";
UIDropDownMenu_AddButton(info);
info = {};
info.text = TipBuddy_TipStyle[3];
info.func = TipBuddy_TipStyleDropDown_OnClick;
info.value = 2;
info.owner = this:GetParent();
if ( info.value == selectedValue ) then
info.checked = 1;
end
info.tooltipTitle = "僅供高級用戶使用";
UIDropDownMenu_AddButton(info);
end
--Tooltip Backdrop Colors
TipBuddy_BDColor = {
[1] = "自定義",
[2] = "難易度",
[3] = "好感度",
};
function TipBuddy_BDColorDropDown_OnLoad( type )
this.type = type;
if (not TipBuddy_SavedVars[type].c_bdp) then
TipBuddy_SavedVars[type].c_bdp = 0;
end
TB_AddMessage( this.type.." : "..TipBuddy_SavedVars[this.type].c_bdp );
--TB_AddMessage( this.type );
UIDropDownMenu_Initialize(this, TipBuddy_BDColorDropDown_Initialize, nil, this.type );
UIDropDownMenu_SetSelectedValue(this, TipBuddy_SavedVars[this.type].c_bdp);
UIDropDownMenu_SetWidth(110, TipBuddy_BDColorDropDown);
TipBuddy_BDColorDropDown_SetFrameVisibility(this, TipBuddy_SavedVars[this.type].c_bdp)
end
function TipBuddy_BDColorDropDown_OnClick()
TB_AddMessage( this.owner:GetName().." : "..this.owner.type.." : "..this.value );
UIDropDownMenu_SetSelectedValue(this.owner, this.value);
TipBuddy_SavedVars[this.owner.type].c_bdp = this.value;
TipBuddy_BDColorDropDown_SetFrameVisibility(this.owner, this.value)
end
function TipBuddy_BDColorDropDown_SetFrameVisibility(frame, value)
local button;
if (value == 0) then
if (frame.type == "pc_friend") then
button = TipBuddy_OptionsFrame_ColorPicker1;
elseif (frame.type == "pc_party") then
button = TipBuddy_OptionsFrame_ColorPicker2;
elseif (frame.type == "pc_enemy") then
button = TipBuddy_OptionsFrame_ColorPicker3;
elseif (frame.type == "npc_friend") then
button = TipBuddy_OptionsFrame_ColorPicker4;
elseif (frame.type == "npc_neutral") then
button = TipBuddy_OptionsFrame_ColorPicker5;
elseif (frame.type == "npc_enemy") then
button = TipBuddy_OptionsFrame_ColorPicker6;
elseif (frame.type == "pet_friend") then
button = TipBuddy_OptionsFrame_ColorPicker7;
elseif (frame.type == "pet_enemy") then
button = TipBuddy_OptionsFrame_ColorPicker8;
elseif (frame.type == "corpse") then
button = TipBuddy_OptionsFrame_ColorPicker10;
else
return;
end
button:Show();
local targettype = TipBuddy_SavedVars[frame.type]["bgcolor"];
if (not targettype) then
TipBuddy_SavedVars[value.type]["bgcolor"] = { ["r"] = 0.8, ["g"] = 0.8, ["b"] = 0.9, ["a"] = 1, };
targettype = TipBuddy_SavedVars[frame.type]["bgcolor"];
end
button:GetParent():SetBackdropColor(targettype.r, targettype.g, targettype.b, TB_NoNegative(targettype.a-0.2));
--button:GetParent():SetBackdropBorderColor(targettype.r, targettype.g, targettype.b, TB_NoNegative(targettype.a-0.2));
else
if (frame.type == "pc_friend") then
button = TipBuddy_OptionsFrame_ColorPicker1;
elseif (frame.type == "pc_party") then
button = TipBuddy_OptionsFrame_ColorPicker2;
elseif (frame.type == "pc_enemy") then
button = TipBuddy_OptionsFrame_ColorPicker3;
elseif (frame.type == "npc_friend") then
button = TipBuddy_OptionsFrame_ColorPicker4;
elseif (frame.type == "npc_neutral") then
button = TipBuddy_OptionsFrame_ColorPicker5;
elseif (frame.type == "npc_enemy") then
button = TipBuddy_OptionsFrame_ColorPicker6;
elseif (frame.type == "pet_friend") then
button = TipBuddy_OptionsFrame_ColorPicker7;
elseif (frame.type == "pet_enemy") then
button = TipBuddy_OptionsFrame_ColorPicker8;
elseif (frame.type == "corpse") then
button = TipBuddy_OptionsFrame_ColorPicker10;
else
return;
end
button:Hide();
button:GetParent():SetBackdropColor(0.2, 0.2, 0.2, 1);
--button:GetParent():SetBackdropBorderColor(0.8, 0.8, 0.9, 1);
end
end
function TipBuddy_BDColorDropDown_Initialize()
local selectedValue = UIDropDownMenu_GetSelectedValue(this);
local info;
info = {};
info.text = TipBuddy_BDColor[1];
info.func = TipBuddy_BDColorDropDown_OnClick;
info.value = 0;
info.owner = this:GetParent();
if ( info.value == selectedValue ) then
info.checked = 1;
end
info.tooltipTitle = "Choose your custom color by\nclicking the box to the right.";
UIDropDownMenu_AddButton(info);
info = {};
info.text = TipBuddy_BDColor[2];
info.func = TipBuddy_BDColorDropDown_OnClick;
info.value = 1;
info.owner = this:GetParent();
if ( info.value == selectedValue ) then
info.checked = 1;
end
info.tooltipTitle = "Color will be determined\nby the unit's difficulty\n(red, yellow, grey, etc).";
UIDropDownMenu_AddButton(info);
info = {};
info.text = TipBuddy_BDColor[3];
info.func = TipBuddy_BDColorDropDown_OnClick;
info.value = 2;
info.owner = this:GetParent();
if ( info.value == selectedValue ) then
info.checked = 1;
end
info.tooltipTitle = "Color is determined by th\n unit's reaction towards you.";
UIDropDownMenu_AddButton(info);
end
--Tooltip Backdrop BORDER Colors
TipBuddy_BDBColor = {
[1] = "自定義",
[2] = "難易度",
[3] = "好感度",
};
function TipBuddy_BDBColorDropDown_OnLoad( type )
this.type = type;
if (not TipBuddy_SavedVars[this.type].c_bdb) then
TipBuddy_SavedVars[this.type].c_bdb = 0;
end
TB_AddMessage( this.type.." : "..TipBuddy_SavedVars[this.type].c_bdb );
--TB_AddMessage( this.type );
UIDropDownMenu_Initialize(this, TipBuddy_BDBColorDropDown_Initialize, nil, this.type );
UIDropDownMenu_SetSelectedValue(this, TipBuddy_SavedVars[this.type].c_bdb);
UIDropDownMenu_SetWidth(110, TipBuddy_BDBColorDropDown);
TipBuddy_BDBColorDropDown_SetFrameVisibility(this, TipBuddy_SavedVars[this.type].c_bdb)
end
function TipBuddy_BDBColorDropDown_OnClick()
TB_AddMessage( this.owner:GetName() );
UIDropDownMenu_SetSelectedValue(this.owner, this.value);
TipBuddy_SavedVars[this.owner.type].c_bdb = this.value;
TipBuddy_BDBColorDropDown_SetFrameVisibility(this.owner, this.value)
end
function TipBuddy_BDBColorDropDown_SetFrameVisibility(frame, value)
local button;
if (value == 0) then
if (frame.type == "pc_friend") then
button = TipBuddy_OptionsFrame_ColorPicker11;
elseif (frame.type == "pc_party") then
button = TipBuddy_OptionsFrame_ColorPicker12;
elseif (frame.type == "pc_enemy") then
button = TipBuddy_OptionsFrame_ColorPicker13;
elseif (frame.type == "npc_friend") then
button = TipBuddy_OptionsFrame_ColorPicker14;
elseif (frame.type == "npc_neutral") then
button = TipBuddy_OptionsFrame_ColorPicker15;
elseif (frame.type == "npc_enemy") then
button = TipBuddy_OptionsFrame_ColorPicker16;
elseif (frame.type == "pet_friend") then
button = TipBuddy_OptionsFrame_ColorPicker17;
elseif (frame.type == "pet_enemy") then
button = TipBuddy_OptionsFrame_ColorPicker18;
elseif (frame.type == "corpse") then
button = TipBuddy_OptionsFrame_ColorPicker20;
else
end
button:Show();
local targettype = TipBuddy_SavedVars[frame.type]["bgbcolor"];
if (not targettype) then
TipBuddy_SavedVars[value.type]["bgbcolor"] = { ["r"] = 0.8, ["g"] = 0.8, ["b"] = 0.9, ["a"] = 1, };
targettype = TipBuddy_SavedVars[frame.type]["bgbcolor"];
end
button:GetParent():SetBackdropBorderColor(targettype.r, targettype.g, targettype.b, TB_NoNegative(targettype.a-0.2));
else
if (frame.type == "pc_friend") then
button = TipBuddy_OptionsFrame_ColorPicker11;
elseif (frame.type == "pc_party") then
button = TipBuddy_OptionsFrame_ColorPicker12;
elseif (frame.type == "pc_enemy") then
button = TipBuddy_OptionsFrame_ColorPicker13;
elseif (frame.type == "npc_friend") then
button = TipBuddy_OptionsFrame_ColorPicker14;
elseif (frame.type == "npc_neutral") then
button = TipBuddy_OptionsFrame_ColorPicker15;
elseif (frame.type == "npc_enemy") then
button = TipBuddy_OptionsFrame_ColorPicker16;
elseif (frame.type == "pet_friend") then
button = TipBuddy_OptionsFrame_ColorPicker17;
elseif (frame.type == "pet_enemy") then
button = TipBuddy_OptionsFrame_ColorPicker18;
elseif (frame.type == "corpse") then
button = TipBuddy_OptionsFrame_ColorPicker20;
else
end
button:Hide();
button:GetParent():SetBackdropBorderColor(0.8, 0.8, 0.9, 1);
end
end
function TipBuddy_BDBColorDropDown_Initialize()
local selectedValue = UIDropDownMenu_GetSelectedValue(this);
local info;
info = {};
info.text = TipBuddy_BDBColor[1];
info.func = TipBuddy_BDBColorDropDown_OnClick;
info.value = 0;
info.owner = this:GetParent();
if ( info.value == selectedValue ) then
info.checked = 1;
end
info.tooltipTitle = "Choose your custom color by\nclicking the box to the right.";
UIDropDownMenu_AddButton(info);
info = {};
info.text = TipBuddy_BDBColor[2];
info.func = TipBuddy_BDBColorDropDown_OnClick;
info.value = 1;
info.owner = this:GetParent();
if ( info.value == selectedValue ) then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -