mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Improve tooltip of file redirections tab.
This commit is contained in:
parent
d713d5a112
commit
4970e57131
2 changed files with 18 additions and 12 deletions
2
OtterGui
2
OtterGui
|
|
@ -1 +1 @@
|
||||||
Subproject commit 276327f812e2f7e6aac7aee9e5ef0a560b065765
|
Subproject commit 9217ac56697bc8285ced483b1fd4734fd36ba64d
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
|
using System.Linq;
|
||||||
using Dalamud.Interface;
|
using Dalamud.Interface;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using OtterGui;
|
using OtterGui;
|
||||||
using OtterGui.Classes;
|
using OtterGui.Classes;
|
||||||
using OtterGui.Raii;
|
using OtterGui.Raii;
|
||||||
|
using OtterGui.Text;
|
||||||
using Penumbra.Mods.Editor;
|
using Penumbra.Mods.Editor;
|
||||||
using Penumbra.Mods.SubMods;
|
using Penumbra.Mods.SubMods;
|
||||||
using Penumbra.String.Classes;
|
using Penumbra.String.Classes;
|
||||||
|
|
@ -144,22 +146,20 @@ public partial class ModEditWindow
|
||||||
|
|
||||||
private static string DrawFileTooltip(FileRegistry registry, ColorId color)
|
private static string DrawFileTooltip(FileRegistry registry, ColorId color)
|
||||||
{
|
{
|
||||||
(string, int) GetMulti()
|
|
||||||
{
|
|
||||||
var groups = registry.SubModUsage.GroupBy(s => s.Item1).ToArray();
|
|
||||||
return (string.Join("\n", groups.Select(g => g.Key.GetName())), groups.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
var (text, groupCount) = color switch
|
var (text, groupCount) = color switch
|
||||||
{
|
{
|
||||||
ColorId.ConflictingMod => (string.Empty, 0),
|
ColorId.ConflictingMod => (null, 0),
|
||||||
ColorId.NewMod => (registry.SubModUsage[0].Item1.GetName(), 1),
|
ColorId.NewMod => ([registry.SubModUsage[0].Item1.GetName()], 1),
|
||||||
ColorId.InheritedMod => GetMulti(),
|
ColorId.InheritedMod => GetMulti(),
|
||||||
_ => (string.Empty, 0),
|
_ => (null, 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (text.Length > 0 && ImGui.IsItemHovered())
|
if (text != null && ImGui.IsItemHovered())
|
||||||
ImGui.SetTooltip(text);
|
{
|
||||||
|
using var tt = ImUtf8.Tooltip();
|
||||||
|
using var c = ImRaii.DefaultColors();
|
||||||
|
ImUtf8.Text(string.Join('\n', text));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return (groupCount, registry.SubModUsage.Count) switch
|
return (groupCount, registry.SubModUsage.Count) switch
|
||||||
|
|
@ -169,6 +169,12 @@ public partial class ModEditWindow
|
||||||
(1, > 1) => $"(used {registry.SubModUsage.Count} times in 1 group)",
|
(1, > 1) => $"(used {registry.SubModUsage.Count} times in 1 group)",
|
||||||
_ => $"(used {registry.SubModUsage.Count} times over {groupCount} groups)",
|
_ => $"(used {registry.SubModUsage.Count} times over {groupCount} groups)",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
(IEnumerable<string>, int) GetMulti()
|
||||||
|
{
|
||||||
|
var groups = registry.SubModUsage.GroupBy(s => s.Item1).ToArray();
|
||||||
|
return (groups.Select(g => g.Key.GetName()), groups.Length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawSelectable(FileRegistry registry)
|
private void DrawSelectable(FileRegistry registry)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue