Fix some bugs and start work on new collections tab.

This commit is contained in:
Ottermandias 2023-04-18 18:44:53 +02:00
parent e9fc57022e
commit fba5bc6820
26 changed files with 1346 additions and 717 deletions

View file

@ -0,0 +1,24 @@
using System.Collections.Generic;
using System.Linq;
using ImGuiNET;
using OtterGui.Widgets;
namespace Penumbra.UI.CollectionTab;
public sealed class WorldCombo : FilterComboCache<KeyValuePair<ushort, string>>
{
private static readonly KeyValuePair<ushort, string> AllWorldPair = new(ushort.MaxValue, "Any World");
public WorldCombo(IReadOnlyDictionary<ushort, string> worlds)
: base(worlds.OrderBy(kvp => kvp.Value).Prepend(AllWorldPair))
{
CurrentSelection = AllWorldPair;
CurrentSelectionIdx = 0;
}
protected override string ToString(KeyValuePair<ushort, string> obj)
=> obj.Value;
public bool Draw(float width)
=> Draw("##worldCombo", CurrentSelection.Value, string.Empty, width, ImGui.GetTextLineHeightWithSpacing());
}