📄 alphamaptitantrans.lua
字号:
TITAN_ALPHAMAP_TRANS_ID = "AlphaMapTrans";
TITAN_ALPHAMAP_TRANS_FRAME_SHOW_TIME = 0.5;
TITAN_ALPHAMAP_TRANS_CONTROL_HIGH = "100%";
TITAN_ALPHAMAP_TRANS_CONTROL_LOW = "0%";
function AlphaMapTPTransButton_OnLoad()
this.registry = {
id = TITAN_ALPHAMAP_TRANS_ID,
menuText = TITAN_ALPHAMAP_TRANS_MENU_TEXT,
tooltipTitle = TITAN_ALPHAMAP_TRANS_TOOLTIP,
tooltipTextFunction = "AlphaMapTPTransButton_GetTooltipText",
icon = "Interface\\Icons\\INV_Misc_Map_01",
category = "Interface",
};
AlphaMap_Alpha_Set(0, AlphaMapConfig.alpha);
table.insert(TITAN_PANEL_INITIAL_PLUGINS,TITAN_ALPHAMAP_TRANS_ID);
end
function AlphaMapTPTransButton_GetTooltipText()
local transText = AlphaMapTPTrans_GetAlphaText(AlphaMapConfig.alpha);
return ""..
TITAN_ALPHAMAP_TRANS_TOOLTIP_VALUE.."\t"..TitanUtils_GetHighlightText(transText).."\n"..
TitanUtils_GetGreenText(TITAN_ALPHAMAP_TRANS_TOOLTIP_HINT1);
end
function AlphaMapTPTransControlSlider_OnEnter()
this.tooltipText = TitanOptionSlider_TooltipText(TITAN_ALPHAMAP_TRANS_CONTROL_TOOLTIP, AlphaMapTPTrans_GetAlphaText(AlphaMapConfig.alpha));
GameTooltip:SetOwner(this, "ANCHOR_BOTTOMLEFT");
GameTooltip:SetText(this.tooltipText, nil, nil, nil, nil, 1);
TitanUtils_StopFrameCounting(this:GetParent());
end
function AlphaMapTPTransControlSlider_OnLeave()
this.tooltipText = nil;
GameTooltip:Hide();
TitanUtils_StartFrameCounting(this:GetParent(), TITAN_ALPHAMAP_TRANS_FRAME_SHOW_TIME);
end
function AlphaMapTPTransControlSlider_OnShow()
getglobal(this:GetName().."Text"):SetText(AlphaMapTPTrans_GetAlphaText(AlphaMapConfig.alpha));
getglobal(this:GetName().."High"):SetText(TITAN_ALPHAMAP_TRANS_CONTROL_LOW);
getglobal(this:GetName().."Low"):SetText(TITAN_ALPHAMAP_TRANS_CONTROL_HIGH);
this:SetMinMaxValues(0, 1);
this:SetValueStep(0.01);
this:SetValue(1 - AlphaMapConfig.alpha);
this.previousValue = this:GetValue();
end
function AlphaMapTPTransControlSlider_OnValueChanged()
if (this:GetValue() ~= this.previousValue) then
this.previousValue = this:GetValue();
getglobal(this:GetName().."Text"):SetText(AlphaMapTPTrans_GetAlphaText(1 - this:GetValue()));
local slider = 0;
if (AlphaMapConfig.slider) then
slider = 1;
end
AlphaMap_Alpha_Set(slider,1 - this:GetValue());
-- Update GameTooltip
if (this.tooltipText) then
this.tooltipText = TitanOptionSlider_TooltipText(TITAN_ALPHAMAP_TRANS_CONTROL_TOOLTIP, AlphaMapTPTrans_GetAlphaText(1 - this:GetValue()));
GameTooltip:SetText(this.tooltipText, nil, nil, nil, nil, 1);
end
end
end
function AlphaMapTPTrans_GetAlphaText(alpha)
return tostring(floor(100 * alpha + 0.5)) .. "%";
end
function AlphaMapTPTransControlFrame_OnLoad()
getglobal(this:GetName().."Title"):SetText(TITAN_ALPHAMAP_TRANS_CONTROL_TITLE);
this:SetBackdropBorderColor(1, 1, 1);
this:SetBackdropColor(0, 0, 0, 1);
end
-- If dropdown is visible then see if its timer has expired, if so hide the frame
function AlphaMapTPTransControlFrame_OnUpdate(elapsed)
TitanUtils_CheckFrameCounting(this, elapsed);
end
function TitanPanelRightClickMenu_PrepareAlphaMapTransMenu()
TitanPanelRightClickMenu_AddTitle(TitanPlugins[TITAN_ALPHAMAP_TRANS_ID].menuText);
TitanPanelRightClickMenu_AddCommand(TITAN_PANEL_MENU_HIDE, TITAN_ALPHAMAP_TRANS_ID, TITAN_PANEL_MENU_FUNC_HIDE);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -