Mercurial > wow > buffalo2
comparison ObjectiveTracker/ObjectiveFrame.lua @ 25:4b3da1b221de v1.0-beta
- distinction between all possible types of values for the 'isComplete' field
- style polish applied to title headers
- clickable regions altered to somewhat match those of the blizzard objectives tracker, for more world frame space and quicker user familiarity
| author | Nenue |
|---|---|
| date | Wed, 13 Apr 2016 11:20:09 -0400 |
| parents | 66b927b46776 |
| children |
comparison
equal
deleted
inserted
replaced
| 24:66b927b46776 | 25:4b3da1b221de |
|---|---|
| 32 local scrollWidth, scrollHeight | 32 local scrollWidth, scrollHeight |
| 33 local previousBlock | 33 local previousBlock |
| 34 local currentBlock | 34 local currentBlock |
| 35 --- todo: source these from config | 35 --- todo: source these from config |
| 36 local itemButtonSize, itemButtonSpacing = 36, 1 | 36 local itemButtonSize, itemButtonSpacing = 36, 1 |
| 37 local titleFont, textFont = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]] | 37 |
| 38 local titleSize, textSize = 16, 16 | 38 local headerHeight, headerColor, headerSpacing = 16, {1,1,1,1}, 2 |
| 39 local titlebg, textbg = {'HORIZONTAL', 1, 0, .7, .25, 1, 0, .7, .125}, {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 } | 39 local headerbg = {'VERTICAL', 1, 1, 0.5, 0.5, 1, 1, 0.5, 0} |
| 40 local titlebg_daily, textbg_daily = {'HORIZONTAL', 0, .7, 1, .25, 0, 1, .7, .125}, {'HORIZONTAL', 0, .7, 1, .1, 0, 1, .7, .075 } | 40 local headerFont, headerSize, headerOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 14, 'OUTLINE' |
| 41 local textbg_account,titlebg_account = {'HORIZONTAL', 0, .45, 1, .25, 0, .45, 1, .125}, {'HORIZONTAL', 0, .45, 1, 0.4, 0, .41, 1, .085 } | 41 |
| 42 local titlebg = {'HORIZONTAL', 1, 0, .7, .25, 1, 0, .7, .125} | |
| 43 local titlebg_daily = {'HORIZONTAL', 0, .7, 1, .25, 0, 1, .7, .125 } | |
| 44 local titlebg_account = {'HORIZONTAL', 0, .45, 1, .25, 0, .45, 1, .125} | |
| 45 local titleFont, titleSize, titleOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'OUTLINE' | |
| 46 | |
| 47 local textbg = {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 } | |
| 48 local textbg_daily = {'HORIZONTAL', 0, .7, 1, .1, 0, 1, .7, .075 } | |
| 49 local textbg_account = {'HORIZONTAL', 0, .45, 1, 0.4, 0, .41, 1, .085 } | |
| 50 local textFont, textSize, textOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]], 16, 'OUTLINE' | |
| 51 | |
| 52 | |
| 42 local selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225} | 53 local selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225} |
| 43 local titleOutline, textOutline = "OUTLINE", "OUTLINE" | |
| 44 local titleSpacing, textSpacing, blockSpacing = 3, 3, 1 | 54 local titleSpacing, textSpacing, blockSpacing = 3, 3, 1 |
| 45 local titleIndent, textIndent,selectionIndent = 2, 5, 50 | 55 local titleIndent, textIndent,selectionIndent = 2, 5, 50 |
| 56 | |
| 46 local wrapperMaxWidth, wrapperMaxHeight = 270, 490 -- these are the hard bounds, actual *Height variables are changed | 57 local wrapperMaxWidth, wrapperMaxHeight = 270, 490 -- these are the hard bounds, actual *Height variables are changed |
| 47 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE' | 58 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE' |
| 48 local headerFont, headerSize, headerHeight = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 18, 24 | |
| 49 local headerOutline, headerColor, headerSpacing = 'OUTLINE', {1,1,1,1}, 2 | |
| 50 local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0 } | 59 local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0 } |
| 51 local rewardSize = 32 | 60 local rewardSize = 32 |
| 52 local oprint = B.print('Objectives') | 61 local oprint = B.print('Objectives') |
| 53 local bprint = B.print('Block') | 62 local bprint = B.print('Block') |
| 54 local tprint = B.print('Tracker') | 63 local tprint = B.print('Tracker') |
| 175 | 184 |
| 176 block.Select = handler.Select | 185 block.Select = handler.Select |
| 177 block.Open = handler.Open | 186 block.Open = handler.Open |
| 178 block.Remove = handler.Remove | 187 block.Remove = handler.Remove |
| 179 block.Link = handler.Link | 188 block.Link = handler.Link |
| 180 block:SetScript('OnMouseUp', handler.OnMouseUp) | 189 block.clickZone:SetScript('OnMouseUp', function(self, ...) handler.OnMouseUp(block, ...) end) |
| 181 block:SetScript('OnMouseDown', handler.OnMouseDown) | 190 block.clickZone:SetScript('OnMouseDown', function(self, ...) handler.OnMouseDown(block, ...) end) |
| 182 block.attachmentHeight = 0 | 191 block.attachmentHeight = 0 |
| 183 block:ClearAllPoints() | 192 block:ClearAllPoints() |
| 184 | 193 |
| 185 B.SetConfigLayers(block) | 194 B.SetConfigLayers(block) |
| 186 | 195 |
| 228 block.attachmentHeight = 0 | 237 block.attachmentHeight = 0 |
| 229 block.endPoint = block.titlebg | 238 block.endPoint = block.titlebg |
| 230 local completionScore, completionMax = 0, 0 | 239 local completionScore, completionMax = 0, 0 |
| 231 local displayObjectiveHeader = false | 240 local displayObjectiveHeader = false |
| 232 | 241 |
| 233 if info.description and #info.description >= 1 then | |
| 234 print(' |cFF00FFFF header line:|r', info.description) | |
| 235 block.status:SetText(info.description) | |
| 236 displayObjectiveHeader = true | |
| 237 end | |
| 238 | 242 |
| 239 --- The first line is going to be used no matter what, so it is hard-pulled. | 243 --- The first line is going to be used no matter what, so it is hard-pulled. |
| 240 -- It also ensures that we're in the right position for cleaning up the leftover lines. | 244 -- It also ensures that we're in the right position for cleaning up the leftover lines. |
| 241 local lineIndex = 1 | 245 local lineIndex = 1 |
| 242 local line = T.GetLine(handler, block, lineIndex) | 246 local line = T.GetLine(handler, block, lineIndex) |
| 243 | 247 |
| 244 block.numLines = 0 | 248 block.numLines = 0 |
| 245 block.attachmentHeight = 0 | 249 block.attachmentHeight = 0 |
| 246 if info.isComplete then | 250 |
| 247 print(' overriding line #1 for a completed block') | 251 if info.description and #info.description >= 1 then |
| 252 print(' |cFF00FFFF header line:|r', info.description) | |
| 253 line.status:SetText(info.description) | |
| 254 line.height = floor(line.status:GetStringHeight()+.5) + textSpacing | |
| 248 if line.widget then | 255 if line.widget then |
| 249 line.widget:Hide() | 256 line.widget:Hide() |
| 250 end | 257 end |
| 258 T.AddLine(block, line) | |
| 259 | |
| 260 lineIndex = lineIndex + 1 | |
| 261 line = T.GetLine(handler, block, lineIndex) | |
| 262 end | |
| 263 | |
| 264 if (info.isComplete == true or info.isComplete == nil) and info.completionText then | |
| 265 print(' overriding line #1 for completion text:', info.completionText) | |
| 251 line.status:SetText(info.completionText) | 266 line.status:SetText(info.completionText) |
| 252 line.height = floor(line.status:GetHeight()+.5) + textSpacing | 267 line.height = floor(line.status:GetStringHeight()+.5) + textSpacing |
| 268 if line.widget then | |
| 269 line.widget:Hide() | |
| 270 end | |
| 253 T.AddLine(block, line) | 271 T.AddLine(block, line) |
| 254 else | 272 else |
| 255 if info.objectives then | 273 if info.objectives then |
| 256 for i, data in ipairs(info.objectives) do | 274 for i, data in ipairs(info.objectives) do |
| 257 print(' |cFF88FF00#', i, data.type, data.text) | 275 print(' |cFF88FF00#', i, data.type, data.text) |
| 496 | 514 |
| 497 Default.Update = function (self, reason, ...) | 515 Default.Update = function (self, reason, ...) |
| 498 local print = tprint | 516 local print = tprint |
| 499 local tracker = self.frame | 517 local tracker = self.frame |
| 500 local blockIndex = 0 | 518 local blockIndex = 0 |
| 501 local trackerHeight = floor(tracker.titlebg:GetHeight()+.5) | 519 local trackerHeight = headerHeight |
| 520 | |
| 521 tracker.title:SetFont(headerFont, headerSize, headerOutline) | |
| 522 tracker.titlebg:SetHeight(headerHeight) | |
| 523 tracker.title:SetTextColor(unpack(headerColor)) | |
| 524 --tracker.titlebg:SetGradientAlpha(unpack(headerbg)) | |
| 502 | 525 |
| 503 self.currentAnchor = tracker.titlebg | 526 self.currentAnchor = tracker.titlebg |
| 504 local numWatched = self:GetNumWatched() | 527 local numWatched = self:GetNumWatched() |
| 505 local numBlocks = self.numBlocks | 528 local numBlocks = self.numBlocks |
| 506 local actualBlocks = 0 | 529 local actualBlocks = 0 |
| 541 self.actualBlocks = actualBlocks | 564 self.actualBlocks = actualBlocks |
| 542 | 565 |
| 543 tracker.previousHeight = tracker.height | 566 tracker.previousHeight = tracker.height |
| 544 if numBlocks >= 1 then | 567 if numBlocks >= 1 then |
| 545 previousBlock = nil | 568 previousBlock = nil |
| 546 | 569 if tracker.isEmpty then |
| 570 tracker.headerFade:Play() | |
| 571 tracker.isEmpty = nil | |
| 572 end | |
| 547 tracker.height = trackerHeight | 573 tracker.height = trackerHeight |
| 548 tracker:SetHeight(tracker.height) | 574 tracker:SetHeight(tracker.height) |
| 549 tracker:Show() | 575 tracker:Show() |
| 550 | 576 else |
| 551 | 577 tracker.isEmpty = true |
| 552 else | |
| 553 tracker.height = 0 | 578 tracker.height = 0 |
| 554 tracker:Hide() | 579 tracker:Hide() |
| 555 end | 580 end |
| 556 | 581 |
| 557 return tracker.numWatched, tracker.numAll | 582 return tracker.numWatched, tracker.numAll |
