Mercurial > wow > buffalo2
comparison ObjectiveFrame.lua @ 13:9455693fc290
Init
- recall XML display state on reload
ObjectiveFrame
- quest coloring by relative level
- quest coloring by daily/weekly/complete status
- remember starting scroll value between reload
- limit anchor points to edges for regions affected by style attributes
ObjectiveInfo
- AutoQuest outline definitions
- Pull Quest title and tag data in addition to WatchInfo
ObjectiveStyle
- ensure consistent style table
- hardcode certain attributes for sanity
XML
- ensure consistent naming conventions for heading and content elements
- ensure hardcore anchors are based on edges
- expansion of file structure to deal with complexities of dynamic widgets and style caching
ObjectiveUI
- determine primary style by block handler when restoring original style
- moved framescript to 'ObjectiveWidgets' lua
author | Nenue |
---|---|
date | Sat, 02 Apr 2016 17:46:52 -0400 |
parents | 8238cddaddb1 |
children | ed642234f017 |
comparison
equal
deleted
inserted
replaced
12:8238cddaddb1 | 13:9455693fc290 |
---|---|
8 local ipairs, max, min, unpack, floor, pairs, tostring, type = ipairs, max, min, unpack, floor, pairs, tostring, type | 8 local ipairs, max, min, unpack, floor, pairs, tostring, type = ipairs, max, min, unpack, floor, pairs, tostring, type |
9 local IsResting, UnitXP, UnitXPMax, GetXPExhaustion = IsResting, UnitXP, UnitXPMax, GetXPExhaustion | 9 local IsResting, UnitXP, UnitXPMax, GetXPExhaustion = IsResting, UnitXP, UnitXPMax, GetXPExhaustion |
10 local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent | 10 local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent |
11 local CreateFrame = CreateFrame | 11 local CreateFrame = CreateFrame |
12 local print = B.print('Objectives') | 12 local print = B.print('Objectives') |
13 local unitLevel = 1 | |
13 -------------------------------------------------------------------- | 14 -------------------------------------------------------------------- |
14 --- Global frame layout | 15 --- Global frame layout |
15 -------------------------------------------------------------------- | 16 -------------------------------------------------------------------- |
16 | 17 |
17 --- Upvalues | 18 --- Upvalues |
75 | 76 |
76 mod.UpdateActionButtons('SCROLLING') | 77 mod.UpdateActionButtons('SCROLLING') |
77 end | 78 end |
78 | 79 |
79 local WrapperCloseButton_OnClick = function(self) | 80 local WrapperCloseButton_OnClick = function(self) |
80 if Scroller:IsVisible() then | 81 Wrapper:Minimize() |
81 Scroller:Hide() | 82 if B.Conf.FrameState[Wrapper:GetName()] == 1 then |
82 else | 83 self:GetNormalTexture():SetTexture([[Interface\PaperDollInfoFrame\UI-Character-SkillsPageDown-Up]]) |
83 Scroller:Show() | 84 self:GetPushedTexture():SetTexture([[Interface\PaperDollInfoFrame\UI-Character-SkillsPageDown-Down]]) |
84 end | 85 else |
86 self:GetNormalTexture():SetTexture([[Interface\PaperDollInfoFrame\UI-Character-SkillsPageUp-Up]]) | |
87 self:GetPushedTexture():SetTexture([[Interface\PaperDollInfoFrame\UI-Character-SkillsPageUp-Down]]) | |
88 end | |
89 end | |
90 local WrapperCloseButton_OnMouseWheel = function(self, delta) | |
85 end | 91 end |
86 | 92 |
87 mod.InitializeTrackers = function() | 93 mod.InitializeTrackers = function() |
88 | 94 |
89 | 95 |
110 Scroller:SetScrollChild(Scroll) | 116 Scroller:SetScrollChild(Scroll) |
111 Scroller:SetScript('OnMouseWheel', Scroller_OnMouseWheel) | 117 Scroller:SetScript('OnMouseWheel', Scroller_OnMouseWheel) |
112 Scroller:SetScript('OnShow', Scroller_OnShow) | 118 Scroller:SetScript('OnShow', Scroller_OnShow) |
113 Scroller:SetScript('OnHide', Scroller_OnHide) | 119 Scroller:SetScript('OnHide', Scroller_OnHide) |
114 Wrapper.close:SetScript('OnClick', WrapperCloseButton_OnClick) | 120 Wrapper.close:SetScript('OnClick', WrapperCloseButton_OnClick) |
121 Wrapper.close:SetScript('OnMouseWheel', WrapperCloseButton_OnMouseWheel) | |
115 Wrapper:SetPoint(unpack(wrapperPosition)) | 122 Wrapper:SetPoint(unpack(wrapperPosition)) |
116 Scroller_OnShow(Scroller) | 123 if B.Conf.ObjectiveTrackerMinimized then |
117 | 124 Scroller_OnShow(Scroller) |
125 end | |
118 mod.UpdateWrapperStyle() | 126 mod.UpdateWrapperStyle() |
119 end | 127 end |
120 | 128 |
121 mod.InitializeXPTracker = function() | 129 mod.InitializeXPTracker = function() |
122 local XPBar = Wrapper.XPBar | 130 local XPBar = Wrapper.XPBar |
285 if info.isComplete then | 293 if info.isComplete then |
286 mainStyle = 'Complete' | 294 mainStyle = 'Complete' |
287 end | 295 end |
288 if info.superTracked then | 296 if info.superTracked then |
289 subStyle = 'Super' | 297 subStyle = 'Super' |
298 elseif info.isDaily then | |
299 subStyle = 'Daily' | |
290 end | 300 end |
291 | 301 |
292 if info.specialItem and not info.itemButton then | 302 if info.specialItem and not info.itemButton then |
293 print(' - |cFF00FFFFgenerating item button for info set') | 303 print(' - |cFF00FFFFgenerating item button for info set') |
294 info.itemButton = mod.SetItemButton(t, info) | 304 info.itemButton = mod.SetItemButton(t, info) |
295 else | 305 else |
296 --info.itemButton = nil | 306 --info.itemButton = nil |
297 end | 307 end |
298 | 308 |
309 if info.level then | |
310 local levelDiff = unitLevel - info.level | |
311 if levelDiff > 9 then | |
312 t.title:SetTextColor(0.7, 0.7, 0.7, 1) | |
313 elseif levelDiff > 1 then | |
314 t.title:SetTextColor(0.5, 1, 0.5, 1) | |
315 elseif levelDiff < -1 then | |
316 t.title:SetTextColor(1, 0.4, 0.25, 1) | |
317 elseif levelDiff < -4 then | |
318 t.title:SetTextColor(1, 0, 0, 1) | |
319 else | |
320 t.title:SetTextColor(1,1,1,1) | |
321 end | |
322 end | |
323 | |
324 | |
299 if Devian and Devian.InWorkspace() then | 325 if Devian and Devian.InWorkspace() then |
300 t.debugText:Show() | 326 t.debugText:Show() |
301 t.debugText:SetText(tostring(blockIndex) .. '\n' .. tostring(info.itemButton and info.itemButton:GetName())) | 327 t.debugText:SetText(tostring(blockIndex) .. '\n' .. tostring(info.itemButton and info.itemButton:GetName()) .. "\n" .. (info.level and info.level or '-')) |
302 end | 328 end |
303 | 329 |
304 --- metrics are calculated in SetStyle | 330 --- metrics are calculated in SetStyle |
305 t:SetStyle('TrackerBlock', handler.name, mainStyle, subStyle) | 331 t:SetStyle('TrackerBlock', handler.name, mainStyle, subStyle) |
306 t:Show() | 332 t:Show() |
438 | 464 |
439 mod.Quest.numButtons = 0 | 465 mod.Quest.numButtons = 0 |
440 local usedButtons = mod.Quest.itemButtons | 466 local usedButtons = mod.Quest.itemButtons |
441 local freeButtons = mod.Quest.freeButtons | 467 local freeButtons = mod.Quest.freeButtons |
442 mod.UpdateWrapper = function() | 468 mod.UpdateWrapper = function() |
469 unitLevel = UnitLevel('player') | |
443 wrapperWidth = wrapperMaxWidth | 470 wrapperWidth = wrapperMaxWidth |
444 scrollWidth = wrapperWidth | 471 scrollWidth = wrapperWidth |
445 local wrapperBlocks = 0 | 472 local wrapperBlocks = 0 |
446 -- Update scroll child vertical size | 473 -- Update scroll child vertical size |
447 scrollHeight = 0 | 474 scrollHeight = 0 |
496 mod.SetBlockStyle(Scroller, 'Scroller', 'Normal') | 523 mod.SetBlockStyle(Scroller, 'Scroller', 'Normal') |
497 mod.SetBlockStyle(Scroller, 'Scroll', 'Normal') | 524 mod.SetBlockStyle(Scroller, 'Scroll', 'Normal') |
498 mod.SetBlockStyle(Wrapper, 'Wrapper', 'Normal') | 525 mod.SetBlockStyle(Wrapper, 'Wrapper', 'Normal') |
499 | 526 |
500 Scroller:SetSize(wrapperWidth, wrapperHeight) | 527 Scroller:SetSize(wrapperWidth, wrapperHeight) |
501 Scroller:SetPoint('TOPLEFT', Wrapper, 'TOPLEFT', 0, -headerHeight) | 528 Scroller:SetPoint('TOPLEFT', Wrapper, 'TOPLEFT', 0, 0) |
502 Scroller:SetPoint('BOTTOMRIGHT', Wrapper, 'BOTTOMRIGHT') | 529 Scroller:SetPoint('BOTTOMRIGHT', Wrapper, 'BOTTOMRIGHT') |
503 | 530 |
504 | 531 |
505 Scroll:SetSize(scrollWidth, scrollHeight) | 532 Scroll:SetSize(scrollWidth, scrollHeight) |
506 Scroll:SetPoint('TOPLEFT', Scroller, 'TOPLEFT', 0, B.Conf.ObjectiveScroll or 0) | 533 Scroll:SetPoint('TOPLEFT', Scroller, 'TOPLEFT', 0, B.Conf.ObjectiveScroll or 0) |
507 Scroll:SetPoint('RIGHT', Scroller, 'RIGHT') | 534 Scroll:SetPoint('RIGHT', Scroller, 'RIGHT') |
508 | 535 |
509 --Scroller:UpdateScrollChildRect() | 536 --Scroller:UpdateScrollChildRect() |
510 Wrapper:SetSize(wrapperWidth, wrapperHeight + headerHeight) | 537 Wrapper:SetSize(wrapperWidth, wrapperHeight) |
511 | 538 |
512 -- update action buttons | 539 -- update action buttons |
513 print('|cFF00FF00'..Scroll:GetName()..'|r:', Scroll:GetWidth(), Scroll:GetHeight(), | 540 print('|cFF00FF00'..Scroll:GetName()..'|r:', Scroll:GetWidth(), Scroll:GetHeight(), |
514 '|cFF00FF00'..Scroller:GetName()..'|r:', Scroller:GetWidth(), Scroller:GetHeight(), | 541 '|cFF00FF00'..Scroller:GetName()..'|r:', Scroller:GetWidth(), Scroller:GetHeight(), |
515 '|cFF00FF00'..Wrapper:GetName()..'|r:', Wrapper:GetWidth(), Wrapper:GetHeight(), | 542 '|cFF00FF00'..Wrapper:GetName()..'|r:', Wrapper:GetWidth(), Wrapper:GetHeight(), |