Skip to content

Commit

Permalink
Applied a round of polishing to the Breakdown Window
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Mar 3, 2024
1 parent ca192bb commit b1a7c5e
Show file tree
Hide file tree
Showing 14 changed files with 246 additions and 34 deletions.
4 changes: 3 additions & 1 deletion Definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@
---@field GetMSTime fun(combat: combat) : number, number
---@field GetSegmentSlotId fun(combat: combat) : segmentid
---@field GetCombatName fun(combat: combat, bOnlyName: boolean?, bTryFind: boolean?) : string, number?, number?, number?, number? get the name of the combat
---@field GetCombatIcon fun(combat: combat) : df_atlasinfo
---@field GetCombatIcon fun(combat: combat) : df_atlasinfo, df_atlasinfo?
---@field GetTrinketProcsForPlayer fun(self: combat, playerName: string) : table<spellid, trinketprocdata> return a key|value table containing the spellId as key and a table with information about the trinket as value
---@field IsMythicDungeon fun(combat: combat) : boolean, number return a boolean indicating if the combat is from a mythic+ dungeon, if true, also return the runId
---@field GetMythicDungeonInfo fun(combat: combat) : mythicdungeoninfo
Expand Down Expand Up @@ -546,6 +546,7 @@
---@class breakdownsegmentline : button
---@field segmentText df_label
---@field segmentIcon df_image
---@field segmentSubIcon df_image
---@field UpdateLine function
---@field combatUniqueID uniquecombatid
---@field isSelected boolean
Expand All @@ -554,6 +555,7 @@
---@field UID uniquecombatid
---@field combatName string
---@field combatIcon df_atlasinfo
---@field combatIcon2 df_atlasinfo? used for the second icon in the segment line, this shows the trash or boss icon where the primary icon shows the mythic+ icon for example
---@field r number
---@field g number
---@field b number
Expand Down
2 changes: 2 additions & 0 deletions Libs/DF/definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,10 @@
---@field ParseTexture fun(self:table, texture:texturepath|textureid|atlasname|atlasinfo, width: number?, height: number?, leftTexCoord: number?, rightTexCoord: number?, topTexCoord: number?, bottomTexCoord: number?, vertexRed:number|string?, vertexGreenvertexRed:number?, vertexBluevertexRed:number?, vertexAlphavertexRed:number?) : any, number?, number?, number?, number?, number?, number?, number?, number?, number?, number?, number?, number?
---@field IsTexture fun(self:table, texture:any, bCheckTextureObject: boolean?) : boolean
---@field CreateAtlasString fun(self:table, atlas:atlasinfo|atlasname, textureHeight:number?, textureWidth:number?) : string
---@field SetMask fun(self:table, texture:texture, maskTexture:atlasname|texturepath|textureid) : nil
---@field


--[=[
Wrapped objects: when using the following functions, the object will be wrapped in a table, e.g. detailsFramework:CreateButton() will return a table with the button, the button will be accessible through the "button" key.
The wrapper table will have the same metatable as the wrapped object, so you can call methods on the wrapper table as if it was the wrapped object.
Expand Down
15 changes: 14 additions & 1 deletion Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


local dversion = 517
local dversion = 518
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)

Expand Down Expand Up @@ -2694,6 +2694,19 @@ DF.slider_templates["OPTIONS_SLIDER_TEMPLATE"] = {
thumbcolor = {0, 0, 0, 0.5},
}

DF.slider_templates["MODERN_SLIDER_TEMPLATE"] = {
thumbtexture = "Minimal_SliderBar_Button", --atlas name
thumbwidth = 20,
thumbheight = 19,
thumbcolor = {1, 1, 1, 0.924},
slider_left = "Minimal_SliderBar_Left",
slider_right = "Minimal_SliderBar_Right",
slider_middle = "_Minimal_SliderBar_Middle",
amount_color = "white",
amount_size = 12,
amount_outline = "outline",
}

---install a template
---@param widgetType string
---@param templateName string
Expand Down
14 changes: 12 additions & 2 deletions Libs/DF/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4229,9 +4229,18 @@ detailsFramework.RadioGroupCoreFunctions = {
end

if (optionTable.mask) then
checkbox.Icon:SetMask(optionTable.mask)
if (not checkbox.Icon.Mask) then
checkbox.Icon.Mask = checkbox:CreateMaskTexture(nil, "overlay")
checkbox.Icon.Mask:SetAllPoints(checkbox.Icon.widget)
checkbox.Icon.Mask:SetTexture(optionTable.mask)
checkbox.Icon:AddMaskTexture(checkbox.Icon.Mask)
end
checkbox.Icon.Mask:SetTexture(optionTable.mask)
else
checkbox.Icon:SetMask("")
--checkbox.Icon:SetMask("")
if (checkbox.Icon.Mask) then
checkbox.Icon.Mask:SetTexture("")
end
end
else
checkbox.Icon:SetTexture("")
Expand Down Expand Up @@ -4324,6 +4333,7 @@ detailsFramework.RadioGroupCoreFunctions = {
---@field param any?
---@field texture string?
---@field texcoord table?
---@field mask any?
---@field width number?
---@field height number?
---@field text_size number?
Expand Down
21 changes: 21 additions & 0 deletions Libs/DF/picture.lua
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,10 @@ function detailsFramework:SetAtlas(textureObject, atlas, useAtlasSize, filterMod
textureObject:SetVertexColor(atlasInfo.vertexRed or 1, atlasInfo.vertexGreen or 1, atlasInfo.vertexBlue or 1, atlasInfo.vertexAlpha or 1)
end
end

elseif (type(atlas) == "string" or type(atlas) == "number") then
---@cast atlas string
textureObject:SetTexture(atlas)
end
end

Expand Down Expand Up @@ -680,3 +684,20 @@ function detailsFramework:IsTexture(texture, bCheckTextureObject)

return false
end

---Receives a texture object and a texture to use as mask
---If the mask texture is not created, it will be created and added to a key named MaskTexture
---@param self table
---@param texture texture
---@param maskTexture string|number
function detailsFramework:SetMask(texture, maskTexture)
if (not texture.MaskTexture) then
local parent = texture:GetParent()
local maskTextureObject = parent:CreateMaskTexture(nil, "artwork")
maskTextureObject:SetAllPoints(texture)
texture:AddMaskTexture(maskTextureObject)
texture.MaskTexture = maskTextureObject
end
texture.MaskTexture:SetTexture(maskTexture)
end

57 changes: 55 additions & 2 deletions Libs/DF/slider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,7 @@ local set_as_checkbok = function(self)

self.SetCheckedTexture = setCheckedTexture
self.SetChecked = switch_set_value
self.GetChecked = switch_get_value

self._thumb:Hide()
self._text:Hide()
Expand Down Expand Up @@ -1059,7 +1060,10 @@ function DFSliderMetaFunctions:SetTemplate(template)
local templateName = template
template = DF:GetTemplate("switch", templateName)
if (not template) then
print("no template found", templateName)
template = DF:GetTemplate("slider", templateName)
if (not template) then
print("no template found", templateName)
end
end
end

Expand Down Expand Up @@ -1096,9 +1100,30 @@ function DFSliderMetaFunctions:SetTemplate(template)

if (template.thumbtexture) then
if (self.thumb) then
self.thumb:SetTexture(template.thumbtexture)
DF:SetAtlas(self.thumb, template.thumbtexture)
end
end

if (template.slider_left) then
if (self.slider_left) then
DF:SetAtlas(self.slider_left, template.slider_left)
end
end

if (template.slider_right) then
if (self.slider_right) then
DF:SetAtlas(self.slider_right, template.slider_right)
end
end

if (template.slider_middle) then
if (self.slider_middle) then
self:SetBackdrop(nil)
DF:SetAtlas(self.slider_middle, template.slider_middle)
end
end


if (template.thumbwidth) then
if (self.thumb) then
self.thumb:SetWidth(template.thumbwidth)
Expand All @@ -1116,6 +1141,18 @@ function DFSliderMetaFunctions:SetTemplate(template)
end
end

if (template.amount_color) then
DF:SetFontColor(self.amt, template.amount_color)
end

if (template.amount_outline) then
DF:SetFontOutline(self.amt, template.amount_outline)
end

if (template.amount_size) then
DF:SetFontSize(self.amt, template.amount_size)
end

--switch only
if (template.enabled_backdropcolor) then
local r, g, b, a = DF:ParseColors(template.enabled_backdropcolor)
Expand Down Expand Up @@ -1261,6 +1298,22 @@ function DF:NewSlider (parent, container, name, member, width, height, minValue,
SliderObject.slider:SetThumbTexture (SliderObject.thumb)
SliderObject.slider.thumb = SliderObject.thumb

SliderObject.slider_left = SliderObject.slider:CreateTexture("$parentLeft", "artwork")
SliderObject.slider_left:SetPoint("topright", SliderObject.slider, "topleft", 0, 0)
SliderObject.slider_left:SetPoint("bottomright", SliderObject.slider, "bottomleft", 0, 0)
SliderObject.slider_left:SetWidth(11)

SliderObject.slider_right = SliderObject.slider:CreateTexture("$parentRight", "artwork")
SliderObject.slider_right:SetPoint("topleft", SliderObject.slider, "topright", 0, 0)
SliderObject.slider_right:SetPoint("bottomleft", SliderObject.slider, "bottomright", 0, 0)
SliderObject.slider_right:SetWidth(11)

SliderObject.slider_middle = SliderObject.slider:CreateTexture("$parentMiddle", "artwork")
SliderObject.slider_middle:SetPoint("topleft", SliderObject.slider_left, "topright", 0, 0)
SliderObject.slider_middle:SetPoint("bottomleft", SliderObject.slider_left, "bottomright", 0, 0)
SliderObject.slider_middle:SetPoint("topright", SliderObject.slider_right, "topleft", 0, 0)
SliderObject.slider_middle:SetPoint("bottomright", SliderObject.slider_right, "bottomleft", 0, 0)

if (not isSwitch) then
SliderObject.have_tooltip = "Right Click to Type the Value"
end
Expand Down
1 change: 1 addition & 0 deletions Libs/LibLuaServer/LibLuaServer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ function LibStub:IterateLibraries()end
---@field GetTextTruncateLines fun(self: fontstring) : number

---@class texture : region
---@field AddMaskTexture fun(self: texture, maskTexture: texture)
---@field SetDrawLayer fun(self: texture, layer: drawlayer, subLayer: number?)
---@field GetTexture fun(self: texture) : any
---@field SetTexture fun(self: texture, path: textureid|texturepath, horizontalWrap: texturewrap?, verticalWrap: texturewrap?, filter: texturefilter?)
Expand Down
14 changes: 9 additions & 5 deletions classes/class_combat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ local segmentTypeToString = {
---return the atlasinfo for the combat icon
---@param self combat
---@return df_atlasinfo
---@return df_atlasinfo?
function classCombat:GetCombatIcon()
local textureAtlas = Details:GetTextureAtlasTable()

Expand All @@ -381,20 +382,23 @@ local segmentTypeToString = {
if (combatType == DETAILS_SEGMENTTYPE_OVERALL) then
return textureAtlas["segment-icon-overall"]

elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL or combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON) then
elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON) then
return textureAtlas["segment-icon-mythicplus"]

elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then
return textureAtlas["segment-icon-mythicplus"], textureAtlas["segment-icon-mythicplus-overall"]

elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSTRASH) then
return textureAtlas["segment-icon-mythicplus"]
return textureAtlas["segment-icon-mythicplus"], textureAtlas["segment-icon-broom"]

elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSWIPE) then
return textureAtlas["segment-icon-mythicplus"]
return textureAtlas["segment-icon-mythicplus"], textureAtlas["segment-icon-skull"]

elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS) then
return textureAtlas["segment-icon-mythicplus"]
return textureAtlas["segment-icon-mythicplus"], textureAtlas["segment-icon-skull"]

elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH) then
return textureAtlas["segment-icon-mythicplus"]
return textureAtlas["segment-icon-mythicplus"], textureAtlas["segment-icon-broom"]

elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_GENERIC) then
return textureAtlas["segment-icon-mythicplus"]
Expand Down
1 change: 1 addition & 0 deletions frames/window_breakdown/breakdown_spells_spellframes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,7 @@ function spellsTab.CreateSpellBar(self, index) --~spellbar ~spellline ~spell ~cr
local spellIcon = spellIconFrame:CreateTexture("$parentTexture", "overlay")
spellIcon:SetAllPoints()
spellIcon:SetTexCoord(.1, .9, .1, .9)
detailsFramework:SetMask(spellIcon, [[Interface\COMMON\common-iconmask]])
spellBar.spellIcon = spellIcon

--create a square frame which is placed at the right side of the line to show which targets for damaged by the spell
Expand Down
12 changes: 9 additions & 3 deletions frames/window_breakdown/window_playerbreakdown_auras.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@

---@type details
local Details = Details
local GameTooltip = GameTooltip
---@type detailsframework
local detailsFramework = DetailsFramework

local GameTooltip = GameTooltip
local unpack = unpack
local CreateFrame = CreateFrame
local GetSpellInfo = GetSpellInfo

local _

Details.BuffUptimeSpellsToIgnore = {
[186401] = true, --Sign of the Skirmisher
Expand Down Expand Up @@ -70,7 +74,9 @@ local createAuraTabOnBreakdownWindow = function(tab, frame)

local iconTexture = line:CreateTexture("$parentIcon", "overlay")
iconTexture:SetSize(scroll_line_height -2 , scroll_line_height - 2)
iconTexture:SetAlpha(0.834)
iconTexture:SetAlpha(0.924)
detailsFramework:SetMask(iconTexture, [[Interface\COMMON\common-iconmask]])

local nameLabel = line:CreateFontString("$parentName", "overlay", "GameFontNormal")
local uptimeLabel = line:CreateFontString("$parentUptime", "overlay", "GameFontNormal")
local uptimePercentLabel = line:CreateFontString("$parentPercent", "overlay", "GameFontNormal")
Expand Down
22 changes: 18 additions & 4 deletions frames/window_breakdown/window_playerbreakdown_list.lua
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ local createPlayerScrollBox = function(breakdownWindowFrame, breakdownSideMenu,
local specIcon = upFrame:CreateTexture("$parentSpecIcon", "artwork")
specIcon:SetSize(headerTable[1].width - 1, headerTable[1].width - 1)
specIcon:SetAlpha(0.71)
detailsFramework:SetMask(specIcon, [[Interface\COMMON\common-iconmask]])

local roleIcon = upFrame:CreateTexture("$parentRoleIcon", "overlay")
roleIcon:SetSize((player_line_height-2) / 2, (player_line_height-2) / 2)
Expand Down Expand Up @@ -505,13 +506,19 @@ local createSegmentsScrollBox = function(breakdownWindowFrame, breakdownSideMenu
local updateSegmentLine = function(self, index, segmentData) --~update
local combatName = segmentData.combatName
local r, g, b = segmentData.r, segmentData.g, segmentData.b
local atlasInfo = segmentData.combatIcon
local combatIcon1 = segmentData.combatIcon
local combatIcon2 = segmentData.combatIcon2

self.segmentText:SetText(combatName)
self.segmentText:SetTextColor(r, g, b)
detailsFramework:TruncateText(self.segmentText, player_scroll_size[1] - 20)
detailsFramework:SetAtlas(self.segmentIcon, combatIcon1)

detailsFramework:SetAtlas(self.segmentIcon, atlasInfo)
if (combatIcon2) then
detailsFramework:SetAtlas(self.segmentSubIcon, combatIcon2)
else
self.segmentSubIcon:SetTexture("")
end

self.combatUniqueID = segmentData.UID

Expand Down Expand Up @@ -569,6 +576,10 @@ local createSegmentsScrollBox = function(breakdownWindowFrame, breakdownSideMenu
segmentIcon:SetSize(player_line_height - 4, player_line_height - 4)
segmentIcon:SetAlpha(0.834)

local segmentSubIcon = detailsFramework:CreateTexture(line, "", player_line_height, player_line_height - 1, "artwork")
segmentSubIcon:SetSize(player_line_height - 4, player_line_height - 4)
segmentSubIcon:SetAlpha(0.834)

local segmentText = detailsFramework:CreateLabel(line, "", fontSize or 11, "white", "GameFontNormal")
segmentText.outline = fontOutline or "none"
segmentText.textcolor = {1, 1, 1, .9}
Expand All @@ -578,9 +589,11 @@ local createSegmentsScrollBox = function(breakdownWindowFrame, breakdownSideMenu

line.segmentText = segmentText
line.segmentIcon = segmentIcon
line.segmentSubIcon = segmentSubIcon

segmentIcon:SetPoint("left", line, "left", 2, 0)
segmentText:SetPoint("left", segmentIcon, "right", 3, 1)
segmentSubIcon:SetPoint("left", segmentIcon, "right", 2, 0)
segmentText:SetPoint("left", segmentSubIcon, "right", 3, 1)

line.UpdateLine = updateSegmentLine

Expand Down Expand Up @@ -773,12 +786,13 @@ function breakdownWindowPlayerList.CreatePlayerListFrame()
local UID = combatObject:GetCombatUID()

local combatName, r, g, b = combatObject:GetCombatName(true)
local combatIcon = combatObject:GetCombatIcon()
local combatIcon, combatSubIcon = combatObject:GetCombatIcon()

segmentsData[i] = {
UID = UID,
combatName = combatName,
combatIcon = combatIcon,
combatIcon2 = combatSubIcon,
r = r or 1,
g = g or 1,
b = b or 1,
Expand Down
Loading

0 comments on commit b1a7c5e

Please sign in to comment.