using System; using System.Collections.Generic; using System.Linq; using ImGuiNET; namespace ExpandedSearchInfo.Sections { public class FListSection : ISearchInfoSection { public string Name { get; } public Uri Uri { get; } private string Info { get; } private List> Stats { get; } private List> Fave { get; } private List> Yes { get; } private List> Maybe { get; } private List> No { get; } internal FListSection(string name, Uri uri, string info, List> stats, List> fave, List> yes, List> maybe, List> no) { this.Name = name; this.Uri = uri; this.Info = info; this.Stats = stats; this.Fave = fave; this.Yes = yes; this.Maybe = maybe; this.No = no; } public void Draw() { if (ImGui.CollapsingHeader($"Stats##{this.Name}")) { var stats = string.Join("\n", this.Stats.Select(entry => $"{entry.Item1}: {entry.Item2}")); ImGui.TextUnformatted(stats); } if (ImGui.CollapsingHeader($"Info##{this.Name}", ImGuiTreeNodeFlags.DefaultOpen)) { Util.DrawLines(this.Info); } this.DrawKinkSection("Fave", this.Fave); this.DrawKinkSection("Yes", this.Yes); this.DrawKinkSection("Maybe", this.Maybe); this.DrawKinkSection("No", this.No); } private void DrawKinkSection(string sectionName, IEnumerable> kinks) { if (!ImGui.CollapsingHeader($"{sectionName}##{this.Name}")) { return; } foreach (var (name, description) in kinks) { ImGui.TextUnformatted(name); if (!ImGui.IsItemHovered()) { continue; } ImGui.BeginTooltip(); ImGui.PushTextWrapPos(ImGui.GetIO().DisplaySize.X / 8); ImGui.TextUnformatted(description); ImGui.PopTextWrapPos(); ImGui.EndTooltip(); } } } }