Format the text in the breakdown player list using the same font, size and outline of the damage window
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
|
||||
local Details = _G.Details
|
||||
local DF = _G.DetailsFramework
|
||||
local detailsFramework = _G.DetailsFramework
|
||||
|
||||
local breakdownWindowPlayerList = {}
|
||||
|
||||
local unpack = _G.unpack
|
||||
local unpack = table.unpack or unpack
|
||||
local C_Timer = _G.C_Timer
|
||||
local tinsert = _G.tinsert
|
||||
|
||||
@@ -15,16 +15,17 @@
|
||||
local scrollbox_line_backdrop_color_selected = {.6, .6, .1, 0.7}
|
||||
local scrollbox_line_backdrop_color_highlight = {.9, .9, .9, 0.5}
|
||||
local player_scroll_size = {180, 288}
|
||||
|
||||
|
||||
function breakdownWindowPlayerList.CreatePlayerListFrame()
|
||||
local f = _G.DetailsPlayerDetailsWindow
|
||||
|
||||
|
||||
local refreshPlayerList = function(self, data, offset, totalLines)
|
||||
--update the scroll
|
||||
local topResult = data[1]
|
||||
if (topResult) then
|
||||
topResult = topResult.total
|
||||
end
|
||||
|
||||
for i = 1, totalLines do
|
||||
local index = i + offset
|
||||
local playerObject = data[index]
|
||||
@@ -36,20 +37,20 @@
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local lineOnClick = function(self)
|
||||
if (self.playerObject ~= Details:GetPlayerObjectFromBreakdownWindow()) then
|
||||
Details:OpenPlayerBreakdown(Details:GetActiveWindowFromBreakdownWindow(), self.playerObject)
|
||||
f.playerScrollBox:Refresh()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local lineOnEnter = function(self)
|
||||
self:SetBackdropColor(unpack(scrollbox_line_backdrop_color_highlight))
|
||||
self.specIcon:SetBlendMode("ADD")
|
||||
self.roleIcon:SetBlendMode("ADD")
|
||||
end
|
||||
|
||||
|
||||
local lineOnLeave = function(self)
|
||||
if (self.isSelected) then
|
||||
self:SetBackdropColor(unpack(scrollbox_line_backdrop_color_selected))
|
||||
@@ -78,7 +79,6 @@
|
||||
self.specIcon:SetTexCoord(.1, .9, .1, .9)
|
||||
else
|
||||
local specIcon, L, R, T, B = Details:GetSpecIcon(self.playerObject.spec, false)
|
||||
local specId, specName, specDescription, specIconId, specClass
|
||||
|
||||
if (specIcon) then
|
||||
self.specIcon:SetTexture(specIcon)
|
||||
@@ -87,7 +87,7 @@
|
||||
if (DetailsFramework.IsTimewalkWoW()) then
|
||||
specRole = "NONE"
|
||||
else
|
||||
specId, specName, specDescription, specIconId, specRole, specClass = _G.GetSpecializationInfoByID(self.playerObject.spec)
|
||||
specRole = select(5, _G.GetSpecializationInfoByID(self.playerObject.spec))
|
||||
end
|
||||
else
|
||||
self.specIcon:SetTexture("")
|
||||
@@ -106,14 +106,14 @@
|
||||
else
|
||||
self.roleIcon:SetTexture("")
|
||||
end
|
||||
|
||||
|
||||
--do not show the role icon
|
||||
self.roleIcon:SetTexture("")
|
||||
|
||||
|
||||
--set the player name
|
||||
self.playerName:SetText(Details:GetOnlyName(self.playerObject.nome))
|
||||
self.rankText:SetText(self.index)
|
||||
|
||||
|
||||
--set the player class name
|
||||
self.className:SetText(string.lower(_G.UnitClass(self.playerObject.nome) or self.playerObject:Class()))
|
||||
|
||||
@@ -124,6 +124,21 @@
|
||||
self.totalStatusBar:SetValue(self.playerObject.total)
|
||||
end
|
||||
|
||||
--get a Details! window
|
||||
local lowerInstanceId = Details:GetLowerInstanceNumber()
|
||||
local fontFile
|
||||
local fontSize
|
||||
local fontOutline
|
||||
|
||||
if (lowerInstanceId) then
|
||||
local instance = Details:GetInstance(lowerInstanceId)
|
||||
if (instance) then
|
||||
fontFile = instance.row_info.font_face
|
||||
fontSize = instance.row_info.font_size
|
||||
fontOutline = instance.row_info.textL_outline
|
||||
end
|
||||
end
|
||||
|
||||
local createPlayerLine = function(self, index)
|
||||
--create a new line
|
||||
local line = _G.CreateFrame("button", "$parentLine" .. index, self, "BackdropTemplate")
|
||||
@@ -144,18 +159,29 @@
|
||||
local specIcon = line:CreateTexture("$parentSpecIcon", "artwork")
|
||||
specIcon:SetSize(player_line_height, player_line_height)
|
||||
specIcon:SetAlpha(0.71)
|
||||
|
||||
local roleIcon = line:CreateTexture("$parentRoleIcon", "overlay")
|
||||
roleIcon:SetSize((player_line_height-2) / 2, (player_line_height-2) / 2)
|
||||
roleIcon:SetAlpha(0.71)
|
||||
|
||||
local playerName = DF:CreateLabel(line, "", "GameFontNormal")
|
||||
local playerName = detailsFramework:CreateLabel(line, "", 11, "white", "GameFontNormal")
|
||||
if (fontFile) then
|
||||
playerName.fontface = fontFile
|
||||
end
|
||||
if (fontSize) then
|
||||
playerName.fontsize = fontSize
|
||||
end
|
||||
if (fontOutline) then
|
||||
playerName.outline = fontOutline
|
||||
end
|
||||
|
||||
playerName.textcolor = {1, 1, 1, .9}
|
||||
playerName.textsize = 11
|
||||
local className = DF:CreateLabel(line, "", "GameFontNormal")
|
||||
|
||||
local className = detailsFramework:CreateLabel(line, "", "GameFontNormal")
|
||||
className.textcolor = {.95, .8, .2, 0}
|
||||
className.textsize = 9
|
||||
|
||||
local rankText = DF:CreateLabel(line, "", "GameFontNormal")
|
||||
local rankText = detailsFramework:CreateLabel(line, "", "GameFontNormal")
|
||||
rankText.textcolor = {.3, .3, .3, .7}
|
||||
rankText.textsize = 13
|
||||
|
||||
@@ -184,9 +210,9 @@
|
||||
|
||||
return line
|
||||
end
|
||||
|
||||
local playerScroll = DF:CreateScrollBox(f, "$parentPlayerScrollBox", refreshPlayerList, {}, player_scroll_size[1] + 22, player_scroll_size[2], scrollbox_lines, player_line_height)
|
||||
DF:ReskinSlider (playerScroll)
|
||||
|
||||
local playerScroll = detailsFramework:CreateScrollBox(f, "$parentPlayerScrollBox", refreshPlayerList, {}, player_scroll_size[1] + 22, player_scroll_size[2], scrollbox_lines, player_line_height)
|
||||
detailsFramework:ReskinSlider(playerScroll)
|
||||
playerScroll.ScrollBar:ClearAllPoints()
|
||||
playerScroll.ScrollBar:SetPoint("topright", playerScroll, "topright", -2, -17)
|
||||
playerScroll.ScrollBar:SetPoint("bottomright", playerScroll, "bottomright", -2, 17)
|
||||
@@ -196,12 +222,12 @@
|
||||
playerScroll:SetBackdropColor(0, 0, 0, 0.2)
|
||||
playerScroll:SetBackdropBorderColor(0, 0, 0, 1)
|
||||
f.playerScrollBox = playerScroll
|
||||
|
||||
|
||||
--create the scrollbox lines
|
||||
for i = 1, scrollbox_lines do
|
||||
playerScroll:CreateLine(createPlayerLine)
|
||||
end
|
||||
|
||||
|
||||
local classIds = {
|
||||
WARRIOR = 1,
|
||||
PALADIN = 2,
|
||||
@@ -221,21 +247,23 @@
|
||||
function breakdownWindowPlayerList.BuildPlayerList()
|
||||
local segment = Details:GetCombatFromBreakdownWindow()
|
||||
local playerTable = {}
|
||||
|
||||
if (segment) then
|
||||
local displayType = Details:GetDisplayTypeFromBreakdownWindow()
|
||||
local containerType = displayType == 1 and DETAILS_ATTRIBUTE_DAMAGE or DETAILS_ATTRIBUTE_HEAL
|
||||
local container = segment:GetContainer(containerType)
|
||||
|
||||
for index, playerObject in container:ListActors() do
|
||||
if (playerObject:IsPlayer()) then
|
||||
local unitClassID = classIds [playerObject:Class()] or 13
|
||||
local unitName = playerObject:Name()
|
||||
local playerPosition = (((unitClassID or 0) + 128) ^ 4) + tonumber (string.byte (unitName, 1) .. "" .. string.byte (unitName, 2))
|
||||
local playerPosition = (((unitClassID or 0) + 128) ^ 4) + tonumber (string.byte(unitName, 1) .. "" .. string.byte(unitName, 2))
|
||||
tinsert(playerTable, {playerObject, playerPosition, playerObject.total})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(playerTable, DF.SortOrder3)
|
||||
table.sort(playerTable, detailsFramework.SortOrder3)
|
||||
|
||||
local resultTable = {}
|
||||
for i = 1, #playerTable do
|
||||
@@ -263,5 +291,9 @@
|
||||
end)
|
||||
end
|
||||
|
||||
breakdownWindowPlayerList.CreatePlayerListFrame()
|
||||
|
||||
function Details.PlayerBreakdown.CreatePlayerListFrame()
|
||||
if (not Details.PlayerBreakdown.playerListFrameCreated) then
|
||||
breakdownWindowPlayerList.CreatePlayerListFrame()
|
||||
Details.PlayerBreakdown.playerListFrameCreated = true
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user