Mercurial > wow > buffalo2
comparison ObjectiveTracker/Frame.lua @ 32:a3afe6c3771e
- organize and display reward icons as a background hint
- centralize reward data function
| author | Nenue |
|---|---|
| date | Fri, 15 Apr 2016 07:01:40 -0400 |
| parents | 48b3e3959a0a |
| children | 64f2a9bbea79 |
comparison
equal
deleted
inserted
replaced
| 31:48b3e3959a0a | 32:a3afe6c3771e |
|---|---|
| 77 } | 77 } |
| 78 | 78 |
| 79 local wrapperMaxWidth, wrapperMaxHeight = 270, 490 -- these are the hard bounds, actual *Height variables are changed | 79 local wrapperMaxWidth, wrapperMaxHeight = 270, 490 -- these are the hard bounds, actual *Height variables are changed |
| 80 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE' | 80 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE' |
| 81 local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0 } | 81 local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0 } |
| 82 local rewardSize = 32 | 82 local rewardSize = 24 |
| 83 local oprint = B.print('Objectives') | 83 local oprint = B.print('Objectives') |
| 84 local bprint = B.print('Block') | 84 local bprint = B.print('Block') |
| 85 local tprint = B.print('Tracker') | 85 local tprint = B.print('Tracker') |
| 86 local lprint = B.print('Line') | 86 local lprint = B.print('Line') |
| 87 | 87 |
| 246 | 246 |
| 247 block.SelectionOverlay:SetGradientAlpha(unpack(Module.colors.default.selectionbg)) | 247 block.SelectionOverlay:SetGradientAlpha(unpack(Module.colors.default.selectionbg)) |
| 248 block.SelectionOverlay:SetPoint('TOPLEFT', selectionIndent, 0) | 248 block.SelectionOverlay:SetPoint('TOPLEFT', selectionIndent, 0) |
| 249 block.SelectionOverlay:SetPoint('BOTTOMRIGHT') | 249 block.SelectionOverlay:SetPoint('BOTTOMRIGHT') |
| 250 | 250 |
| 251 block.icon:SetSize(rewardSize, rewardSize) | 251 --block.icon:SetSize(rewardSize, rewardSize) |
| 252 block.icon:SetPoint('TOPRIGHT', block, 'TOPRIGHT', -2, -2) | 252 --block.icon:SetPoint() |
| 253 local anchor, target, point, x, y = 'TOPRIGHT', block, 'TOPRIGHT', -2, -2 | |
| 254 for i, tile in ipairs(block.rewardTile) do | |
| 255 print(rewardSize) | |
| 256 tile:SetSize(rewardSize, rewardSize) | |
| 257 tile:ClearAllPoints() | |
| 258 tile:SetPoint(anchor, target, point, x, y) | |
| 259 block.rewardLabel[i]:SetPoint('TOP', tile, 'TOP', 0, -2) | |
| 260 anchor, target, point, x, y = 'TOPRIGHT', tile, 'TOPLEFT', -2, 0 | |
| 261 end | |
| 253 | 262 |
| 254 | 263 |
| 255 --- methods for event handlers | 264 --- methods for event handlers |
| 256 | 265 |
| 257 block.Select = handler.Select | 266 block.Select = handler.Select |
| 526 info.itemButton = Module.SetItemButton(block, info) | 535 info.itemButton = Module.SetItemButton(block, info) |
| 527 else | 536 else |
| 528 --info.itemButton = nil | 537 --info.itemButton = nil |
| 529 end | 538 end |
| 530 | 539 |
| 531 local tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', block, 'TOPRIGHT' | 540 local tagPoint, tagAnchor, tagRelative, x, y = 'TOPRIGHT', block, 'TOPRIGHT', -2, -2 |
| 532 | 541 |
| 533 if info.rewardInfo then | 542 local numCurrency = 0 |
| 534 print('has immediate reward') | 543 for i, rewardTile in ipairs(block.rewardTile) do |
| 535 if info.rewardInfo[1].type == 'currency' or info.rewardInfo[1].type == 'item' then | 544 local reward = info.rewardInfo[i] |
| 536 block.icon:Show() | 545 if reward then |
| 537 block.iconLabel:SetText(info.rewardInfo[1].count) | 546 --rewardTile:SetPoint(tagPoint, tagAnchor, tagRelative, -2, -2) |
| 538 block.icon:SetPoint(tagPoint, tagAnchor, tagRelative, -2, -2) | 547 rewardTile:SetTexture(reward.texture) |
| 539 tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', block.icon, 'TOPLEFT' | 548 rewardTile:Show() |
| 540 block.icon:SetTexture(info.rewardInfo[1].texture) | 549 |
| 541 end | 550 print('updating reward tile #'.. i, reward.type, reward.count, reward.text, reward.texture) |
| 542 else | 551 if reward.count and reward.count > 1 then |
| 543 block.icon:Hide() | 552 block.rewardLabel[i]:SetText(reward.count) |
| 553 block.rewardLabel[i]:Show() | |
| 554 end | |
| 555 | |
| 556 rewardTile:ClearAllPoints() | |
| 557 rewardTile:SetPoint(tagPoint, tagAnchor, tagRelative, x, y) | |
| 558 tagPoint, tagAnchor, tagRelative, x, y = 'TOPRIGHT', rewardTile, 'TOPLEFT', -2, 0 | |
| 559 else | |
| 560 rewardTile:Hide() | |
| 561 block.rewardLabel[i]:Hide() | |
| 562 end | |
| 544 end | 563 end |
| 545 | 564 |
| 546 if info.selected then | 565 if info.selected then |
| 547 block.SelectionOverlay:Show() | 566 block.SelectionOverlay:Show() |
| 548 else | 567 else |
| 576 | 595 |
| 577 local displayObjectiveHeader = false | 596 local displayObjectiveHeader = false |
| 578 | 597 |
| 579 block.attachmentHeight = 0 | 598 block.attachmentHeight = 0 |
| 580 local text, attachment, template | 599 local text, attachment, template |
| 581 if info.statusKey and (Devian and Devian.InWorkspace()) then | |
| 582 handler:AddLine(block, info.statusKey, nil) | |
| 583 end | |
| 584 | 600 |
| 585 | 601 |
| 586 if info.description and #info.description >= 1 then | 602 if info.description and #info.description >= 1 then |
| 587 print(' |cFF00FFFF header line:|r', info.description) | 603 print(' |cFF00FFFF header line:|r', info.description) |
| 588 text = info.description | 604 text = info.description |
| 605 | 621 |
| 606 end | 622 end |
| 607 end | 623 end |
| 608 end | 624 end |
| 609 | 625 |
| 626 if info.statusKey and (Devian and Devian.InWorkspace()) then | |
| 627 handler:AddLine(block, info.statusKey, nil) | |
| 628 end | |
| 629 | |
| 610 for i = block.currentLine + 1, block.numLines do | 630 for i = block.currentLine + 1, block.numLines do |
| 611 print(i, block.numLines) | 631 print(i, block.numLines) |
| 612 print(' - hide |cFFFF0088'..i..'|r', block.lines[i]) | 632 print(' - hide |cFFFF0088'..i..'|r', block.lines[i]) |
| 613 block.lines[i]:ClearAllPoints() | 633 block.lines[i]:ClearAllPoints() |
| 614 block.lines[i]:Hide() | 634 block.lines[i]:Hide() |
