Mercurial > wow > worldplan
diff ClassPlan.lua @ 117:a4dfdd4f1cf3 v7.3.2-20171215
- Fixed filter pins not working on Argus maps
- More taint counter-measures
author | Nenue |
---|---|
date | Fri, 15 Dec 2017 16:38:09 -0500 |
parents | b2be2de2b133 |
children |
line wrap: on
line diff
--- a/ClassPlan.lua Fri Nov 24 23:51:44 2017 -0500 +++ b/ClassPlan.lua Fri Dec 15 16:38:09 2017 -0500 @@ -145,6 +145,7 @@ self.profile = characters[profileName] or { showItems = true } + self.profileName = profileName self.characters = characters characters[profileName] = self.profile @@ -175,9 +176,9 @@ end frame.sortedItems = {} for index, listKey in ipairs(frame.listKey) do + self.profile[listKey] = self.profile[listKey] or {} frame.profile = self.profile frame.data = self.data - self.profile[listKey] = self.profile[listKey] or {} local listTitle = frame.listTitle[index] setmetatable(self.profile[listKey], { __tostring = function() return listTitle end }) frame.sortedItems[listKey] = {} @@ -235,16 +236,11 @@ local max = math.max function ClassPlan:RefreshData() - local detailsFailed for index, handler in pairs(self.Handlers) do print(' |cFF00FF00'..handler:GetName()..' data update|r') handler:RefreshData() end - if detailsFailed then - db.print('Unable to obtain player details. Trying again later.') - else self.requestingData = nil - end end function ClassPlan:Update() @@ -254,7 +250,9 @@ for index, handler in ipairs(self.Handlers) do local itemsHeight = handler:UpdateItems() if itemsHeight then + self.currentHeight = max(itemsHeight, self.currentHeight) + print('calc height', handler, self.currentHeight) end end @@ -299,6 +297,11 @@ index = index + 1 end + for i = index, #self.characterButtons do + self.characterButtons[i]:Hide() + end + + self.HeaderInset:SetHeight(CP_HEADER_SIZE) self.HeaderInset:ClearAllPoints() self.HeaderInset:SetPoint('TOPLEFT' ,self, 'TOPLEFT') @@ -376,7 +379,7 @@ ListTab:SetPoint('BOTTOMRIGHT', frame, 'TOPRIGHT', 0, -CP_HEADER_SIZE) ListTab.Label:SetText(frame.listTitle[frame.currentListIndex]) ListTab:Show() - print(ListTab:GetSize()) + print(ListTab:GetName(), ListTab:GetSize()) end self.currentHeight = max(self.currentHeight, frame.currentHeight or 0) end @@ -470,13 +473,10 @@ function ClassPlanHandlerBase:RefreshData() print('|cFF0088FF'..self:GetName()..':RefreshData()') local activeKey = self.activeKey - local detailsFailed self.truncatedItems = 0 self.currentTime = time() if self:GetParent().profile then self:GetPlayerData() - else - detailsFailed = true end for _, listKey in ipairs(self.listKey) do local sortedItems = self.sortedItems[listKey] @@ -543,10 +543,7 @@ self.Name:SetTextColor(data.classColor.r, data.classColor.g, data.classColor.b) end -function ClassPlanHandlerBase:Acquire(id) -end -function ClassPlanHandlerBase:FreeBlock (block) -end +function ClassPlanHandlerBase:Reanchor() end function ClassPlanHandlerBase:UpdateItems() print('|cFF0088FF '..self:GetName()..':UpdateItems()|r', self.activeKey) @@ -561,6 +558,16 @@ scrollOffset = (numItems - self.maxItems) end + if self.OnUpdateRequested then + local overrideHeight = self:OnUpdateRequested() + if overrideHeight then + return overrideHeight + end + + + end + + self.ListTab.Count:SetText(numItems) self.blocks = self.blocks or {} local blocks = self.blocks @@ -647,6 +654,12 @@ self.scrollOffset = scrollOffset self.isStale = nil + + + if self.OnItemsUpdated then + return self:OnItemsUpdated() + end + return totalHeight end @@ -708,7 +721,7 @@ local frame = self:GetParent() frame:SetList() if frame.OnHeaderClick then - frame.OnHeaderClick(frame) + frame:OnHeaderClick() end end @@ -723,6 +736,10 @@ self.SelectGlow:SetShown(self.isMine) end +function ClassPlanCharacterButtonMixin:OnLoad() + self:RegisterForClicks('AnyDown') +end + function ClassPlanCharacterButtonMixin:OnEnter() if not self.profileKey then return @@ -730,7 +747,7 @@ GameTooltip:SetOwner(self, 'ANCHOR_RIGHT') local info = ClassOrderPlan.data.characters[self.profileKey] - GameTooltip:AddLine(self.characterName, self.classColor.r, self.classColor.g, self.classColor.b) + GameTooltip:AddLine(self.characterName .. ' - ' .. self.characterRealm, self.classColor.r, self.classColor.g, self.classColor.b) local numItems = 0 if info.missions then GameTooltip:AddLine(#info.missions .. ' mission'..((#info.missions == 1) and '' or 's')..' in progress') @@ -751,13 +768,22 @@ end function ClassPlanCharacterButtonMixin:OnClick(button, down) - print('OnClick', self.profileKey) local clist = ClassOrderPlan.data.characters if button == 'RightButton' then - for _, profile in pairs(clist) do - profile.showItems = true + + if IsShiftKeyDown() then + print('delete profile', self.profileKey) + clist[self.profileKey] = nil + else + + for _, profile in pairs(clist) do + profile.showItems = true + end end + + + else if clist[self.profileKey].showItems then clist[self.profileKey].showItems = nil @@ -769,7 +795,10 @@ handler.isStale = true end + + ClassOrderPlan:RefreshData() ClassOrderPlan:Update() - print(clist[self.profileKey].showItems) + print('OnClick', self.profileKey) + print( clist[self.profileKey] and clist[self.profileKey].showItems) end