Originally Posted by Lybrial
What is so special about the MainMenuMicroButton that it wont override the textures?
|
It is best to
look at Blizzard's code to see what is going on. In this case you have this running OnUpdate:
Lua Code:
function MainMenuMicroButtonMixin:OnUpdate(elapsed)
if ( self.updateInterval > 0 ) then
self.updateInterval = self.updateInterval - elapsed;
else
self.updateInterval = PERFORMANCEBAR_UPDATE_INTERVAL;
local status = GetFileStreamingStatus();
if ( status == 0 ) then
status = (GetBackgroundLoadingStatus()~=0) and 1 or 0;
end
if ( status == 0 ) then
MainMenuBarDownload:Hide();
self:SetNormalAtlas("hud-microbutton-MainMenu-Up", true);
self:SetPushedAtlas("hud-microbutton-MainMenu-Down", true);
self:SetDisabledAtlas("hud-microbutton-MainMenu-Disabled", true);
else
self:SetNormalTexture("Interface\\Buttons\\UI-MicroButtonStreamDL-Up");
self:SetPushedTexture("Interface\\Buttons\\UI-MicroButtonStreamDL-Down");
self:SetDisabledTexture("Interface\\Buttons\\UI-MicroButtonStreamDL-Up");
if ( status == 1 ) then
MainMenuBarDownload:SetTexture("Interface\\BUTTONS\\UI-MicroStream-Green");
elseif ( status == 2 ) then
MainMenuBarDownload:SetTexture("Interface\\BUTTONS\\UI-MicroStream-Yellow");
elseif ( status == 3 ) then
MainMenuBarDownload:SetTexture("Interface\\BUTTONS\\UI-MicroStream-Red");
end
MainMenuBarDownload:Show();
end
local bandwidthIn, bandwidthOut, latencyHome, latencyWorld = GetNetStats();
local latency = latencyHome > latencyWorld and latencyHome or latencyWorld;
if ( latency > PERFORMANCEBAR_MEDIUM_LATENCY ) then
MainMenuBarPerformanceBar:SetVertexColor(1, 0, 0);
elseif ( latency > PERFORMANCEBAR_LOW_LATENCY ) then
MainMenuBarPerformanceBar:SetVertexColor(1, 1, 0);
else
MainMenuBarPerformanceBar:SetVertexColor(0, 1, 0);
end
if ( self.hover and not KeybindFrames_InQuickKeybindMode() ) then
self.tooltipText = MicroButtonTooltipText(MAINMENU_BUTTON, "TOGGLEGAMEMENU");
MainMenuBarPerformanceBarFrame_OnEnter(self);
end
end
end
The easy fix is to replace the OnUpdate script with something similar that does not undo your changes:
Lua Code:
MainMenuMicroButton:SetScript('OnUpdate', function(self, elapsed)
if ( self.updateInterval > 0 ) then
self.updateInterval = self.updateInterval - elapsed;
else
self.updateInterval = PERFORMANCEBAR_UPDATE_INTERVAL;
local status = GetFileStreamingStatus();
if ( status == 0 ) then
status = (GetBackgroundLoadingStatus()~=0) and 1 or 0;
end
if ( status == 0 ) then
MainMenuBarDownload:Hide();
-- self:SetNormalAtlas("hud-microbutton-MainMenu-Up", true);
-- self:SetPushedAtlas("hud-microbutton-MainMenu-Down", true);
-- self:SetDisabledAtlas("hud-microbutton-MainMenu-Disabled", true);
else
-- self:SetNormalTexture("Interface\\Buttons\\UI-MicroButtonStreamDL-Up");
-- self:SetPushedTexture("Interface\\Buttons\\UI-MicroButtonStreamDL-Down");
-- self:SetDisabledTexture("Interface\\Buttons\\UI-MicroButtonStreamDL-Up");
if ( status == 1 ) then
MainMenuBarDownload:SetTexture("Interface\\BUTTONS\\UI-MicroStream-Green");
elseif ( status == 2 ) then
MainMenuBarDownload:SetTexture("Interface\\BUTTONS\\UI-MicroStream-Yellow");
elseif ( status == 3 ) then
MainMenuBarDownload:SetTexture("Interface\\BUTTONS\\UI-MicroStream-Red");
end
MainMenuBarDownload:Show();
end
local bandwidthIn, bandwidthOut, latencyHome, latencyWorld = GetNetStats();
local latency = latencyHome > latencyWorld and latencyHome or latencyWorld;
if ( latency > PERFORMANCEBAR_MEDIUM_LATENCY ) then
MainMenuBarPerformanceBar:SetVertexColor(1, 0, 0);
elseif ( latency > PERFORMANCEBAR_LOW_LATENCY ) then
MainMenuBarPerformanceBar:SetVertexColor(1, 1, 0);
else
MainMenuBarPerformanceBar:SetVertexColor(0, 1, 0);
end
if ( self.hover and not KeybindFrames_InQuickKeybindMode() ) then
self.tooltipText = MicroButtonTooltipText(MAINMENU_BUTTON, "TOGGLEGAMEMENU");
MainMenuBarPerformanceBarFrame_OnEnter(self);
end
end
end)