mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-13 12:14:17 +01:00
Update Combos.
This commit is contained in:
parent
95d5d6c4b0
commit
d2bfcefb89
6 changed files with 19 additions and 36 deletions
|
|
@ -32,7 +32,8 @@ public static class TextureDrawer
|
||||||
|
|
||||||
if (texture.LoadError is DllNotFoundException)
|
if (texture.LoadError is DllNotFoundException)
|
||||||
{
|
{
|
||||||
ImGuiUtil.TextColored(Colors.RegexWarningBorder, "A texture handling dependency could not be found. Try installing a current Microsoft VC Redistributable.");
|
ImGuiUtil.TextColored(Colors.RegexWarningBorder,
|
||||||
|
"A texture handling dependency could not be found. Try installing a current Microsoft VC Redistributable.");
|
||||||
if (ImGui.Button("Microsoft VC Redistributables"))
|
if (ImGui.Button("Microsoft VC Redistributables"))
|
||||||
Dalamud.Utility.Util.OpenLink(link);
|
Dalamud.Utility.Util.OpenLink(link);
|
||||||
ImGuiUtil.HoverTooltip($"Open {link} in your browser.");
|
ImGuiUtil.HoverTooltip($"Open {link} in your browser.");
|
||||||
|
|
@ -111,14 +112,12 @@ public static class TextureDrawer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class PathSelectCombo : FilterComboCache<(string Path, bool Game, bool IsOnPlayer)>
|
public sealed class PathSelectCombo(TextureManager textures, ModEditor editor, Func<ISet<string>> getPlayerResources)
|
||||||
|
: FilterComboCache<(string Path, bool Game, bool IsOnPlayer)>(() => CreateFiles(textures, editor, getPlayerResources),
|
||||||
|
MouseWheelType.None, Penumbra.Log)
|
||||||
{
|
{
|
||||||
private int _skipPrefix = 0;
|
private int _skipPrefix = 0;
|
||||||
|
|
||||||
public PathSelectCombo(TextureManager textures, ModEditor editor, Func<ISet<string>> getPlayerResources)
|
|
||||||
: base(() => CreateFiles(textures, editor, getPlayerResources), Penumbra.Log)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
protected override string ToString((string Path, bool Game, bool IsOnPlayer) obj)
|
protected override string ToString((string Path, bool Game, bool IsOnPlayer) obj)
|
||||||
=> obj.Path;
|
=> obj.Path;
|
||||||
|
|
||||||
|
|
@ -140,7 +139,8 @@ public static class TextureDrawer
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IReadOnlyList<(string Path, bool Game, bool IsOnPlayer)> CreateFiles(TextureManager textures, ModEditor editor, Func<ISet<string>> getPlayerResources)
|
private static IReadOnlyList<(string Path, bool Game, bool IsOnPlayer)> CreateFiles(TextureManager textures, ModEditor editor,
|
||||||
|
Func<ISet<string>> getPlayerResources)
|
||||||
{
|
{
|
||||||
var playerResources = getPlayerResources();
|
var playerResources = getPlayerResources();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ public class ModCombo : FilterComboCache<Mod>
|
||||||
=> obj.Name.Text;
|
=> obj.Name.Text;
|
||||||
|
|
||||||
public ModCombo(Func<IReadOnlyList<Mod>> generator)
|
public ModCombo(Func<IReadOnlyList<Mod>> generator)
|
||||||
: base(generator, Penumbra.Log)
|
: base(generator, MouseWheelType.None, Penumbra.Log)
|
||||||
{ }
|
{ }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace Penumbra.Services;
|
||||||
public class StainService : IService
|
public class StainService : IService
|
||||||
{
|
{
|
||||||
public sealed class StainTemplateCombo(FilterComboColors stainCombo, StmFile stmFile)
|
public sealed class StainTemplateCombo(FilterComboColors stainCombo, StmFile stmFile)
|
||||||
: FilterComboCache<ushort>(stmFile.Entries.Keys.Prepend((ushort)0), Penumbra.Log)
|
: FilterComboCache<ushort>(stmFile.Entries.Keys.Prepend((ushort)0), MouseWheelType.None, Penumbra.Log)
|
||||||
{
|
{
|
||||||
protected override float GetFilterWidth()
|
protected override float GetFilterWidth()
|
||||||
{
|
{
|
||||||
|
|
@ -70,8 +70,8 @@ public class StainService : IService
|
||||||
public StainService(IDataManager dataManager, DictStain stainData)
|
public StainService(IDataManager dataManager, DictStain stainData)
|
||||||
{
|
{
|
||||||
StainData = stainData;
|
StainData = stainData;
|
||||||
StainCombo = new FilterComboColors(140,
|
StainCombo = new FilterComboColors(140, MouseWheelType.None,
|
||||||
() => StainData.Value.Prepend(new KeyValuePair<byte, (string Name, uint Dye, bool Gloss)>(0, ("None", 0, false))).ToList(),
|
() => StainData.Value.Prepend(new KeyValuePair<byte, (string Name, uint Dye, bool Gloss)>(0, ("None", 0, false))).ToList(),
|
||||||
Penumbra.Log);
|
Penumbra.Log);
|
||||||
StmFile = new StmFile(dataManager);
|
StmFile = new StmFile(dataManager);
|
||||||
TemplateCombo = new StainTemplateCombo(StainCombo, StmFile);
|
TemplateCombo = new StainTemplateCombo(StainCombo, StmFile);
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,7 @@ public class FileEditor<T> : IDisposable where T : class, IWritable
|
||||||
private readonly Configuration _config;
|
private readonly Configuration _config;
|
||||||
|
|
||||||
public Combo(Configuration config, Func<IReadOnlyList<FileRegistry>> generator)
|
public Combo(Configuration config, Func<IReadOnlyList<FileRegistry>> generator)
|
||||||
: base(generator, Penumbra.Log)
|
: base(generator, MouseWheelType.None, Penumbra.Log)
|
||||||
=> _config = config;
|
=> _config = config;
|
||||||
|
|
||||||
protected override bool DrawSelectable(int globalIdx, bool selected)
|
protected override bool DrawSelectable(int globalIdx, bool selected)
|
||||||
|
|
|
||||||
|
|
@ -125,26 +125,13 @@ public class ItemSwapTab : IDisposable, ITab
|
||||||
Weapon,
|
Weapon,
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ItemSelector : FilterComboCache<EquipItem>
|
private class ItemSelector(ItemData data, FullEquipType type)
|
||||||
|
: FilterComboCache<EquipItem>(() => data.ByType[type], MouseWheelType.None, Penumbra.Log)
|
||||||
{
|
{
|
||||||
public ItemSelector(ItemData data, FullEquipType type)
|
|
||||||
: base(() => data.ByType[type], Penumbra.Log)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
protected override string ToString(EquipItem obj)
|
protected override string ToString(EquipItem obj)
|
||||||
=> obj.Name;
|
=> obj.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class WeaponSelector : FilterComboCache<FullEquipType>
|
|
||||||
{
|
|
||||||
public WeaponSelector()
|
|
||||||
: base(FullEquipTypeExtensions.WeaponTypes.Concat(FullEquipTypeExtensions.ToolTypes), Penumbra.Log)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
protected override string ToString(FullEquipType type)
|
|
||||||
=> type.ToName();
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly Dictionary<SwapType, (ItemSelector Source, ItemSelector Target, string TextFrom, string TextTo)> _selectors;
|
private readonly Dictionary<SwapType, (ItemSelector Source, ItemSelector Target, string TextFrom, string TextTo)> _selectors;
|
||||||
private readonly ItemSwapContainer _swapData;
|
private readonly ItemSwapContainer _swapData;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,10 @@ using Penumbra.GameData.Actors;
|
||||||
|
|
||||||
namespace Penumbra.UI.CollectionTab;
|
namespace Penumbra.UI.CollectionTab;
|
||||||
|
|
||||||
public sealed class CollectionCombo : FilterComboCache<ModCollection>
|
public sealed class CollectionCombo(CollectionManager manager, Func<IReadOnlyList<ModCollection>> items)
|
||||||
|
: FilterComboCache<ModCollection>(items, MouseWheelType.None, Penumbra.Log)
|
||||||
{
|
{
|
||||||
private readonly CollectionManager _collectionManager;
|
private readonly ImRaii.Color _color = new();
|
||||||
private readonly ImRaii.Color _color = new();
|
|
||||||
|
|
||||||
public CollectionCombo(CollectionManager manager, Func<IReadOnlyList<ModCollection>> items)
|
|
||||||
: base(items, Penumbra.Log)
|
|
||||||
=> _collectionManager = manager;
|
|
||||||
|
|
||||||
protected override void DrawFilter(int currentSelected, float width)
|
protected override void DrawFilter(int currentSelected, float width)
|
||||||
{
|
{
|
||||||
|
|
@ -24,11 +20,11 @@ public sealed class CollectionCombo : FilterComboCache<ModCollection>
|
||||||
|
|
||||||
public void Draw(string label, float width, uint color)
|
public void Draw(string label, float width, uint color)
|
||||||
{
|
{
|
||||||
var current = _collectionManager.Active.ByType(CollectionType.Current, ActorIdentifier.Invalid);
|
var current = manager.Active.ByType(CollectionType.Current, ActorIdentifier.Invalid);
|
||||||
_color.Push(ImGuiCol.FrameBg, color).Push(ImGuiCol.FrameBgHovered, color);
|
_color.Push(ImGuiCol.FrameBg, color).Push(ImGuiCol.FrameBgHovered, color);
|
||||||
|
|
||||||
if (Draw(label, current?.Name ?? string.Empty, string.Empty, width, ImGui.GetTextLineHeightWithSpacing()) && CurrentSelection != null)
|
if (Draw(label, current?.Name ?? string.Empty, string.Empty, width, ImGui.GetTextLineHeightWithSpacing()) && CurrentSelection != null)
|
||||||
_collectionManager.Active.SetCollection(CurrentSelection, CollectionType.Current);
|
manager.Active.SetCollection(CurrentSelection, CollectionType.Current);
|
||||||
_color.Dispose();
|
_color.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue