Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesigned the Import Chararacter menu to improve readability #7492

Merged
merged 6 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions src/Classes/DropDownControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,8 @@ function DropDownClass:Draw(viewPort, noTooltip)
DrawImage(nil, x, dropY, self.droppedWidth, dropExtra)
SetDrawLayer(nil, 0)
end
if not enabled then
if not enabled or self.dropped then
SetDrawColor(0, 0, 0)
elseif self.dropped then
SetDrawColor(0.5, 0.5, 0.5)
elseif mOver then
SetDrawColor(0.33, 0.33, 0.33)
else
Expand Down Expand Up @@ -292,17 +290,25 @@ function DropDownClass:Draw(viewPort, noTooltip)
SetDrawColor(0.66, 0.66, 0.66)
end
-- draw selected label or search term
local selLabel
local selLabel = nil
local selDetail = nil
if self:IsSearchActive() then
selLabel = "Search: " .. self:GetSearchTermPretty()
else
selLabel = self.list[self.selIndex]
if type(selLabel) == "table" then
selLabel = selLabel.label
local selItem = self.list[self.selIndex]
if type(selItem) == "table" then
selLabel = selItem.label
selDetail = selItem.detail
else
selLabel = selItem
end
end
SetViewport(x + 2, y + 2, width - height, lineHeight)
DrawString(0, 0, "LEFT", lineHeight, "VAR", selLabel or "")
if selDetail ~= nil then
local dx = DrawStringWidth(lineHeight, "VAR", selDetail)
DrawString(width - dx - 22, 0, "LEFT", lineHeight, "VAR", selDetail)
end
SetViewport()

-- draw dropped down part with items
Expand Down Expand Up @@ -351,6 +357,11 @@ function DropDownClass:Draw(viewPort, noTooltip)
-- draw actual item label with search match highlight if available
local label = type(listVal) == "table" and listVal.label or listVal
DrawString(0, y, "LEFT", lineHeight, "VAR", label)
if selDetail ~= nil then
local detail = listVal.detail
dx = DrawStringWidth(lineHeight, "VAR", detail)
DrawString(width - dx - 4 - 22, y, "LEFT", lineHeight, "VAR", detail)
end
self:DrawSearchHighlights(label, searchInfo, 0, y, width - 4, lineHeight)
end
end
Expand Down
38 changes: 32 additions & 6 deletions src/Classes/ImportTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -489,14 +489,40 @@ function ImportTabClass:BuildCharacterList(league)
charLeague = char.league or "?"
charName = char.name or "?"
charClass = char.class or "?"
lbl = (league == nil and
string.format("%s: Level %d %s in %s", charName, charLvl, charClass, charLeague)
or
string.format("%s: Level %d %s", charName, charLvl, charClass)
)

classColor = colorCodes.DEFAULT
if charClass ~= "?" then
classColor = colorCodes[charClass:upper()]

if classColor == nil then
if (charClass == "Elementalist" or charClass == "Necromancer" or charClass == "Occultist") then
classColor = colorCodes["WITCH"]
elseif (charClass == "Guardian" or charClass == "Inquisitor" or charClass == "Hierophant") then
classColor = colorCodes["TEMPLAR"]
elseif (charClass == "Assassin" or charClass == "Trickster" or charClass == "Saboteur") then
classColor = colorCodes["SHADOW"]
elseif (charClass == "Gladiator" or charClass == "Slayer" or charClass == "Champion") then
classColor = colorCodes["DUELIST"]
elseif (charClass == "Raider" or charClass == "Pathfinder" or charClass == "Deadeye") then
classColor = colorCodes["RANGER"]
elseif (charClass == "Juggernaut" or charClass == "Berserker" or charClass == "Chieftain") then
classColor = colorCodes["MARAUDER"]
elseif (charClass == "Ascendant") then
classColor = colorCodes["SCION"]
end
end
end

local detail
if league == nil then
detail = string.format("%s%s ^x808080lvl %d in %s", classColor, charClass, charLvl, charLeague)
else
detail = string.format("%s%s ^x808080lvl %d", classColor, charClass, charLvl)
end
t_insert(self.controls.charSelect.list, {
label = lbl,
label = charName,
char = char,
detail = detail
})
end
end
Expand Down
Loading