From: Aleksi Blinnikka Date: Sat, 27 Jan 2018 12:03:55 +0000 (+0200) Subject: Add focus frame X-Git-Url: https://www.aleksib.fi/git/wowui.git/commitdiff_plain/9405379118ca9e6953dec8b54229f59d2d5788bc Add focus frame --- diff --git a/OmaRF/Events.lua b/OmaRF/Events.lua index faeff80..633319f 100644 --- a/OmaRF/Events.lua +++ b/OmaRF/Events.lua @@ -260,7 +260,6 @@ local function updateRole(frame, unit) end local function updateReadyCheck(frame, unit) - if GetReadyCheckTimeLeft() <= 0 then return end local status = GetReadyCheckStatus(unit); if status == "ready" then frame.ready:SetTexture(READY_CHECK_READY_TEXTURE); @@ -364,6 +363,7 @@ eventFuncs["UNIT_EXITED_VEHICLE"] = eventFuncs["UPDATE_ALL_BARS"]; eventFuncs["UNIT_PET"] = eventFuncs["UPDATE_ALL_BARS"]; eventFuncs["GROUP_ROSTER_UPDATE"] = eventFuncs["UPDATE_ALL_BARS"]; eventFuncs["PLAYER_ENTERING_WORLD"] = eventFuncs["UPDATE_ALL_BARS"]; +eventFuncs["PLAYER_FOCUS_CHANGED"] = eventFuncs["UPDATE_ALL_BARS"]; function M.UnitEvent(self, event) eventFuncs[event](self); diff --git a/OmaRF/RaidFrame.lua b/OmaRF/RaidFrame.lua index 461d4dc..1f4bc87 100644 --- a/OmaRF/RaidFrame.lua +++ b/OmaRF/RaidFrame.lua @@ -96,6 +96,7 @@ local function frameShow(frame) frame:RegisterEvent("READY_CHECK"); frame:RegisterEvent("READY_CHECK_CONFIRM"); frame:RegisterEvent("READY_CHECK_FINISHED"); + if frame.unit == "focus" then frame:RegisterEvent("PLAYER_FOCUS_CHANGED") end registerEvents(frame); frame:SetScript("OnUpdate", unitUpdate); unitEvent(frame, "UPDATE_ALL_BARS", frame.displayed); @@ -306,12 +307,27 @@ local function initializeRaid(parent) end end +local function initializeFocus(parent) + local secure = CreateFrame("Button", "OmaFocusSecure", parent, inheritedFrames); + local frame = CreateFrame("Frame", "OmaFocus", parent); + local unit = "focus"; + secure:SetPoint("BOTTOMLEFT", parent, "TOPLEFT"); + frame:SetPoint("BOTTOMLEFT", parent, "TOPLEFT"); + setupFrame(frame, secure, unit); + RegisterUnitWatch(frame); + RegisterUnitWatch(secure); + local vehicle = format("[@%s,unithasvehicleui] vehicle; no", unit); + RegisterStateDriver(secure, "vehicleui", vehicle); + secure:SetAttribute("_onstate-vehicleui", vehicletoggle); +end + local function initialize() CFrame:SetPoint("CENTER", nil, "CENTER", anchorX, anchorY); CFrame:SetHeight((height+2)*8); CFrame:SetWidth((width+2)*5+1); initializeParty(CFrame); initializeRaid(CFrame); + initializeFocus(CFrame); end local function loadCharSettings()