mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-15 21:24:18 +01:00
Add SelectTab event, update new clientstructs.
This commit is contained in:
parent
78e772dad9
commit
5fcb07487e
10 changed files with 79 additions and 159 deletions
|
|
@ -10,6 +10,7 @@ using OtterGui.Widgets;
|
|||
using Penumbra.Api.Enums;
|
||||
using Penumbra.Collections.Manager;
|
||||
using Penumbra.Mods;
|
||||
using Penumbra.Services;
|
||||
using Penumbra.UI.Classes;
|
||||
|
||||
namespace Penumbra.UI.Tabs;
|
||||
|
|
@ -19,18 +20,17 @@ public class ChangedItemsTab : ITab
|
|||
private readonly CollectionManager _collectionManager;
|
||||
private readonly ChangedItemDrawer _drawer;
|
||||
private readonly CollectionSelectHeader _collectionHeader;
|
||||
private ConfigTabBar? _tabBar = null;
|
||||
private readonly CommunicatorService _communicator;
|
||||
|
||||
public ChangedItemsTab(CollectionManager collectionManager, CollectionSelectHeader collectionHeader, ChangedItemDrawer drawer)
|
||||
public ChangedItemsTab(CollectionManager collectionManager, CollectionSelectHeader collectionHeader, ChangedItemDrawer drawer,
|
||||
CommunicatorService communicator)
|
||||
{
|
||||
_collectionManager = collectionManager;
|
||||
_collectionHeader = collectionHeader;
|
||||
_drawer = drawer;
|
||||
_communicator = communicator;
|
||||
}
|
||||
|
||||
public void SetTabBar(ConfigTabBar tabBar)
|
||||
=> _tabBar = tabBar;
|
||||
|
||||
public ReadOnlySpan<byte> Label
|
||||
=> "Changed Items"u8;
|
||||
|
||||
|
|
@ -106,22 +106,18 @@ public class ChangedItemsTab : ITab
|
|||
if (mods.Count <= 0)
|
||||
return;
|
||||
|
||||
var first = mods[0];
|
||||
var first = mods[0];
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.SelectableTextAlign, new Vector2(0, 0.5f));
|
||||
if (ImGui.Selectable(first.Name, false, ImGuiSelectableFlags.None, new Vector2(0, ImGui.GetFrameHeight()))
|
||||
&& ImGui.GetIO().KeyCtrl
|
||||
&& _tabBar != null
|
||||
&& first is Mod mod)
|
||||
{
|
||||
_tabBar.SelectTab = TabType.Mods;
|
||||
_tabBar.Mods.SelectMod = mod;
|
||||
}
|
||||
if (ImGui.Selectable(first.Name, false, ImGuiSelectableFlags.None, new Vector2(0, ImGui.GetFrameHeight()))
|
||||
&& ImGui.GetIO().KeyCtrl
|
||||
&& first is Mod mod)
|
||||
_communicator.SelectTab.Invoke(TabType.Mods, mod);
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
using var _ = ImRaii.Tooltip();
|
||||
ImGui.TextUnformatted("Hold Control and click to jump to mod.\n");
|
||||
if (mods.Count > 1)
|
||||
using var _ = ImRaii.Tooltip();
|
||||
ImGui.TextUnformatted("Hold Control and click to jump to mod.\n");
|
||||
if (mods.Count > 1)
|
||||
ImGui.TextUnformatted("Other mods affecting this item:\n" + string.Join("\n", mods.Skip(1).Select(m => m.Name)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue