comparison ObjectiveTracker/RewardFrame.lua @ 40:03ed70f846de

- move block accessors into a new file - define a tMove function for reconciling the free/used tables as needed - when retrieving an old block frame, confirm ID still matches; resolves multiple watch items on one block - stop any animations when a block is freed; resolves stuck flare graphics
author Nenue
date Sun, 24 Apr 2016 14:15:25 -0400
parents
children
comparison
equal deleted inserted replaced
39:92534dc793f2 40:03ed70f846de
1 --- ${PACKAGE_NAME}
2 -- @file-author@
3 -- @project-revision@ @project-hash@
4 -- @file-revision@ @file-hash@
5 -- Created: 4/22/2016 5:38 PM
6 local B = select(2,...).frame
7 local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
8 local ipairs = ipairs
9 local bprint = B.print('Block')
10 local Default, AutoQuest, Quest, Bonus, Cheevs = T.DefaultHandler, T.AutoQuest, T.Quest, T.Bonus, T.Cheevs
11 --- displays a reward popout and starts its animation chain
12 local tagPoint, tagAnchor, tagRelative, x, y
13 local REWARD_POPUP_FRAME = _G.VeneerRewardsPopOut
14
15 function REWARD_POPUP_FRAME:StartRewards()
16 tagPoint, tagAnchor, tagRelative, x, y = 'TOPLEFT', self, 'TOPLEFT', 0, 0
17
18 end
19 function REWARD_POPUP_FRAME:AddReward(handler, rewardInfo, id)
20 local totalHeight = 0
21 REWARD_POPUP_FRAME:SetID(id)
22 REWARD_POPUP_FRAME.handler = handler
23
24 for i, rewardTile in ipairs(REWARD_POPUP_FRAME.rewardTile) do
25 if rewardInfo[i] then
26 local reward = rewardInfo[i]
27 rewardTile:SetPoint(tagPoint, tagAnchor, tagRelative, -2, -2)
28 rewardTile:SetTexture(reward.texture)
29 rewardTile:Show()
30 if reward.count and reward.count > 1 then
31 self.rewardLabel[i]:SetText(reward.count)
32 self.rewardLabel[i]:Show()
33 end
34
35 rewardTile:ClearAllPoints()
36 rewardTile:SetPoint(tagPoint, tagAnchor, tagRelative, x, y)
37 tagPoint, tagAnchor, tagRelative, x, y = 'TOPRIGHT', rewardTile, 'TOPLEFT', -2, 0
38
39 totalHeight = totalHeight + rewardTile:GetHeight()
40 else
41 rewardTile:Hide()
42 self.rewardLabel[i]:Hide()
43 end
44 end
45
46 REWARD_POPUP_FRAME.rewardsFadeIn:Play()
47 end
48
49 function REWARD_POPUP_FRAME:OnFinished ()
50 end
51