mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-20 06:47:46 +01:00
Current State.
This commit is contained in:
parent
98a89bb2b4
commit
282189ef6d
9 changed files with 115 additions and 56 deletions
|
|
@ -36,17 +36,11 @@ public class ModSelection : EventWrapper<Mod?, Mod?, ModSelection.Priority>
|
|||
_communicator.ModSettingChanged.Subscribe(OnSettingChange, ModSettingChanged.Priority.ModSelection);
|
||||
}
|
||||
|
||||
public ModSettings Settings { get; private set; } = ModSettings.Empty;
|
||||
public ModCollection Collection { get; private set; } = ModCollection.Empty;
|
||||
public Mod? Mod { get; private set; }
|
||||
public ModSettings? OwnSettings { get; private set; }
|
||||
|
||||
public bool IsTemporary
|
||||
=> OwnSettings != Settings;
|
||||
|
||||
public TemporaryModSettings? AsTemporarySettings
|
||||
=> Settings as TemporaryModSettings;
|
||||
|
||||
public ModSettings Settings { get; private set; } = ModSettings.Empty;
|
||||
public ModCollection Collection { get; private set; } = ModCollection.Empty;
|
||||
public Mod? Mod { get; private set; }
|
||||
public ModSettings? OwnSettings { get; private set; }
|
||||
public TemporaryModSettings? TemporarySettings { get; private set; }
|
||||
|
||||
public void SelectMod(Mod? mod)
|
||||
{
|
||||
|
|
@ -98,6 +92,7 @@ public class ModSelection : EventWrapper<Mod?, Mod?, ModSelection.Priority>
|
|||
{
|
||||
(var settings, Collection) = _collections.Current.GetActualSettings(Mod.Index);
|
||||
OwnSettings = _collections.Current.GetOwnSettings(Mod.Index);
|
||||
TemporarySettings = _collections.Current.GetTempSettings(Mod.Index);
|
||||
Settings = settings ?? ModSettings.Empty;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ namespace Penumbra.Mods.Settings;
|
|||
public class ModSettings
|
||||
{
|
||||
public static readonly ModSettings Empty = new();
|
||||
|
||||
public SettingList Settings { get; internal init; } = [];
|
||||
public ModPriority Priority { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
|
|
|
|||
|
|
@ -5,4 +5,21 @@ public sealed class TemporaryModSettings : ModSettings
|
|||
public string Source = string.Empty;
|
||||
public int Lock = 0;
|
||||
public bool ForceInherit;
|
||||
|
||||
// Create default settings for a given mod.
|
||||
public static TemporaryModSettings DefaultSettings(Mod mod, string source, int key = 0)
|
||||
=> new()
|
||||
{
|
||||
Enabled = false,
|
||||
Source = source,
|
||||
Lock = key,
|
||||
Priority = ModPriority.Default,
|
||||
Settings = SettingList.Default(mod),
|
||||
};
|
||||
}
|
||||
|
||||
public static class ModSettingsExtensions
|
||||
{
|
||||
public static bool IsTemporary(this ModSettings? settings)
|
||||
=> settings is TemporaryModSettings;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue