Mercurial > wow > buffalo2
comparison ObjectiveStyle.lua @ 18:d1812fb10ae6
ObjectiveStyle
- move tag/template logic into the corresponding GetInfo
| author | Nenue |
|---|---|
| date | Tue, 05 Apr 2016 02:38:01 -0400 |
| parents | c33497b116d6 |
| children | 605e8f0e46db |
comparison
equal
deleted
inserted
replaced
| 17:c33497b116d6 | 18:d1812fb10ae6 |
|---|---|
| 6 --- | 6 --- |
| 7 | 7 |
| 8 local titleFont, textFont = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]] | 8 local titleFont, textFont = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]] |
| 9 local titleSize, textSize = 16, 15 | 9 local titleSize, textSize = 16, 15 |
| 10 local titleOutline, textOutline = "OUTLINE", "OUTLINE" | 10 local titleOutline, textOutline = "OUTLINE", "OUTLINE" |
| 11 local titleSpacing, textSpacing = 3, 1 | 11 local titleSpacing, textSpacing = 3, 3 |
| 12 local unpack, type, pairs, tconcat = unpack, type, pairs, table.concat | 12 local unpack, type, pairs, tconcat = unpack, type, pairs, table.concat |
| 13 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE' | 13 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE' |
| 14 local headerFont, headerSize = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 24 | 14 local headerFont, headerSize = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 24 |
| 15 local headerOutline, headerSpacing = 'OUTLINE', 2 | 15 local headerOutline, headerSpacing = 'OUTLINE', 2 |
| 16 | 16 |
| 91 }, | 91 }, |
| 92 TrackerBlock = { | 92 TrackerBlock = { |
| 93 Normal = { | 93 Normal = { |
| 94 titlebg = { | 94 titlebg = { |
| 95 Indent = 2, | 95 Indent = 2, |
| 96 Gradient = { 'HORIZONTAL', MinColor = {0.2, .4, 1, 0}, MaxColor = {.7, 0, 0.9, .14}}, | 96 Gradient = { 'HORIZONTAL', MinColor = {0.7, 0, 0.9, 0}, MaxColor = {.7, 0, 0.9, .25}}, |
| 97 }, | 97 }, |
| 98 title = { | 98 title = { |
| 99 TextColor = {1,1,1,0.5}, | 99 TextColor = {1,1,1,0.8}, |
| 100 Font = {titleFont, titleSize, titleOutline}, | |
| 101 Spacing = titleSpacing, | |
| 102 }, | |
| 103 status = { | |
| 104 TextColor = {1,1,1,0.8}, | |
| 105 Font = {textFont, textSize, textOutline}, | |
| 106 Spacing = textSpacing, | |
| 107 }, | |
| 108 statusbg = { | |
| 109 Gradient = { 'HORIZONTAL', MinColor = {0.2, .4, 1, 0}, MaxColor = {.7, 0, 0.9, .11}}, | |
| 110 } | |
| 111 }, | |
| 112 Daily = { | |
| 113 titlebg = { | |
| 114 Gradient = {'HORIZONTAL', MinColor = {0, .4, 1, 0}, MaxColor = {0, 0.4, 1, .35}, }, | |
| 115 }, | |
| 116 statusbg = { | |
| 117 Gradient = {'HORIZONTAL', MinColor = {0, .4, 1, 0}, MaxColor = {0, 0.35, .90, .31}, }, | |
| 118 }, | |
| 119 title = { | |
| 120 TextColor = {0.7,1,1,1}, | |
| 100 Font = {titleFont, titleSize, titleOutline}, | 121 Font = {titleFont, titleSize, titleOutline}, |
| 101 Spacing = titleSpacing, | 122 Spacing = titleSpacing, |
| 102 }, | 123 }, |
| 103 status = { | 124 status = { |
| 104 TextColor = {1,1,1,0.5}, | 125 TextColor = {1,1,1,0.5}, |
| 105 Font = {textFont, textSize, textOutline}, | 126 Font = {textFont, textSize, textOutline}, |
| 106 Spacing = textSpacing, | 127 Spacing = textSpacing, |
| 107 }, | 128 }, |
| 108 statusbg = { | |
| 109 Gradient = { 'HORIZONTAL', MinColor = {0.2, .4, 1, 0}, MaxColor = {.7, 0, 0.9, .11}}, | |
| 110 } | |
| 111 }, | 129 }, |
| 112 Super = { | 130 Super = { |
| 113 title = { | 131 title = { |
| 114 TextColor = {1,1,1,1}, | 132 TextColor = {1,1,1,1}, |
| 115 Font = {titleFont, titleSize, titleOutline}, | 133 Font = {titleFont, titleSize, titleOutline}, |
| 156 Font = {textFont, textSize, textOutline}, Spacing = textSpacing, | 174 Font = {textFont, textSize, textOutline}, Spacing = textSpacing, |
| 157 }, | 175 }, |
| 158 statusbg = { | 176 statusbg = { |
| 159 Gradient = {'HORIZONTAL', MinColor = {0, 1, 0, 0}, MaxColor = {0, 1, 0, .25}, }, | 177 Gradient = {'HORIZONTAL', MinColor = {0, 1, 0, 0}, MaxColor = {0, 1, 0, .25}, }, |
| 160 } | 178 } |
| 161 }, | |
| 162 Daily = { | |
| 163 titlebg = { | |
| 164 Gradient = {'HORIZONTAL', MinColor = {0, .4, 1, 0.34}, MaxColor = {0, 0.4, 1, .17}, }, | |
| 165 }, | |
| 166 statusbg = { | |
| 167 Gradient = {'HORIZONTAL', MinColor = {0, .4, 1, 0.25}, MaxColor = {0, 0.4, 1, .12}, }, | |
| 168 }, | |
| 169 }, | 179 }, |
| 170 AutoQuest = { | 180 AutoQuest = { |
| 171 Normal = { | 181 Normal = { |
| 172 titlebg = { | 182 titlebg = { |
| 173 Indent = 2, | 183 Indent = 2, |
| 361 end | 371 end |
| 362 style_cache_func[styleName](frame) | 372 style_cache_func[styleName](frame) |
| 363 | 373 |
| 364 --- Hardcoding the sizing vars for sanity | 374 --- Hardcoding the sizing vars for sanity |
| 365 local normalSettings = mod.defaults.Style.Format | 375 local normalSettings = mod.defaults.Style.Format |
| 366 frame.titleHeight = frame.title and (frame.title:GetStringHeight() + (frame.title.spacing or 0)*2) or 0 | |
| 367 frame.statusHeight = frame.status and (frame.status:GetStringHeight() + (frame.status.spacing or 0)*2) or 0 | |
| 368 frame.height = frame.titleHeight + frame.statusHeight + (frame.attachmentHeight or 0) | |
| 369 frame.width = normalSettings.Frame.Width | 376 frame.width = normalSettings.Frame.Width |
| 370 frame.statusWidth = frame.width - normalSettings.status.Indent | 377 frame.statusWidth = frame.width - normalSettings.status.Indent |
| 371 frame.titleWidth = frame.width - normalSettings.title.Indent | 378 frame.titleWidth = frame.width - normalSettings.title.Indent |
| 372 | 379 |
| 373 print((frame.status and frame.status:GetText())) | |
| 374 print((frame.status and frame.status:GetWidth())) | |
| 375 print(frame.status and frame.title:GetStringHeight()) | |
| 376 print(frame.title and (frame.title:GetStringHeight() + (frame.title.spacing or 0)*2) or 0) | |
| 377 print(frame.status and frame.status:GetStringHeight()) | |
| 378 print(frame.status and (frame.status:GetStringHeight() + (frame.status.spacing or 0)*2) or 0) | |
| 379 if frame.status then | |
| 380 print('status ', frame.statusHeight, normalSettings.status.Indent, 0, 'statusbg', frame.statusHeight) | |
| 381 frame.status:SetWidth(frame.width) | |
| 382 frame.status:SetPoint('LEFT', frame, 'LEFT', normalSettings.status.Indent, 0) | |
| 383 frame.status:SetPoint('TOP', frame, 'TOP', 0, -frame.status.spacing) | |
| 384 --frame.status:SetHeight(frame.statusHeight) | |
| 385 if frame.statusbg then | |
| 386 | |
| 387 frame.statusbg:SetHeight(frame.statusHeight + frame.status.spacing * 2) | |
| 388 frame.statusbg:SetWidth(frame.width) | |
| 389 end | |
| 390 end | |
| 391 if frame.title then | 380 if frame.title then |
| 392 print('title ',frame.titleHeight, normalSettings.title.Indent, 'titlebg',frame.titleHeight) | 381 frame.titleHeight = frame.title and (frame.title:GetStringHeight() + (frame.title.spacing or 0)*2) or 0 |
| 382 frame.title.spacing = frame.title.spacing or frame.title:GetSpacing() | |
| 393 frame.title:SetPoint('LEFT', frame, 'LEFT', normalSettings.title.Indent) | 383 frame.title:SetPoint('LEFT', frame, 'LEFT', normalSettings.title.Indent) |
| 394 frame.title:SetPoint('TOP', frame, 'TOP', 0, -frame.title.spacing) | 384 frame.title:SetPoint('TOP', frame, 'TOP', 0, -frame.title.spacing) |
| 395 frame.title:SetWidth(frame.width) | 385 frame.title:SetWidth(frame.width) |
| 396 if frame.titlebg then | 386 if frame.titlebg then |
| 397 frame.titlebg:SetHeight(frame.titleHeight + frame.title.spacing * 2) | 387 frame.titlebg:SetHeight(frame.titleHeight) |
| 398 frame.titlebg:SetWidth(frame.width) | 388 frame.titlebg:SetWidth(frame.width) |
| 399 end | 389 end |
| 390 print(' title, textHeight', frame.titleHeight, 'indent', normalSettings.title.Indent, 'spacing', frame.title.spacing) | |
| 391 else | |
| 392 frame.titleHeight = 0 | |
| 400 end | 393 end |
| 394 | |
| 395 if frame.status then | |
| 396 frame.statusHeight = frame.status and (frame.status:GetStringHeight() + (frame.status.spacing or 0)*2) or 0 | |
| 397 frame.status.spacing = frame.status.spacing or frame.status:GetSpacing() | |
| 398 frame.status:SetWidth(frame.width) | |
| 399 frame.status:SetPoint('LEFT', frame, 'LEFT', normalSettings.status.Indent, 0) | |
| 400 frame.status:SetPoint('TOPLEFT', frame.titlebg, 'BOTTOMLEFT', normalSettings.status.Indent, -frame.status.spacing) | |
| 401 --frame.status:SetHeight(frame.statusHeight) | |
| 402 if frame.statusbg then | |
| 403 | |
| 404 frame.statusbg:SetHeight(frame.statusHeight) | |
| 405 frame.statusbg:SetWidth(frame.width) | |
| 406 end | |
| 407 print(' status, textHeight', frame.statusHeight, 'indent', normalSettings.status.Indent, 'spacing', frame.status.spacing) | |
| 408 else | |
| 409 frame.statusHeight = 0 | |
| 410 end | |
| 411 | |
| 412 frame.height = frame.titleHeight + frame.statusHeight + (frame.attachmentHeight or 0) | |
| 401 frame:SetSize(frame.width, frame.height) | 413 frame:SetSize(frame.width, frame.height) |
| 402 print('sizing frame', frame.width, frame.height) | 414 print(' sizing frame', frame.width, frame.height) |
| 403 --[[ | 415 end |
| 404 local titleSpacing, titleSpacing2 = c.Title.Spacing, (c.Title.Spacing * 2) | |
| 405 local textSpacing, textSpacing2 = c.Text.Spacing, (c.Text.Spacing * 2) | |
| 406 | |
| 407 block.title:SetSpacing(titleSpacing) | |
| 408 block.objectives:SetSpacing(textSpacing) | |
| 409 block.objectives:SetWordWrap(true) | |
| 410 | |
| 411 local titleHeight, textHeight = block.title:GetStringHeight(), block.objectives:GetStringHeight() + block.attachmentHeight | |
| 412 local blockHeight = titleHeight + titleSpacing2 + textHeight + textSpacing2 | |
| 413 local blockWidth = wrapperMaxWidth | |
| 414 | |
| 415 block.titlebg:SetSize(min(w1, w2), titleHeight + titleSpacing2) | |
| 416 block.bg:SetSize(w1, textHeight + textSpacing2) | |
| 417 block:SetSize(blockWidth, blockHeight) | |
| 418 | |
| 419 block.title:SetPoint('TOPLEFT', block.titlebg, 'TOPLEFT', 0, -titleSpacing) | |
| 420 block.objectives:SetPoint('TOPLEFT', block.titlebg, 'BOTTOMLEFT', textIndent, -textSpacing) | |
| 421 | |
| 422 -- store | |
| 423 block.titleHeight = titleHeight | |
| 424 block.textHeight = textHeight | |
| 425 block.width = blockWidth | |
| 426 block.height = blockHeight | |
| 427 --]] | |
| 428 --print(' |cFF00FFFF'..block:GetName()..'|r:|cFF0088FFSetStyle|r(', blockWidth, 'x', blockHeight, '(textH', textHeight,', titleH', titleHeight, ')') | |
| 429 end | |
| 430 local segments = {'Left', 'Right', 'Tile' } | |
| 431 local Wrapper = _G.VeneerObjectiveWrapper | |
| 432 mod.UpdateWrapperStyle = function() | 416 mod.UpdateWrapperStyle = function() |
| 433 local c = mod.Conf.Wrapper | 417 local c = mod.Conf.Wrapper |
| 434 --Wrapper:ClearAllPoints() | 418 --Wrapper:ClearAllPoints() |
| 435 --Wrapper:SetPoint(c.WrapperPoint, UIParent, c.WrapperPoint, c.WrapperFloatX, c.WrapperFloatY) | 419 --Wrapper:SetPoint(c.WrapperPoint, UIParent, c.WrapperPoint, c.WrapperFloatX, c.WrapperFloatY) |
| 436 end | |
| 437 | |
| 438 mod.Tracker.SetBlockTags = function(block, info) | |
| 439 if info.isComplete then | |
| 440 block.mainStyle = 'Complete' | |
| 441 end | |
| 442 if info.superTracked then | |
| 443 block.subStyle = 'Super' | |
| 444 elseif info.isDaily then | |
| 445 block.subStyle = 'Daily' | |
| 446 end | |
| 447 end | |
| 448 local unitLevel = UnitLevel('player') | |
| 449 mod.Quest.SetBlockTags = function(block, info) | |
| 450 | |
| 451 mod.Tracker.SetBlockTags(block, info) | |
| 452 if info.level then | |
| 453 local levelDiff = unitLevel - info.level | |
| 454 if levelDiff > 9 then | |
| 455 block.title:SetTextColor(0.7, 0.7, 0.7, 1) | |
| 456 elseif levelDiff > 1 then | |
| 457 block.title:SetTextColor(0.5, 1, 0.5, 1) | |
| 458 elseif levelDiff < -1 then | |
| 459 block.title:SetTextColor(1, 0.4, 0.25, 1) | |
| 460 elseif levelDiff < -4 then | |
| 461 block.title:SetTextColor(1, 0, 0, 1) | |
| 462 else | |
| 463 block.title:SetTextColor(1,1,1,1) | |
| 464 end | |
| 465 end | |
| 466 end | |
| 467 mod.Cheevs.SetBlockTags = function(block, info) | |
| 468 mod.Tracker.SetBlockTags(block, info) | |
| 469 end | 420 end |
| 470 | 421 |
| 471 --- Argument containers | 422 --- Argument containers |
| 472 local o -- text flag | 423 local o -- text flag |
| 473 local a1, a2, a3, a4, b1, b2, b3, b4 -- color1, color2 | 424 local a1, a2, a3, a4, b1, b2, b3, b4 -- color1, color2 |
