Originally Posted by Lombra
Yeah that'll work. Sounds like you'd be getting some error related to missing API data on first login.
How can you tell it's not working?
|
Ah so at least I can cross that off the list. No idea why no Lua error is appearing then. The OnEnable function shows a few visual frames on the screen and does not do it when I launch WoW and login for the first time and requires me to have to reload the UI with the slash command which is a pain.
I am trying to bind the Shadowed Unit Frames onto the frames I create so in the ToC I have:
## OptionalDeps: ShadowedUnitFrames
The Entire OnEnable function is this:
Lua Code:
local MayronUI = LibStub("AceAddon-3.0"):GetAddon("MayronUI") -- Just added this but does not change anything.
function MayronUI:OnEnable()
-- Constants:
local MUI = MayronUI.db.profile;
local muiBottom = CreateFrame("Frame", "MUI_Bottom", UIParent, "MUI_Bottom") -- using XML template which is loaded first.
local currentProfile = nil
local function RegisterEvents(self, ...)
for i=1,select('#', ...) do
self:RegisterEvent(select(i, ...));
end
end
muiBottom.RegisterEvents = RegisterEvents;
muiBottom:RegisterEvents("PLAYER_ENTERING_WORLD", 'PLAYER_TARGET_CHANGED', "PLAYER_LOGOUT");
muiBottom:SetScript("OnEvent", function(self, event, ...)
if ( event == "PLAYER_TARGET_CHANGED" ) then
if ( UnitExists("target") ) then
MUI_BottomRightName:Show();
MUI_BottomUnitFrames:SetTexture(MUI_MEDIA.."Double.tga");
else
MUI_BottomRightName:Hide();
MUI_BottomUnitFrames:SetTexture(MUI_MEDIA.."Single.tga");
end
elseif ( event == "PLAYER_ENTERING_WORLD" ) then -- Aligning Supported AddOns with MUI_Bottom
if ( IsAddOnLoaded("ShadowedUnitFrames") and ShadowUF.db ) then
currentProfile = ShadowUF.db:GetCurrentProfile();
SUFUnittargettarget:ClearAllPoints();
SUFUnittargettarget:SetPoint("BOTTOM", "MUI_Bottom", "CENTER", 0, 3);
local SUF = _G.ShadowedUFDB["profiles"][currentProfile]["positions"]["targettarget"];
_G.SUF["point"] = "BOTTOM"; _G.SUF["anchorTo"] = "MUI_Bottom";
_G.SUF["relativePoint"] = "CENTER"; _G.SUF["x"] = 0; _G.SUF["y"] = 3;
ShadowUF.Layout:Reload();
CastingBarFrame:UnregisterAllEvents();
CastingBarFrame:Hide();
MUI_PlayerCastBar:ClearAllPoints();
MUI_PlayerCastBar:SetPoint("TOPLEFT", SUFUnitplayer, "TOPLEFT", 1, -0.5);
MUI_PlayerCastBar:SetSize((SUFUnitplayer:GetWidth()-2), 26.5);
MUI_TargetCastBar:ClearAllPoints();
MUI_TargetCastBar:SetPoint("TOPLEFT", SUFUnittarget, "TOPLEFT", 1, -0.5);
MUI_TargetCastBar:SetSize((SUFUnittarget:GetWidth()-2), 26.5);
self:UnregisterEvent("PLAYER_ENTERING_WORLD");
end
elseif ( event == "PLAYER_LOGOUT" ) then
_G.ShadowedUFDB["profiles"][currentProfile]["positions"]["targettarget"]["anchorTo"] = "UIParent";
end
end)
end
Using "GetAddon" at the start of the file does not seem to help and is something I just tried recently to fix it with no luck.
EDIT: Also I wanted to use "PLAYER_LOGIN" rather than "PLAYER_ENTERING_WORLD" but this never gets triggered in the OnEnable function. Don't think it matters though.