Skip to content

Commit

Permalink
Manager: Add encounter icon to LogList
Browse files Browse the repository at this point in the history
  • Loading branch information
Linkaaaaa committed May 1, 2024
1 parent 5b55e7a commit 32b570a
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion ArcdpsLogManager/Sections/LogList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class LogList : Panel
{ "CM", "Challenge Mode or Emboldened" },
{ "Instabilities", "Fractals of the Mists" },
{ "Scale", "Fractals of the Mists" },
{ "", "Encounter Icon" },
};

public bool ReadOnly { get; init; }
Expand Down Expand Up @@ -139,6 +140,34 @@ private GridView<LogData> ConstructLogGridView(LogDetailPanel detailPanel, Multi

gridView.Columns.Add(favoritesColumn);

var encounterIconCell = new DrawableCell();
encounterIconCell.Paint += (sender, args) =>
{
if (!(args.Item is LogData log)) return;
if (log.ParsingStatus != ParsingStatus.Parsed) return;

var rectangle = new RectangleF(new PointF(0, 0), new SizeF(PlayerIconSize, PlayerIconSize));

// If the log has no corrisponding icon it will not be drawn.
var wvwIcon = imageProvider.GetWvWMapIcon(log.MapId);
var encounterIcon = imageProvider.GetTinyEncounterIcon(log.Encounter);
if (encounterIcon != null)
{
args.Graphics.DrawImage(encounterIcon, rectangle);
}
if (wvwIcon != null)
{
args.Graphics.DrawImage(wvwIcon, rectangle);
}
};

gridView.Columns.Add(new GridColumn()
{
HeaderText = "",
DataCell = encounterIconCell,
Visible = false,
});

gridView.Columns.Add(new GridColumn()
{
HeaderText = "Encounter",
Expand Down Expand Up @@ -493,7 +522,7 @@ private ContextMenu ConstructLogGridViewContextMenu(GridView<LogData> gridView)

if (Abbreviations.TryGetValue(menuItem.Text, out string fullName))
{
menuItem.Text = $"{menuItem.Text} ({fullName})";
menuItem.Text = string.IsNullOrEmpty(menuItem.Text) || string.IsNullOrWhiteSpace(menuItem.Text) ? $"{fullName}" : $"{menuItem.Text} ({fullName})";
}

menuItem.CheckedChanged += (item, args) =>
Expand Down

0 comments on commit 32b570a

Please sign in to comment.