comparison ObjectiveTracker/Frame.lua @ 33:64f2a9bbea79

- implementing structural revisions in bonus objectives - prevent instances of nil arithmetic - decide on where to keep style values - start widgets with dummy values for operability
author Nenue
date Fri, 15 Apr 2016 17:01:06 -0400
parents a3afe6c3771e
children 9856ebc63fa4
comparison
equal deleted inserted replaced
32:a3afe6c3771e 33:64f2a9bbea79
55 local lineColors = { 55 local lineColors = {
56 normal = { 56 normal = {
57 text = {.5,.75,1}, 57 text = {.5,.75,1},
58 }, 58 },
59 completed = { 59 completed = {
60 text = {1,0,.1} 60 text = {0, 1, 0}
61 }, 61 },
62 failed = { 62 failed = {
63 text = {1,0,0 } 63 text = {1,0,0 }
64 }, 64 },
65 autocomplete = { 65 autocomplete = {
145 line.status:SetTextColor(r, g, b, a) 145 line.status:SetTextColor(r, g, b, a)
146 146
147 -- For progressbar and timer lines, status text may be used as the title heading 147 -- For progressbar and timer lines, status text may be used as the title heading
148 if attachment then 148 if attachment then
149 local widgetOffset = 0 149 local widgetOffset = 0
150 line.height = attachment:GetHeight() + textSpacing
150 if text and #text >= 1 then 151 if text and #text >= 1 then
151 widgetOffset = line.status:GetHeight() + textSpacing 152 widgetOffset = line.status:GetHeight() + textSpacing
152 line.height = floor(line.status:GetStringHeight()+.5) + textSpacing + attachment.height 153 line.height = line.height + floor(line.status:GetStringHeight()+.5) + textSpacing
153 print(' |cFFFF0088doing things with captioned widget') 154 print(' |cFFFF0088doing things with captioned widget')
154 else 155 else
155 print(' |cFFFF0088doing things with a widget') 156 print(' |cFFFF0088doing things with a widget')
156 end 157 end
157 attachment:SetPoint('TOP', line, 'TOP', 0, -widgetOffset) 158 attachment:SetPoint('TOP', line, 'TOP', 0, -widgetOffset)
227 block.currentLine = 0 228 block.currentLine = 0
228 block:SetWidth(c.Width) 229 block:SetWidth(c.Width)
229 230
230 block.title:SetSpacing(c.TitleSpacing) 231 block.title:SetSpacing(c.TitleSpacing)
231 block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing) 232 block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing)
233 block.title:SetPoint('LEFT', block, 'LEFT', titleIndent, 0)
232 234
233 block.titlebg:SetTexture(1,1,1,1) 235 block.titlebg:SetTexture(1,1,1,1)
234 block.titlebg:SetGradientAlpha(unpack(titlebg)) 236 block.titlebg:SetGradientAlpha(unpack(titlebg))
235 block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0) 237 block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0)
236 block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing) 238 block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing)
539 541
540 local tagPoint, tagAnchor, tagRelative, x, y = 'TOPRIGHT', block, 'TOPRIGHT', -2, -2 542 local tagPoint, tagAnchor, tagRelative, x, y = 'TOPRIGHT', block, 'TOPRIGHT', -2, -2
541 543
542 local numCurrency = 0 544 local numCurrency = 0
543 for i, rewardTile in ipairs(block.rewardTile) do 545 for i, rewardTile in ipairs(block.rewardTile) do
544 local reward = info.rewardInfo[i] 546 if info.rewardInfo and info.rewardInfo[i] then
545 if reward then 547 local reward = info.rewardInfo[i]
546 --rewardTile:SetPoint(tagPoint, tagAnchor, tagRelative, -2, -2) 548 --rewardTile:SetPoint(tagPoint, tagAnchor, tagRelative, -2, -2)
547 rewardTile:SetTexture(reward.texture) 549 rewardTile:SetTexture(reward.texture)
548 rewardTile:Show() 550 rewardTile:Show()
549 551
550 print('updating reward tile #'.. i, reward.type, reward.count, reward.text, reward.texture) 552 print('updating reward tile #'.. i, reward.type, reward.count, reward.text, reward.texture)
551 if reward.count and reward.count > 1 then 553 if reward.count and reward.count > 1 then
606 end 608 end
607 609
608 if (info.isComplete or info.numObjectives == 0) and info.completionText then 610 if (info.isComplete or info.numObjectives == 0) and info.completionText then
609 print(' overriding line #1 for completion text:', info.completionText) 611 print(' overriding line #1 for completion text:', info.completionText)
610 text = info.completionText 612 text = info.completionText
611 handler:AddLine(block, text, nil) 613 handler:AddLine(block, text, nil, 'completed')
612 else 614 else
613 if info.objectives then 615 if info.objectives then
614 for i, data in ipairs(info.objectives) do 616 for i, data in ipairs(info.objectives) do
615 local line = handler:GetLine(block) 617 local line = handler:GetLine(block)
616 displayObjectiveHeader = true 618 displayObjectiveHeader = true