mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-16 13:44:17 +01:00
Remove OptionPriority from general option groups.
This commit is contained in:
parent
f86f29b44a
commit
b99a809eba
5 changed files with 25 additions and 14 deletions
|
|
@ -16,7 +16,7 @@ public interface IModGroup : IReadOnlyCollection<SubMod>
|
||||||
public ModPriority Priority { get; }
|
public ModPriority Priority { get; }
|
||||||
public Setting DefaultSettings { get; set; }
|
public Setting DefaultSettings { get; set; }
|
||||||
|
|
||||||
public ModPriority OptionPriority(Index optionIdx);
|
public FullPath? FindBestMatch(Utf8GamePath gamePath);
|
||||||
|
|
||||||
public SubMod this[Index idx] { get; }
|
public SubMod this[Index idx] { get; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,10 @@ public sealed class MultiModGroup : IModGroup
|
||||||
public ModPriority Priority { get; set; }
|
public ModPriority Priority { get; set; }
|
||||||
public Setting DefaultSettings { get; set; }
|
public Setting DefaultSettings { get; set; }
|
||||||
|
|
||||||
public ModPriority OptionPriority(Index idx)
|
public FullPath? FindBestMatch(Utf8GamePath gamePath)
|
||||||
=> PrioritizedOptions[idx].Priority;
|
=> PrioritizedOptions.OrderByDescending(o => o.Priority)
|
||||||
|
.SelectWhere(o => (o.Mod.FileData.TryGetValue(gamePath, out var file) || o.Mod.FileSwapData.TryGetValue(gamePath, out file), file))
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
public SubMod this[Index idx]
|
public SubMod this[Index idx]
|
||||||
=> PrioritizedOptions[idx].Mod;
|
=> PrioritizedOptions[idx].Mod;
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,10 @@ public sealed class SingleModGroup : IModGroup
|
||||||
|
|
||||||
public readonly List<SubMod> OptionData = [];
|
public readonly List<SubMod> OptionData = [];
|
||||||
|
|
||||||
public ModPriority OptionPriority(Index _)
|
public FullPath? FindBestMatch(Utf8GamePath gamePath)
|
||||||
=> Priority;
|
=> OptionData
|
||||||
|
.SelectWhere(m => (m.FileData.TryGetValue(gamePath, out var file) || m.FileSwapData.TryGetValue(gamePath, out file), file))
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
public SubMod this[Index idx]
|
public SubMod this[Index idx]
|
||||||
=> OptionData[idx];
|
=> OptionData[idx];
|
||||||
|
|
|
||||||
|
|
@ -540,11 +540,14 @@ public partial class ModEditWindow : Window, IDisposable
|
||||||
return currentFile.Value;
|
return currentFile.Value;
|
||||||
|
|
||||||
if (Mod != null)
|
if (Mod != null)
|
||||||
foreach (var option in Mod.Groups.OrderByDescending(g => g.Priority)
|
|
||||||
.SelectMany(g => g.WithIndex().OrderByDescending(o => g.OptionPriority(o.Index)).Select(g => g.Value))
|
|
||||||
.Append(Mod.Default))
|
|
||||||
{
|
{
|
||||||
if (option.Files.TryGetValue(path, out var value) || option.FileSwaps.TryGetValue(path, out value))
|
foreach (var option in Mod.Groups.OrderByDescending(g => g.Priority))
|
||||||
|
{
|
||||||
|
if (option.FindBestMatch(path) is { } fullPath)
|
||||||
|
return fullPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Mod.Default.Files.TryGetValue(path, out var value) || Mod.Default.FileSwaps.TryGetValue(path, out value))
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -532,10 +532,10 @@ public class ModPanelEditTab(
|
||||||
panel._delayedActions.Enqueue(() => panel._modManager.OptionEditor.DeleteOption(panel._mod, groupIdx, optionIdx));
|
panel._delayedActions.Enqueue(() => panel._modManager.OptionEditor.DeleteOption(panel._mod, groupIdx, optionIdx));
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
if (group.Type != GroupType.Multi)
|
if (group is not MultiModGroup multi)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Input.Priority("##Priority", groupIdx, optionIdx, group.OptionPriority(optionIdx), out var priority,
|
if (Input.Priority("##Priority", groupIdx, optionIdx, multi.PrioritizedOptions[optionIdx].Priority, out var priority,
|
||||||
50 * UiHelpers.Scale))
|
50 * UiHelpers.Scale))
|
||||||
panel._modManager.OptionEditor.ChangeOptionPriority(panel._mod, groupIdx, optionIdx, priority);
|
panel._modManager.OptionEditor.ChangeOptionPriority(panel._mod, groupIdx, optionIdx, priority);
|
||||||
|
|
||||||
|
|
@ -613,7 +613,11 @@ public class ModPanelEditTab(
|
||||||
var sourceGroup = panel._mod.Groups[sourceGroupIdx];
|
var sourceGroup = panel._mod.Groups[sourceGroupIdx];
|
||||||
var currentCount = group.Count;
|
var currentCount = group.Count;
|
||||||
var option = sourceGroup[sourceOption];
|
var option = sourceGroup[sourceOption];
|
||||||
var priority = sourceGroup.OptionPriority(_dragDropOptionIdx);
|
var priority = sourceGroup switch
|
||||||
|
{
|
||||||
|
MultiModGroup multi => multi.PrioritizedOptions[_dragDropOptionIdx].Priority,
|
||||||
|
_ => ModPriority.Default,
|
||||||
|
};
|
||||||
panel._delayedActions.Enqueue(() =>
|
panel._delayedActions.Enqueue(() =>
|
||||||
{
|
{
|
||||||
panel._modManager.OptionEditor.DeleteOption(panel._mod, sourceGroupIdx, sourceOption);
|
panel._modManager.OptionEditor.DeleteOption(panel._mod, sourceGroupIdx, sourceOption);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue