Add UI/sorting options
This commit is contained in:
parent
297544128d
commit
65af6814df
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0-windows</TargetFramework>
|
<TargetFramework>net7.0-windows</TargetFramework>
|
||||||
<Version>2.3</Version>
|
<Version>2.4</Version>
|
||||||
<LangVersion>11.0</LangVersion>
|
<LangVersion>11.0</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
|
@ -12,6 +12,7 @@ internal sealed class Configuration : IPluginConfiguration
|
|||||||
public List<CharacterConfiguration> Characters { get; set; } = new();
|
public List<CharacterConfiguration> Characters { get; set; } = new();
|
||||||
public List<ItemList> ItemLists { get; set; } = new();
|
public List<ItemList> ItemLists { get; set; } = new();
|
||||||
public List<CharacterGroup> CharacterGroups { get; set; } = new();
|
public List<CharacterGroup> CharacterGroups { get; set; } = new();
|
||||||
|
public ConfigWindowUiOptions ConfigUiOptions { get; set; } = new();
|
||||||
|
|
||||||
public sealed class ItemList
|
public sealed class ItemList
|
||||||
{
|
{
|
||||||
@ -23,6 +24,9 @@ internal sealed class Configuration : IPluginConfiguration
|
|||||||
|
|
||||||
public string GetIcon()
|
public string GetIcon()
|
||||||
{
|
{
|
||||||
|
if (Id == Guid.Empty)
|
||||||
|
return string.Empty;
|
||||||
|
|
||||||
return Type switch
|
return Type switch
|
||||||
{
|
{
|
||||||
ListType.CollectOneTime => SeIconChar.BoxedNumber1.ToIconString(),
|
ListType.CollectOneTime => SeIconChar.BoxedNumber1.ToIconString(),
|
||||||
@ -102,4 +106,12 @@ internal sealed class Configuration : IPluginConfiguration
|
|||||||
public int Gathering { get; set; }
|
public int Gathering { get; set; }
|
||||||
public int Perception { get; set; }
|
public int Perception { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public sealed class ConfigWindowUiOptions
|
||||||
|
{
|
||||||
|
public bool ShowVentureListContents { get; set; } = true;
|
||||||
|
public bool CheckGatheredItemsPerCharacter { get; set; }
|
||||||
|
public bool OnlyShowMissingGatheredItems { get; set; }
|
||||||
|
public bool WrapAroundWhenReordering { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,9 +50,6 @@ internal sealed class ConfigWindow : Window
|
|||||||
ListPriority = Configuration.ListPriority.InOrder
|
ListPriority = Configuration.ListPriority.InOrder
|
||||||
};
|
};
|
||||||
|
|
||||||
private bool _checkPerCharacter = true;
|
|
||||||
private bool _onlyShowMissing = true;
|
|
||||||
|
|
||||||
public ConfigWindow(
|
public ConfigWindow(
|
||||||
DalamudPluginInterface pluginInterface,
|
DalamudPluginInterface pluginInterface,
|
||||||
Configuration configuration,
|
Configuration configuration,
|
||||||
@ -88,6 +85,7 @@ internal sealed class ConfigWindow : Window
|
|||||||
DrawCharacterGroups();
|
DrawCharacterGroups();
|
||||||
DrawCharacters();
|
DrawCharacters();
|
||||||
DrawGatheredItemsToCheck();
|
DrawGatheredItemsToCheck();
|
||||||
|
DrawUiTab();
|
||||||
ImGui.EndTabBar();
|
ImGui.EndTabBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -340,27 +338,39 @@ internal sealed class ConfigWindow : Window
|
|||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine(windowX - 30);
|
if (list.Items.Count > 1)
|
||||||
ImGui.BeginDisabled(i == 0);
|
|
||||||
if (ImGuiComponents.IconButton($"##Up{i}", FontAwesomeIcon.ArrowUp))
|
|
||||||
{
|
{
|
||||||
itemToAdd = item;
|
bool wrap = _configuration.ConfigUiOptions.WrapAroundWhenReordering;
|
||||||
indexToAdd = i - 1;
|
|
||||||
|
ImGui.SameLine(windowX - 31);
|
||||||
|
ImGui.BeginDisabled(i == 0 && !wrap);
|
||||||
|
if (ImGuiComponents.IconButton($"##Up{i}", FontAwesomeIcon.ArrowUp))
|
||||||
|
{
|
||||||
|
itemToAdd = item;
|
||||||
|
if (i > 0)
|
||||||
|
indexToAdd = i - 1;
|
||||||
|
else
|
||||||
|
indexToAdd = list.Items.Count - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.EndDisabled();
|
||||||
|
|
||||||
|
ImGui.SameLine(0, 0);
|
||||||
|
ImGui.BeginDisabled(i == list.Items.Count - 1 && !wrap);
|
||||||
|
if (ImGuiComponents.IconButton($"##Down{i}", FontAwesomeIcon.ArrowDown))
|
||||||
|
{
|
||||||
|
itemToAdd = item;
|
||||||
|
if (i < list.Items.Count - 1)
|
||||||
|
indexToAdd = i + 1;
|
||||||
|
else
|
||||||
|
indexToAdd = 0;
|
||||||
|
}
|
||||||
|
ImGui.EndDisabled();
|
||||||
|
ImGui.SameLine();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
ImGui.SameLine(windowX + 19);
|
||||||
|
|
||||||
ImGui.EndDisabled();
|
|
||||||
|
|
||||||
ImGui.SameLine(0, 0);
|
|
||||||
ImGui.BeginDisabled(i == list.Items.Count - 1);
|
|
||||||
if (ImGuiComponents.IconButton($"##Down{i}", FontAwesomeIcon.ArrowDown))
|
|
||||||
{
|
|
||||||
itemToAdd = item;
|
|
||||||
indexToAdd = i + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui.EndDisabled();
|
|
||||||
|
|
||||||
ImGui.SameLine();
|
|
||||||
if (ImGuiComponents.IconButton($"##Remove{i}", FontAwesomeIcon.Times))
|
if (ImGuiComponents.IconButton($"##Remove{i}", FontAwesomeIcon.Times))
|
||||||
itemToRemove = item;
|
itemToRemove = item;
|
||||||
|
|
||||||
@ -744,8 +754,20 @@ internal sealed class ConfigWindow : Window
|
|||||||
{
|
{
|
||||||
if (ImGui.BeginTabItem("Locked Items"))
|
if (ImGui.BeginTabItem("Locked Items"))
|
||||||
{
|
{
|
||||||
ImGui.Checkbox("Group by character", ref _checkPerCharacter);
|
bool checkPerCharacter = _configuration.ConfigUiOptions.CheckGatheredItemsPerCharacter;
|
||||||
ImGui.Checkbox("Only show missing items", ref _onlyShowMissing);
|
if (ImGui.Checkbox("Group by character", ref checkPerCharacter))
|
||||||
|
{
|
||||||
|
_configuration.ConfigUiOptions.CheckGatheredItemsPerCharacter = checkPerCharacter;
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool onlyShowMissing = _configuration.ConfigUiOptions.OnlyShowMissingGatheredItems;
|
||||||
|
if (ImGui.Checkbox("Only show missing items", ref onlyShowMissing))
|
||||||
|
{
|
||||||
|
_configuration.ConfigUiOptions.OnlyShowMissingGatheredItems = onlyShowMissing;
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
||||||
var itemsToCheck =
|
var itemsToCheck =
|
||||||
@ -774,9 +796,9 @@ internal sealed class ConfigWindow : Window
|
|||||||
.Select(x => new CheckedCharacter(_configuration, x, itemsToCheck))
|
.Select(x => new CheckedCharacter(_configuration, x, itemsToCheck))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (_checkPerCharacter)
|
if (checkPerCharacter)
|
||||||
{
|
{
|
||||||
foreach (var ch in charactersToCheck.Where(x => x.ToCheck(_onlyShowMissing).Any()))
|
foreach (var ch in charactersToCheck.Where(x => x.ToCheck(onlyShowMissing).Any()))
|
||||||
{
|
{
|
||||||
bool currentCharacter = _clientState.LocalContentId == ch.Character.LocalContentId;
|
bool currentCharacter = _clientState.LocalContentId == ch.Character.LocalContentId;
|
||||||
ImGui.BeginDisabled(currentCharacter);
|
ImGui.BeginDisabled(currentCharacter);
|
||||||
@ -801,7 +823,7 @@ internal sealed class ConfigWindow : Window
|
|||||||
{
|
{
|
||||||
ImGui.Indent(30);
|
ImGui.Indent(30);
|
||||||
foreach (var item in itemsToCheck.Where(x =>
|
foreach (var item in itemsToCheck.Where(x =>
|
||||||
ch.ToCheck(_onlyShowMissing).ContainsKey(x.ItemId)))
|
ch.ToCheck(onlyShowMissing).ContainsKey(x.ItemId)))
|
||||||
{
|
{
|
||||||
var color = ch.Items[item.ItemId];
|
var color = ch.Items[item.ItemId];
|
||||||
if (color != ColorGrey)
|
if (color != ColorGrey)
|
||||||
@ -839,7 +861,7 @@ internal sealed class ConfigWindow : Window
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (var item in itemsToCheck.Where(x =>
|
foreach (var item in itemsToCheck.Where(x =>
|
||||||
charactersToCheck.Any(y => y.ToCheck(_onlyShowMissing).ContainsKey(x.ItemId))))
|
charactersToCheck.Any(y => y.ToCheck(onlyShowMissing).ContainsKey(x.ItemId))))
|
||||||
{
|
{
|
||||||
if (ImGui.CollapsingHeader($"{item.GatheredItem.Name}##Gathered{item.GatheredItem.ItemId}"))
|
if (ImGui.CollapsingHeader($"{item.GatheredItem.Name}##Gathered{item.GatheredItem.ItemId}"))
|
||||||
{
|
{
|
||||||
@ -847,7 +869,7 @@ internal sealed class ConfigWindow : Window
|
|||||||
foreach (var ch in charactersToCheck)
|
foreach (var ch in charactersToCheck)
|
||||||
{
|
{
|
||||||
var color = ch.Items[item.ItemId];
|
var color = ch.Items[item.ItemId];
|
||||||
if (color == ColorRed || (color == ColorGreen && !_onlyShowMissing))
|
if (color == ColorRed || (color == ColorGreen && !onlyShowMissing))
|
||||||
ImGui.TextColored(color, ch.Character.ToString());
|
ImGui.TextColored(color, ch.Character.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -866,7 +888,7 @@ internal sealed class ConfigWindow : Window
|
|||||||
|
|
||||||
List<(Guid Id, string Name, Configuration.ItemList List)> itemLists = new List<Configuration.ItemList>
|
List<(Guid Id, string Name, Configuration.ItemList List)> itemLists = new List<Configuration.ItemList>
|
||||||
{
|
{
|
||||||
new Configuration.ItemList
|
new()
|
||||||
{
|
{
|
||||||
Id = Guid.Empty,
|
Id = Guid.Empty,
|
||||||
Name = "---",
|
Name = "---",
|
||||||
@ -874,7 +896,7 @@ internal sealed class ConfigWindow : Window
|
|||||||
Priority = Configuration.ListPriority.InOrder,
|
Priority = Configuration.ListPriority.InOrder,
|
||||||
}
|
}
|
||||||
}.Concat(_configuration.ItemLists)
|
}.Concat(_configuration.ItemLists)
|
||||||
.Select(x => (x.Id, x.Name, x)).ToList();
|
.Select(x => (x.Id, $"{x.Name} {x.GetIcon()}".TrimEnd(), x)).ToList();
|
||||||
int? itemToRemove = null;
|
int? itemToRemove = null;
|
||||||
int? itemToAdd = null;
|
int? itemToAdd = null;
|
||||||
int indexToAdd = 0;
|
int indexToAdd = 0;
|
||||||
@ -892,27 +914,42 @@ internal sealed class ConfigWindow : Window
|
|||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
if (selectedLists.Count > 1)
|
||||||
ImGui.BeginDisabled(i == 0);
|
|
||||||
if (ImGuiComponents.IconButton($"##Up{i}", FontAwesomeIcon.ArrowUp))
|
|
||||||
{
|
{
|
||||||
itemToAdd = i;
|
bool wrap = _configuration.ConfigUiOptions.WrapAroundWhenReordering;
|
||||||
indexToAdd = i - 1;
|
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGui.BeginDisabled(i == 0 && !wrap);
|
||||||
|
if (ImGuiComponents.IconButton($"##Up{i}", FontAwesomeIcon.ArrowUp))
|
||||||
|
{
|
||||||
|
itemToAdd = i;
|
||||||
|
if (i > 0)
|
||||||
|
indexToAdd = i - 1;
|
||||||
|
else
|
||||||
|
indexToAdd = selectedLists.Count - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.EndDisabled();
|
||||||
|
|
||||||
|
ImGui.SameLine(0, 0);
|
||||||
|
ImGui.BeginDisabled(i == selectedLists.Count - 1 && !wrap);
|
||||||
|
if (ImGuiComponents.IconButton($"##Down{i}", FontAwesomeIcon.ArrowDown))
|
||||||
|
{
|
||||||
|
itemToAdd = i;
|
||||||
|
if (i < selectedLists.Count - 1)
|
||||||
|
indexToAdd = i + 1;
|
||||||
|
else
|
||||||
|
indexToAdd = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.EndDisabled();
|
||||||
|
ImGui.SameLine();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui.SameLine(0, 58);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndDisabled();
|
|
||||||
|
|
||||||
ImGui.SameLine(0, 0);
|
|
||||||
ImGui.BeginDisabled(i == selectedLists.Count - 1);
|
|
||||||
if (ImGuiComponents.IconButton($"##Down{i}", FontAwesomeIcon.ArrowDown))
|
|
||||||
{
|
|
||||||
itemToAdd = i;
|
|
||||||
indexToAdd = i + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui.EndDisabled();
|
|
||||||
|
|
||||||
ImGui.SameLine();
|
|
||||||
if (ImGuiComponents.IconButton($"##Remove{i}", FontAwesomeIcon.Times))
|
if (ImGuiComponents.IconButton($"##Remove{i}", FontAwesomeIcon.Times))
|
||||||
itemToRemove = i;
|
itemToRemove = i;
|
||||||
|
|
||||||
@ -924,13 +961,13 @@ internal sealed class ConfigWindow : Window
|
|||||||
ImGui.TextColored(ImGuiColors.DalamudYellow, "This entry is a duplicate and will be ignored.");
|
ImGui.TextColored(ImGuiColors.DalamudYellow, "This entry is a duplicate and will be ignored.");
|
||||||
ImGui.Unindent(30);
|
ImGui.Unindent(30);
|
||||||
}
|
}
|
||||||
else
|
else if (_configuration.ConfigUiOptions.ShowVentureListContents)
|
||||||
{
|
{
|
||||||
var list = itemLists[listIndex].List;
|
var list = itemLists[listIndex].List;
|
||||||
ImGui.Indent(30);
|
ImGui.Indent(30);
|
||||||
ImGui.Text(list.Type == Configuration.ListType.CollectOneTime
|
ImGui.Text(list.Type == Configuration.ListType.CollectOneTime
|
||||||
? $"{list.GetIcon()} Items on this list will be collected once."
|
? "Items on this list will be collected once."
|
||||||
: $"{list.GetIcon()} Items on this list will be kept in stock on each character.");
|
: "Items on this list will be kept in stock on each character.");
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
foreach (var item in list.Items)
|
foreach (var item in list.Items)
|
||||||
{
|
{
|
||||||
@ -983,6 +1020,29 @@ internal sealed class ConfigWindow : Window
|
|||||||
ImGui.PopID();
|
ImGui.PopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DrawUiTab()
|
||||||
|
{
|
||||||
|
if (ImGui.BeginTabItem("UI"))
|
||||||
|
{
|
||||||
|
bool showContents = _configuration.ConfigUiOptions.ShowVentureListContents;
|
||||||
|
if (ImGui.Checkbox("Show Venture List preview in Groups/Retainer tabs", ref showContents))
|
||||||
|
{
|
||||||
|
_configuration.ConfigUiOptions.ShowVentureListContents = showContents;
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wrapAroundWhenReordering = _configuration.ConfigUiOptions.WrapAroundWhenReordering;
|
||||||
|
if (ImGui.Checkbox("Allow sorting with up/down arrows to wrap around", ref wrapAroundWhenReordering))
|
||||||
|
{
|
||||||
|
_configuration.ConfigUiOptions.WrapAroundWhenReordering = wrapAroundWhenReordering;
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
ImGuiComponents.HelpMarker("When enabled:\n- Clicking the Up-Arrow for the first item in a list, that item will be moved to the bottom.\n- Clicking the Down-Arrow for the last item in the list, that item will be moved to the top.");
|
||||||
|
|
||||||
|
ImGui.EndTabItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Save()
|
private void Save()
|
||||||
{
|
{
|
||||||
_pluginInterface.SavePluginConfig(_configuration);
|
_pluginInterface.SavePluginConfig(_configuration);
|
||||||
|
2
LLib
2
LLib
@ -1 +1 @@
|
|||||||
Subproject commit e59d291f04473eae0b76712397733e2e25349953
|
Subproject commit 2f6ef354c401a9f1bb9b807327acad7e98662a2e
|
Loading…
Reference in New Issue
Block a user