6e06bfb - Fix character settings loading
[wowui.git] / OmaUF / UnitFrames.lua
index 76c2c7e..d2e5fcc 100644 (file)
@@ -236,18 +236,19 @@ local function initializeTarget(parent)
     secure:SetAttribute("_onstate-vehicleui", vehicletoggle);
 end
 
-local function initialize()
-    initializePlayer(UIParent);
-    initializeTarget(UIParent);
-    -- TODO boss frames, pet frame, (arena frames)
-end
-
 local function loadCharSettings()
     width, height = Settings.Character.Width, Settings.Character.Height;
     anchorX, anchorY = Settings.Character.AnchorX, Settings.Character.AnchorY;
     attributes = Settings.Character.Clickheal;
 end
 
+local function initialize()
+    loadCharSettings();
+    initializePlayer(UIParent);
+    initializeTarget(UIParent);
+    -- TODO boss frames, pet frame, (arena frames)
+end
+
 local hidden = false;
 local function hideBlizzardFrames()
     if hidden then return end
@@ -281,15 +282,12 @@ local function hideBlizzardFrames()
     PlayerFrame:SetDontSavePosition(true);
 end
 
-UnitFrames:RegisterEvent("ADDON_LOADED");
 UnitFrames:RegisterEvent("PLAYER_LOGIN");
 UnitFrames:SetScript("OnEvent", function(self, event)
     if event == "PLAYER_LOGIN" then
-        hideBlizzardFrames();
-        initialize();
-    elseif event == "ADDON_LOADED" then
         OmaUFLoadChar();
-        loadCharSettings();
         OmaUFEvents.LoadChar();
+        hideBlizzardFrames();
+        initialize();
     end
 end);