# HG changeset patch # User Nenue # Date 1476769806 14400 # Node ID 4e1883842abf68fd9332c2dcc0b521adca2be9ea # Parent 4c7e9efec4b5912cc03eef6eb27993395b90bca1 - use of SetShown() for combat visibility toggle diff -r 4c7e9efec4b5 -r 4e1883842abf ClassPlan.lua --- a/ClassPlan.lua Mon Oct 17 12:59:24 2016 -0400 +++ b/ClassPlan.lua Tue Oct 18 01:50:06 2016 -0400 @@ -71,6 +71,12 @@ end end +MissionsHandler.OnGetItem = function(data) + if data.missionEndTime < GI_currentTime then + data.isComplete = true + end +end + MissionsHandler.FreeBlock = function(self, block) end @@ -203,11 +209,11 @@ end function core:OnLoad () - self:RegisterUnitEvent('UNIT_PORTRAIT_UPDATE', 'player') self:RegisterEvent('PLAYER_LOGIN') self:RegisterEvent('PLAYER_ENTERING_WORLD') self:RegisterEvent('ADDON_LOADED') self:RegisterEvent('PLAYER_REGEN_ENABLED') + self:RegisterEvent('PLAYER_REGEN_DISABLED') -- Blizzard_GarrisonUI already fires a shipment data request for GARRISON_SHIPMENT_RECEIVED; this is unlikely to @@ -223,34 +229,35 @@ self:ClearAllPoints() + local anchorTo = 'TOP' self.anchorParent = UIParent for i, name in ipairs(parentFrames) do local frame = _G[name] if frame then if not BOUND_FRAMES[frame] then - BOUND_FRAMES[frame] = {visible = frame:IsVisible()} + BOUND_FRAMES[frame] = {visible = (frame:IsVisible() and frame:IsShown())} hooksecurefunc(frame, 'Show', function() BOUND_FRAMES[frame].visible = true print(frame:GetName(), 'Show', 'reanchor trigger') self:Reanchor() end) hooksecurefunc(frame, 'Hide', function() - BOUND_FRAMES[frame].visible = false + BOUND_FRAMES[frame].visible = nil print(frame:GetName(), 'Hide', 'reanchor trigger') self:Reanchor() end) end - print('f:', frame:GetName(), frame:IsVisible()) + print('f:', frame:GetName(), BOUND_FRAMES[frame].visible) if BOUND_FRAMES[frame].visible then self.anchorParent = frame + anchorTo = 'BOTTOM' break end end end - print('|cFFFF8800Using ' .. tostring(self.anchorParent:GetName()) .. ' as anchor point') + print('|cFFFF8800Using ' .. tostring(self.anchorParent:GetName()) .. '-'..anchorTo..' as anchor point') - if self:IsVisible() then - self:SetPoint('TOP', ClassPlanButton, 'BOTTOM', 0, 0) + if self:IsShown() then ClassPlanButton.Background:Show() ClassPlanButton:SetWidth(600) else @@ -258,8 +265,11 @@ ClassPlanButton:SetWidth(200) end - ClassPlanButton:SetPoint('TOP', self.anchorParent, (self.anchorPoint == UIParent) and 'TOP' or 'BOTTOM', 0, 0) + self:SetPoint('TOP', ClassPlanButton, 'BOTTOM', 0, 0) + ClassPlanButton:ClearAllPoints() + ClassPlanButton:SetPoint('TOP', self.anchorParent, anchorTo, 0, 0) + print(ClassPlanButton:GetPoint(1)) end function core:AddHandler(name, prototype) @@ -311,8 +321,10 @@ function core:OnEvent (event, ...) print(event) - if event == 'UNIT_PORTRAIT_UPDATE' then - SetPortraitTexture(self.portrait, 'player') + if event == 'PLAYER_REGEN_DISABLED' then + self:SetShown(false) + elseif event == 'PLAYER_REGEN_ENABLED' then + self:SetShown(true) elseif event == 'PLAYER_LOGIN' then if not self.initialized then self:Setup() @@ -334,11 +346,19 @@ local SetOwnerData = function(self, data) local name, realm = string.match(data.profileKey, "(.+)%-(.+)") local ownerText = '|c'.. data.classColor.colorStr .. name .. '|r' - if realm ~= GI_currentRealm then - ownerText = ownerText .. ' (' .. realm .. ')' + --if realm ~= GI_currentRealm then + --ownerText = ownerText .. ' (' .. realm .. ')' + --end + self.Owner:SetText(ownerText) + self.Name:SetTextColor(data.classColor.r, data.classColor.g, data.classColor.b) + + if self.isComplete then + self.TimeLeft:SetText('Complete!') + self.Background:SetColorTexture(.25,.25,.25,1) + else + self.Background:SetColorTexture(0,0,0,0.5) end - self.Owner:SetText(ownerText) - self.Background:SetColorTexture(data.classColor.r, data.classColor.g, data.classColor.b) + end function core:RefreshItems(configKey, prototype) @@ -376,6 +396,7 @@ end end block:Refresh(data) + print(block.isComplete, block.missionEndTime, block.name) SetOwnerData(block, data) block:Show() @@ -408,14 +429,14 @@ end function core:Toggle() - if self:IsVisible() then + if self:IsShown() then self:Hide() else self:Show() end if self.data then - self.data.IsShown = self:IsVisible() + self.data.IsShown = self:IsShown() end end @@ -483,7 +504,7 @@ end function MissionsHandler:OnComplete() - self.isComplete = true + print('flagging complete', self.name) self:Refresh() end @@ -517,12 +538,12 @@ local r,g,b = 1, 1, 1 if self.isRare then r,g,b = 0.1, 0.4, 1 + self.IconBorder:SetVertexColor(r, g, b, 1) end --self.missionData = data - self.Label:SetText(self.name) - self.Label:SetTextColor(r, g, b) + self.Name:SetText(self.name) if #self.rewards >= 1 then self.Icon:SetTexture(self.rewards[1].icon or GetItemIcon(self.rewards[1].itemID)) @@ -530,11 +551,6 @@ else self.Icon:SetAtlas(self.typeAtlas, false) end - if self.isComplete then - self.TimeLeft:SetText('Complete!') - end - - self.Background:SetAlpha(self.isComplete and 1 or 0.1) end diff -r 4c7e9efec4b5 -r 4e1883842abf ClassPlan.xml --- a/ClassPlan.xml Mon Oct 17 12:59:24 2016 -0400 +++ b/ClassPlan.xml Tue Oct 18 01:50:06 2016 -0400 @@ -28,6 +28,13 @@ + + + + + + + @@ -72,7 +79,7 @@