Fix eye animation and clicks

This commit is contained in:
Robin Hüskes 2022-12-09 15:51:31 +01:00
parent 68b5ca9914
commit 6f9ea48c15
2 changed files with 56 additions and 10 deletions

View File

@ -7,6 +7,11 @@ local LFG_EYE_TEXTURES = { };
LFG_EYE_TEXTURES["default"] = { file = "Interface\\LFGFrame\\LFG-Eye", width = 512, height = 256, frames = 29, iconSize = 64, delay = 0.1 };
LFG_EYE_TEXTURES["raid"] = { file = "Interface\\LFGFrame\\LFR-Anim", width = 256, height = 256, frames = 16, iconSize = 64, delay = 0.05 };
LFG_EYE_TEXTURES["unknown"] = { file = "Interface\\LFGFrame\\WaitAnim", width = 128, height = 128, frames = 4, iconSize = 64, delay = 0.25 };
local LFG_ANGER_INC_VAL = 30;
local LFG_ANGER_DEC_VAL = 1;
local LFG_ANGER_INIT_VAL = 60;
local LFG_ANGER_END_VAL = 75;
local LFG_ANGER_CAP_VAL = 90;
for _, t in pairs(LFG_EYE_TEXTURES) do
local cols = floor(t.width / t.iconSize)
local colWidth = t.iconSize / t.width
@ -36,7 +41,33 @@ local actions = {
text = L["Click to open the Dungeon Finder."],
enabled = function() return C_LFGInfo.CanPlayerUseLFD() end,
selected = function(button) return button == "LeftButton" and not IsModifierKeyDown() end,
func = function() PVEFrame_ToggleFrame("GroupFinderFrame", LFDParentFrame) end,
func = function()
local inBattlefield, showScoreboard = QueueStatus_InActiveBattlefield();
if ( IsInLFDBattlefield() ) then
inBattlefield = true;
showScoreboard = true;
end
local lfgListActiveEntry = C_LFGList.HasActiveEntryInfo();
if ( inBattlefield ) then
if ( showScoreboard ) then
TogglePVPScoreboardOrResults();
end
elseif ( lfgListActiveEntry ) then
LFGListUtil_OpenBestWindow(true);
else
--See if we have any active LFGList applications
local apps = C_LFGList.GetApplications();
for i=1, #apps do
local _, appStatus = C_LFGList.GetApplicationInfo(apps[i]);
if ( appStatus == "applied" or appStatus == "invited" ) then
--We want to open to the LFGList screen
LFGListUtil_OpenBestWindow(true);
return;
end
end
PVEFrame_ToggleFrame("GroupFinderFrame", LFDParentFrame)
end
end
},
{
text = L["Alt-Click to open the Raid Finder."],
@ -68,9 +99,9 @@ local function OnClick(self, button)
if button == "RightButton" and child:GetQueueInfo() and not IsShiftKeyDown() then
PlaySound(SOUNDKIT.IG_MAINMENU_OPEN)
local screenHalf = GetScreenHalf()
QueueStatusMinimapButtonDropDown.point = screenHalf == "TOP" and "TOPLEFT" or "BOTTOMLEFT"
QueueStatusMinimapButtonDropDown.relativePoint = screenHalf == "TOP" and "BOTTOMLEFT" or "TOPLEFT"
ToggleDropDownMenu(1, nil, QueueStatusMinimapButtonDropDown, self, 0, 0)
QueueStatusButtonDropDown.point = screenHalf == "TOP" and "TOPLEFT" or "BOTTOMLEFT"
QueueStatusButtonDropDown.relativePoint = screenHalf == "TOP" and "BOTTOMLEFT" or "TOPLEFT"
ToggleDropDownMenu(1, nil, QueueStatusButtonDropDown, self, 0, 0)
else
for i = 1, #actions do
local action = actions[i]

View File

@ -28,7 +28,22 @@ local queueTypes = {
"raid", -- Flex Raid
"pvp" -- World PVP
}
for _, t in pairs(LFG_EYE_TEXTURES) do
local cols = floor(t.width / t.iconSize)
local colWidth = t.iconSize / t.width
local rowHeight = t.iconSize / t.height
local iconCoords = { }
for i = 1, t.frames do
local L = mod(i - 1, cols) * colWidth
local R = L + colWidth
local T = ceil(i / cols) * rowHeight
local B = T - rowHeight
iconCoords[i] = { L, R, B, T }
end
t.iconCoords = iconCoords
end
function child:GetQueueInfo()
for i = 1, NUM_LE_LFG_CATEGORYS do
local mode, submode = GetLFGMode(i)
@ -86,15 +101,12 @@ local function OnEvent(self, event)
updateDelay = currentIcon.delay
child:SetIcon(currentIcon.file)
-- ldbobj['icon'] = currentIcon.file
currentFrame = 1
if queueType then
currentFrame = 1
self:SetScript("OnUpdate", UpdateIconCoords)
else
self:SetScript("OnUpdate", nil)
currentFrame = 1
child:SetIconCoords(iconCoords[1])
-- ldbobj['iconCoords'] = iconCoords[1]
end
end
local function OnEvent2(lib, event)
@ -138,12 +150,15 @@ child['specs'] = {
}
}
}
local function OnEvent3(self, event)
print(event)
end
function events:PLAYER_ENTERING_WORLD(event)
child:UnregisterEvent('PLAYER_ENTERING_WORLD')
local QSF = CreateFrame("Frame")
Mixin(QSF, QueueStatusFrameMixin)
-- QueueStatusFrame_OnLoad(QSF)
QSF:SetScript("OnEvent", OnEvent)
QSF:OnLoad()
QSF:HookScript("OnEvent", OnEvent)
child:RegisterEvent({"LFG_UPDATE", "LFG_ROLE_CHECK_UPDATE", "LFG_PROPOSAL_UPDATE", "LFG_PROPOSAL_FAILED", "LFG_PROPOSAL_SUCCEEDED", "LFG_PROPOSAL_SHOW", "LFG_QUEUE_STATUS_UPDATE"}, OnEvent2)
end
child:NewAddOn(...)