-
Posted by aeger on Wed, 28 Aug 2013 04:45:59
I'm trying to hide my bottom bar frames when the blizzard vehicle frame shows. I got the frames to hide ok for pet battles with this code.
PetBattleFrame:HookScript("OnShow",function() self:Hide() end) PetBattleFrame:HookScript("OnHide",function() self:Show() end)
Is there a hook for the vehicle frame like this. I tried registering the UNITENTEREDVEHICLE and UNITEXITEDVEHICLE events and hiding the frame that way but it didn't work.
This is my current code for my frames below. Looks like the code block doesn't work sorry about formatting. It may be easier to read on my project page https://github.com/aeger/AegerUI/
local aegerUI = ... local MEDIAPATH = "Interface\AddOns\" .. aegerUI .. "\Media\"
local BottomBarFrame1 = CreateFrame("Frame", "BottomBarFrame1", UIParent) BottomBarFrame1:Hide()
local BottomBarFrame2 = CreateFrame("Frame", "BottomBarFrame2", UIParent) BottomBarFrame2:Hide()
local DisplayBars = CreateFrame("Frame") DisplayBars:RegisterEvent("ADDON_LOADED") DisplayBars:RegisterEvent("ONUPDATE") DisplayBars:RegisterEvent("ONLOAD")
local function BbarDisplay() if Bbars == 1 then BottomBarFrame1:Show() BottomBarFrame2:Hide() else if Bbars == 2 then BottomBarFrame2:Show() BottomBarFrame1:Hide() end end end
DisplayBars:SetScript("OnEvent", function(self, event, ...) BbarDisplay() end)
BottomBarFrame1:SetScript("OnShow", function(self) self:SetScript("OnShow", nil) PetBattleFrame:HookScript("OnShow",function() self:Hide() end) PetBattleFrame:HookScript("OnHide",function() self:Show() end)
local Bar1display = self:CreateTexture(nil, "BACKGROUND")
Bar1display:SetWidth(943) Bar1display:SetHeight(43) Bar1display:SetPoint("BOTTOM", UIParent, "BOTTOM", 0, -3) Bar1display:SetPoint("CENTER", UIParent, "CENTER") Bar1display:SetTexture(MEDIAPATH .. "btrounded") Bar1display:SetVertexColor(0, 0, 0, .5)
local Bar1BorderDisplay = self:CreateTexture(nil, "BORDER")
Bar1BorderDisplay:SetWidth(947) Bar1BorderDisplay:SetHeight(47) Bar1BorderDisplay:SetPoint("BOTTOM", UIParent, "BOTTOM", 0, -3) Bar1BorderDisplay:SetPoint("CENTER", UIParent, "CENTER") Bar1BorderDisplay:SetTexture(MEDIAPATH .. "btroundedborder") local_,class = UnitClass("player") Bar1BorderDisplay:SetVertexColor(RAID_CLASS_COLORS[class].r, RAID_CLASS_COLORS[class].g, RAID_CLASS_COLORS[class].b, 1.0)
end)
BottomBarFrame2:SetScript("OnShow", function(self) self:SetScript("OnShow", nil) PetBattleFrame:HookScript("OnShow",function() self:Hide() end) PetBattleFrame:HookScript("OnHide",function() self:Show() end)
local Bar2display = self:CreateTexture(nil, "BACKGROUND")
Bar2display:SetWidth(943) Bar2display:SetHeight(84) Bar2display:SetPoint("BOTTOM", UIParent, "BOTTOM", 0, -4) Bar2display:SetPoint("CENTER", UIParent, "CENTER") Bar2display:SetTexture(MEDIAPATH .. "btrounded") Bar2display:SetVertexColor(0, 0, 0, .5) local Bar2BorderDisplay = self:CreateTexture(nil, "BORDER") Bar2BorderDisplay:SetWidth(947) Bar2BorderDisplay:SetHeight(90) Bar2BorderDisplay:SetPoint("BOTTOM", UIParent, "BOTTOM", 0, -4) Bar2BorderDisplay:SetPoint("CENTER", UIParent, "CENTER") Bar2BorderDisplay:SetTexture(MEDIAPATH .. "btroundedborder") local_,class = UnitClass("player") Bar2BorderDisplay:SetVertexColor(RAID_CLASS_COLORS[class].r, RAID_CLASS_COLORS[class].g, RAID_CLASS_COLORS[class].b, 1.0)
end)
-
Posted by aeger on Wed, 28 Aug 2013 21:32:33
I figured it out
local DisplayBars = CreateFrame("Frame") DisplayBars:RegisterEvent("ADDONLOADED") DisplayBars:RegisterEvent("ONUPDATE") DisplayBars:RegisterEvent("ONLOAD") DisplayBars:RegisterEvent("UNITENTERINGVEHICLE") DisplayBars:RegisterEvent("UNITENTEREDVEHICLE") DisplayBars:RegisterEvent("UNITEXITINGVEHICLE") DisplayBars:RegisterEvent("UNITEXITED_VEHICLE")
local function BbarDisplay() if ( not MainMenuBar.busy and not UnitHasVehicleUI("player") ) then if Bbars == 1 then
BottomBarFrame1:Show() BottomBarFrame2:Hide()
end
if Bbars == 2 then BottomBarFrame2:Show() BottomBarFrame1:Hide() end
elseif UnitHasVehicleUI("player") then
BottomBarFrame1:Hide() BottomBarFrame2:Hide()
end end