mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-24 21:51:50 +01:00
Wow, I accidentally the whole UI
This commit is contained in:
parent
dd8c910597
commit
651c7410ac
87 changed files with 7571 additions and 7280 deletions
69
Penumbra/UI/ModsTab/ModPanelConflictsTab.cs
Normal file
69
Penumbra/UI/ModsTab/ModPanelConflictsTab.cs
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
using ImGuiNET;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Widgets;
|
||||
using Penumbra.Collections;
|
||||
using Penumbra.Meta.Manipulations;
|
||||
using Penumbra.Mods;
|
||||
using Penumbra.String.Classes;
|
||||
using Penumbra.UI.Classes;
|
||||
|
||||
namespace Penumbra.UI.ModTab;
|
||||
|
||||
public class ModPanelConflictsTab : ITab
|
||||
{
|
||||
private readonly ModFileSystemSelector _selector;
|
||||
private readonly ModCollection.Manager _collectionManager;
|
||||
|
||||
public ModPanelConflictsTab(ModCollection.Manager collectionManager, ModFileSystemSelector selector)
|
||||
{
|
||||
_collectionManager = collectionManager;
|
||||
_selector = selector;
|
||||
}
|
||||
|
||||
public ReadOnlySpan<byte> Label
|
||||
=> "Conflicts"u8;
|
||||
|
||||
public bool IsVisible
|
||||
=> _collectionManager.Current.Conflicts(_selector.Selected!).Count > 0;
|
||||
|
||||
public void DrawContent()
|
||||
{
|
||||
using var box = ImRaii.ListBox("##conflicts", -Vector2.One);
|
||||
if (!box)
|
||||
return;
|
||||
|
||||
// Can not be null because otherwise the tab bar is never drawn.
|
||||
var mod = _selector.Selected!;
|
||||
foreach (var conflict in Penumbra.CollectionManager.Current.Conflicts(mod))
|
||||
{
|
||||
if (ImGui.Selectable(conflict.Mod2.Name) && conflict.Mod2 is Mod otherMod)
|
||||
_selector.SelectByValue(otherMod);
|
||||
|
||||
ImGui.SameLine();
|
||||
using (var color = ImRaii.PushColor(ImGuiCol.Text,
|
||||
conflict.HasPriority ? ColorId.HandledConflictMod.Value(Penumbra.Config) : ColorId.ConflictingMod.Value(Penumbra.Config)))
|
||||
{
|
||||
var priority = conflict.Mod2.Index < 0
|
||||
? conflict.Mod2.Priority
|
||||
: _collectionManager.Current[conflict.Mod2.Index].Settings!.Priority;
|
||||
ImGui.TextUnformatted($"(Priority {priority})");
|
||||
}
|
||||
|
||||
using var indent = ImRaii.PushIndent(30f);
|
||||
foreach (var data in conflict.Conflicts)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
var _ = data switch
|
||||
{
|
||||
Utf8GamePath p => ImGuiNative.igSelectable_Bool(p.Path.Path, 0, ImGuiSelectableFlags.None, Vector2.Zero) > 0,
|
||||
MetaManipulation m => ImGui.Selectable(m.Manipulation?.ToString() ?? string.Empty),
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue