Ai
1 Star 0 Fork 0

GameLife/AdvancedInterfaceOptions

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
tempfix.lua 2.31 KB
一键复制 编辑 原始数据 按行查看 历史
Benjamin Staneck 提交于 2020-10-14 06:01 +08:00 . Update for Shadowlands
-- Temporary hack for Okay button overwriting our settings
-- Blocks the Okay button from being clicked on while our addon panels are active and
-- diverts clicks to the cancel button
local addonName, addon = ...
local E = addon:Eve()
-- Block mouse interaction with our interface panels in combat
local LockdownFrame = CreateFrame('Frame', nil, InterfaceOptionsFramePanelContainer)
LockdownFrame:Hide()
LockdownFrame:SetAllPoints()
LockdownFrame:EnableMouse(true)
LockdownFrame:SetFrameStrata('FULLSCREEN_DIALOG')
local LockdownBg = LockdownFrame:CreateTexture()
LockdownBg:SetAllPoints()
LockdownBg:SetColorTexture(0,0,0,0.6)
local LockdownText = LockdownFrame:CreateFontString(nil, 'ARTWORK', 'GameFontNormalHugeOutline')
LockdownText:SetTextColor(1, 0, 0)
LockdownText:SetPoint('CENTER')
LockdownText:SetText("CAN'T MODIFY CVARS IN COMBAT")
local OkayGo = CreateFrame('Button', nil, InterfaceOptionsFrameOkay)
OkayGo:Hide()
OkayGo:SetAllPoints()
OkayGo:SetScript('OnEnter', function() InterfaceOptionsFrameOkay:LockHighlight() end)
OkayGo:SetScript('OnLeave', function() InterfaceOptionsFrameOkay:UnlockHighlight() end)
OkayGo:SetScript('OnMouseDown', function()
InterfaceOptionsFrameOkay:SetButtonState('PUSHED', false)
end)
OkayGo:SetScript('OnMouseUp', function(self)
InterfaceOptionsFrameOkay:SetButtonState('NORMAL', false)
if MouseIsOver(self) and not InCombatLockdown() then
--InterfaceOptionsFrame:Hide()
HideUIPanel(InterfaceOptionsFrame)
--InterfaceOptionsFrameCancel:Click() -- taints regardless of whether you're in combat
end
end)
for k,f in pairs(INTERFACEOPTIONS_ADDONCATEGORIES) do
if f.name == addonName or f.parent == addonName then
f:HookScript('OnShow', function()
OkayGo:Show()
if InCombatLockdown() then
LockdownFrame:Show()
OkayGo:EnableMouse(false)
else
OkayGo:EnableMouse(true)
end
end)
f:HookScript('OnHide', function()
OkayGo:Hide()
LockdownFrame:Hide()
end)
end
end
function E:PLAYER_REGEN_DISABLED()
if OkayGo:IsShown() then
-- InterfaceOptionsFrameCancel:Click() -- this seems to taint even though it shouldn't
OkayGo:EnableMouse(false)
LockdownFrame:Show()
end
end
function E:PLAYER_REGEN_ENABLED()
OkayGo:EnableMouse(true)
if LockdownFrame:IsShown() then
LockdownFrame:Hide()
end
end
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Lua
1
https://gitee.com/addons/AdvancedInterfaceOptions.git
git@gitee.com:addons/AdvancedInterfaceOptions.git
addons
AdvancedInterfaceOptions
AdvancedInterfaceOptions
master

搜索帮助