Mercurial > wow > buffalo2
comparison ObjectiveWidgets.lua @ 22:9b3fa734abff
ObjectiveFrame
- polish quest rewards display
- implement money objectives
- set line metrics in UpdateLine
- set block metrics in UpdateBlock (sum of line metrics)
| author | Nenue |
|---|---|
| date | Sat, 09 Apr 2016 07:32:45 -0400 |
| parents | d5ee940de273 |
| children |
comparison
equal
deleted
inserted
replaced
| 21:d5ee940de273 | 22:9b3fa734abff |
|---|---|
| 102 | 102 |
| 103 OnClick.QuestMapButton = function() | 103 OnClick.QuestMapButton = function() |
| 104 ToggleWorldMap() | 104 ToggleWorldMap() |
| 105 end | 105 end |
| 106 | 106 |
| 107 | |
| 107 mod.InitializeWidgets = function() | 108 mod.InitializeWidgets = function() |
| 108 --- tracker scroll | 109 --- tracker scroll |
| 109 Scroller:SetScript('OnMouseWheel', Scroller_OnMouseWheel) | 110 Scroller:SetScript('OnMouseWheel', Scroller_OnMouseWheel) |
| 110 Scroller:SetScript('OnShow', Scroller_OnShow) | 111 Scroller:SetScript('OnShow', Scroller_OnShow) |
| 111 Scroller:SetScript('OnHide', Scroller_OnHide) | 112 Scroller:SetScript('OnHide', Scroller_OnHide) |
| 212 if (rangeTimer) then | 213 if (rangeTimer) then |
| 213 rangeTimer = rangeTimer - elapsed | 214 rangeTimer = rangeTimer - elapsed |
| 214 if (rangeTimer <= 0) then | 215 if (rangeTimer <= 0) then |
| 215 local link, item, charges, showItemWhenComplete = GetQuestLogSpecialItemInfo(self.questLogIndex) | 216 local link, item, charges, showItemWhenComplete = GetQuestLogSpecialItemInfo(self.questLogIndex) |
| 216 if ((not charges) or (charges ~= self.charges)) then | 217 if ((not charges) or (charges ~= self.charges)) then |
| 217 mod.UpdateWrapper() | 218 mod:Update() |
| 218 return | 219 return |
| 219 end | 220 end |
| 220 | 221 |
| 221 local count = self.HotKey | 222 local count = self.HotKey |
| 222 local valid = IsQuestLogSpecialItemInRange(self.questLogIndex) | 223 local valid = IsQuestLogSpecialItemInRange(self.questLogIndex) |
| 380 mod.defaults.WidgetStyle = { | 381 mod.defaults.WidgetStyle = { |
| 381 | 382 |
| 382 } | 383 } |
| 383 | 384 |
| 384 local progressHeight = 16 | 385 local progressHeight = 16 |
| 385 local progressBorder = 2 | 386 local progressBorder = 1 |
| 386 local progressIndent = 3 | 387 local progressIndent = 3 |
| 387 local progressFont = _G.VeneerCriteriaFontNormal | 388 local progressFont = _G.VeneerCriteriaFontNormal |
| 388 | 389 |
| 389 | 390 |
| 390 mod.InitializeWidget.ProgressBar = function(self) | 391 mod.InitializeWidget.ProgressBar = function(self) |
| 395 | 396 |
| 396 self:SetHeight(progressHeight) | 397 self:SetHeight(progressHeight) |
| 397 self.bg:SetHeight(progressHeight) | 398 self.bg:SetHeight(progressHeight) |
| 398 self.bg:SetWidth(self.width) | 399 self.bg:SetWidth(self.width) |
| 399 self.fg:ClearAllPoints() | 400 self.fg:ClearAllPoints() |
| 400 self.fg:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', self.indent, self.indent) | 401 self.fg:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', progressBorder, progressBorder) |
| 401 self.fg:SetHeight(progressHeight - progressIndent * 2) | 402 self.fg:SetHeight(progressHeight - progressBorder * 2) |
| 402 self.status:SetFontObject(progressFont) | 403 self.status:SetFontObject(progressFont) |
| 403 self.status:SetText(self.objective.quantityString) | 404 self.status:SetText(self.objective.quantityString) |
| 404 end | 405 end |
| 405 | 406 |
| 406 mod.UpdateWidget.ProgressBar = function (self) | 407 mod.UpdateWidget.ProgressBar = function (self) |
| 415 end | 416 end |
| 416 | 417 |
| 417 local progress = (quantity / requiredQuantity) | 418 local progress = (quantity / requiredQuantity) |
| 418 if progress >= 1 then | 419 if progress >= 1 then |
| 419 self.fg:Show() | 420 self.fg:Show() |
| 420 self.fg:SetWidth(self.width - self.indent) | 421 self.fg:SetWidth(self.width - progressBorder * 2) |
| 421 elseif progress > 0 then | 422 elseif progress > 0 then |
| 422 self.fg:Show() | 423 self.fg:Show() |
| 423 print('color:', 1-progress*2 , progress*2 - 1,0,1) | 424 print('color:', 1-progress*2 , progress*2 - 1,0,1) |
| 424 print('width:', (self.width -self.indent) * progress) | 425 print('width:', (self.width -progressBorder * 2) * progress) |
| 425 self.fg:SetTexture(1-progress*2 , progress*2,0,1) | 426 self.fg:SetTexture(1-progress*2 , progress*2,0,1) |
| 426 self.fg:SetWidth((self.width -self.indent) * progress) | 427 self.fg:SetWidth((self.width -progressBorder * 2) * progress) |
| 427 else | 428 else |
| 428 self.fg:Hide() | 429 self.fg:Hide() |
| 429 end | 430 end |
| 430 end | 431 end |
| 431 | 432 |
