X-Git-Url: https://www.aleksib.fi/git/wowui.git/blobdiff_plain/d180f82975c6b13a3380bd8df5ab47df70112c49..eeb41892047047322da96e7d6c6b006496b04010:/OmaRF/RaidFrame.lua diff --git a/OmaRF/RaidFrame.lua b/OmaRF/RaidFrame.lua index 31ef192..cb2c3a2 100644 --- a/OmaRF/RaidFrame.lua +++ b/OmaRF/RaidFrame.lua @@ -11,9 +11,6 @@ local registerEvents = OmaRFEvents.RegisterEvents; local unitEvent = OmaRFEvents.UnitEvent; local Settings = OmaRFSettings; -local positions = Settings.Positions; -local width, height = Settings.Character.Width, Settings.Character.Height; -local anchorX, anchorY = Settings.Character.AnchorX, Settings.Character.AnchorY; local indSize = Settings.IndSize; local baseColor = Settings.BaseColor; local bgColor = Settings.BgColor; @@ -22,7 +19,11 @@ local shieldColor = Settings.ShieldColor; local shieldhlColor = Settings.ShieldhlColor; local healpredColor = Settings.HealpredColor; local healabsorbColor = Settings.HealabsorbColor; -local attributes = Settings.Character.Clickheal; +-- placeholders with visible values when error happens +local positions = {}; +local width, height = 10, 10; +local anchorX, anchorY = 10, 10; +local attributes = {}; local CFrame = CreateFrame("Frame", "OmaRFFrame", UIParent); local inheritedFrames = "SecureUnitButtonTemplate,SecureHandlerStateTemplate"; @@ -56,7 +57,7 @@ local function setupIndicators(frame) if i == 1 then frame.major[i]:SetPoint("TOPLEFT", frame.major, "TOPLEFT"); else - frame.major[i]:SetPoint("TOPLEFT", frame.major[i-1], "TOPLEFT"); + frame.major[i]:SetPoint("TOPLEFT", frame.major[i-1], "TOPRIGHT"); end frame.major[i]:SetWidth(indSize*2); frame.major[i]:SetHeight(indSize*2); @@ -89,6 +90,7 @@ local function frameShow(frame) frame:RegisterEvent("UNIT_PET"); frame:RegisterEvent("PLAYER_ROLES_ASSIGNED"); frame:RegisterEvent("GROUP_ROSTER_UPDATE"); + frame:RegisterEvent("PLAYER_ENTERING_WORLD"); registerEvents(frame); frame:SetScript("OnUpdate", unitUpdate); unitEvent(frame, "UPDATE_ALL_BARS", frame.displayed); @@ -289,9 +291,22 @@ local function initialize() initializeRaid(CFrame); end +local function loadCharSettings() + width, height = Settings.Character.Width, Settings.Character.Height; + anchorX, anchorY = Settings.Character.AnchorX, Settings.Character.AnchorY; + attributes = Settings.Character.Clickheal; + positions = Settings.Character.Positions; +end + +CFrame:RegisterEvent("ADDON_LOADED"); CFrame:RegisterEvent("PLAYER_LOGIN"); CFrame:SetScript("OnEvent", function(self, event) if event == "PLAYER_LOGIN" then initialize(); + elseif event == "ADDON_LOADED" then + OmaRFLoadChar(); + loadCharSettings(); + OmaRFEvents.LoadChar(); + OmaRFIndicators.LoadChar(); end end);