mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-15 13:14:17 +01:00
Wow, I accidentally the whole UI
This commit is contained in:
parent
dd8c910597
commit
651c7410ac
87 changed files with 7571 additions and 7280 deletions
|
|
@ -11,7 +11,7 @@ using OtterGui.Widgets;
|
|||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.Import;
|
||||
using Penumbra.Mods;
|
||||
using Penumbra.Services;
|
||||
using Penumbra.Services;
|
||||
using Penumbra.UI;
|
||||
using Penumbra.UI.Classes;
|
||||
using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs;
|
||||
|
|
@ -29,25 +29,26 @@ public class Configuration : IPluginConfiguration
|
|||
|
||||
public int Version { get; set; } = Constants.CurrentVersion;
|
||||
|
||||
public int LastSeenVersion { get; set; } = PenumbraChangelog.LastChangelogVersion;
|
||||
public int LastSeenVersion { get; set; } = PenumbraChangelog.LastChangelogVersion;
|
||||
public ChangeLogDisplayType ChangeLogDisplayType { get; set; } = ChangeLogDisplayType.New;
|
||||
|
||||
public bool EnableMods { get; set; } = true;
|
||||
public string ModDirectory { get; set; } = string.Empty;
|
||||
public bool EnableMods { get; set; } = true;
|
||||
public string ModDirectory { get; set; } = string.Empty;
|
||||
public string ExportDirectory { get; set; } = string.Empty;
|
||||
|
||||
public bool HideUiInGPose { get; set; } = false;
|
||||
public bool HideUiInCutscenes { get; set; } = true;
|
||||
public bool HideUiInGPose { get; set; } = false;
|
||||
public bool HideUiInCutscenes { get; set; } = true;
|
||||
public bool HideUiWhenUiHidden { get; set; } = false;
|
||||
|
||||
public bool UseCharacterCollectionInMainWindow { get; set; } = true;
|
||||
public bool UseCharacterCollectionsInCards { get; set; } = true;
|
||||
public bool UseCharacterCollectionInInspect { get; set; } = true;
|
||||
public bool UseCharacterCollectionInTryOn { get; set; } = true;
|
||||
public bool UseCharacterCollectionsInCards { get; set; } = true;
|
||||
public bool UseCharacterCollectionInInspect { get; set; } = true;
|
||||
public bool UseCharacterCollectionInTryOn { get; set; } = true;
|
||||
public bool UseOwnerNameForCharacterCollection { get; set; } = true;
|
||||
public bool UseNoModsInInspect { get; set; } = false;
|
||||
public bool UseNoModsInInspect { get; set; } = false;
|
||||
|
||||
public bool HideRedrawBar { get; set; } = false;
|
||||
public bool HideRedrawBar { get; set; } = false;
|
||||
public int OptionGroupCollapsibleMin { get; set; } = 5;
|
||||
|
||||
#if DEBUG
|
||||
public bool DebugMode { get; set; } = true;
|
||||
|
|
@ -63,35 +64,35 @@ public class Configuration : IPluginConfiguration
|
|||
public bool OnlyAddMatchingResources { get; set; } = true;
|
||||
public int MaxResourceWatcherRecords { get; set; } = ResourceWatcher.DefaultMaxEntries;
|
||||
|
||||
public ResourceTypeFlag ResourceWatcherResourceTypes { get; set; } = ResourceExtensions.AllResourceTypes;
|
||||
public ResourceCategoryFlag ResourceWatcherResourceCategories { get; set; } = ResourceExtensions.AllResourceCategories;
|
||||
public ResourceWatcher.RecordType ResourceWatcherRecordTypes { get; set; } = ResourceWatcher.AllRecords;
|
||||
public ResourceTypeFlag ResourceWatcherResourceTypes { get; set; } = ResourceExtensions.AllResourceTypes;
|
||||
public ResourceCategoryFlag ResourceWatcherResourceCategories { get; set; } = ResourceExtensions.AllResourceCategories;
|
||||
public ResourceWatcher.RecordType ResourceWatcherRecordTypes { get; set; } = ResourceWatcher.AllRecords;
|
||||
|
||||
|
||||
[JsonConverter( typeof( SortModeConverter ) )]
|
||||
[JsonProperty( Order = int.MaxValue )]
|
||||
public ISortMode< Mod > SortMode = ISortMode< Mod >.FoldersFirst;
|
||||
[JsonConverter(typeof(SortModeConverter))]
|
||||
[JsonProperty(Order = int.MaxValue)]
|
||||
public ISortMode<Mod> SortMode = ISortMode<Mod>.FoldersFirst;
|
||||
|
||||
public bool ScaleModSelector { get; set; } = false;
|
||||
public float ModSelectorAbsoluteSize { get; set; } = Constants.DefaultAbsoluteSize;
|
||||
public int ModSelectorScaledSize { get; set; } = Constants.DefaultScaledSize;
|
||||
public bool OpenFoldersByDefault { get; set; } = false;
|
||||
public int SingleGroupRadioMax { get; set; } = 2;
|
||||
public string DefaultImportFolder { get; set; } = string.Empty;
|
||||
public DoubleModifier DeleteModModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift);
|
||||
public bool ScaleModSelector { get; set; } = false;
|
||||
public float ModSelectorAbsoluteSize { get; set; } = Constants.DefaultAbsoluteSize;
|
||||
public int ModSelectorScaledSize { get; set; } = Constants.DefaultScaledSize;
|
||||
public bool OpenFoldersByDefault { get; set; } = false;
|
||||
public int SingleGroupRadioMax { get; set; } = 2;
|
||||
public string DefaultImportFolder { get; set; } = string.Empty;
|
||||
public DoubleModifier DeleteModModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift);
|
||||
|
||||
public bool PrintSuccessfulCommandsToChat { get; set; } = true;
|
||||
public bool FixMainWindow { get; set; } = false;
|
||||
public bool AutoDeduplicateOnImport { get; set; } = true;
|
||||
public bool EnableHttpApi { get; set; } = true;
|
||||
public bool FixMainWindow { get; set; } = false;
|
||||
public bool AutoDeduplicateOnImport { get; set; } = true;
|
||||
public bool EnableHttpApi { get; set; } = true;
|
||||
|
||||
public string DefaultModImportPath { get; set; } = string.Empty;
|
||||
public bool AlwaysOpenDefaultImport { get; set; } = false;
|
||||
public bool KeepDefaultMetaChanges { get; set; } = false;
|
||||
public string DefaultModAuthor { get; set; } = DefaultTexToolsData.Author;
|
||||
public string DefaultModImportPath { get; set; } = string.Empty;
|
||||
public bool AlwaysOpenDefaultImport { get; set; } = false;
|
||||
public bool KeepDefaultMetaChanges { get; set; } = false;
|
||||
public string DefaultModAuthor { get; set; } = DefaultTexToolsData.Author;
|
||||
|
||||
public Dictionary< ColorId, uint > Colors { get; set; }
|
||||
= Enum.GetValues< ColorId >().ToDictionary( c => c, c => c.Data().DefaultColor );
|
||||
public Dictionary<ColorId, uint> Colors { get; set; }
|
||||
= Enum.GetValues<ColorId>().ToDictionary(c => c, c => c.Data().DefaultColor);
|
||||
|
||||
/// <summary>
|
||||
/// Load the current configuration.
|
||||
|
|
@ -121,6 +122,7 @@ public class Configuration : IPluginConfiguration
|
|||
Error = HandleDeserializationError,
|
||||
});
|
||||
}
|
||||
|
||||
migrator.Migrate(this);
|
||||
}
|
||||
|
||||
|
|
@ -129,17 +131,17 @@ public class Configuration : IPluginConfiguration
|
|||
{
|
||||
try
|
||||
{
|
||||
var text = JsonConvert.SerializeObject( this, Formatting.Indented );
|
||||
File.WriteAllText( _fileName, text );
|
||||
var text = JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
File.WriteAllText(_fileName, text);
|
||||
}
|
||||
catch( Exception e )
|
||||
catch (Exception e)
|
||||
{
|
||||
Penumbra.Log.Error( $"Could not save plugin configuration:\n{e}" );
|
||||
Penumbra.Log.Error($"Could not save plugin configuration:\n{e}");
|
||||
}
|
||||
}
|
||||
|
||||
public void Save()
|
||||
=> _framework.RegisterDelayed( nameof( SaveConfiguration ), SaveConfiguration );
|
||||
=> _framework.RegisterDelayed(nameof(SaveConfiguration), SaveConfiguration);
|
||||
|
||||
/// <summary> Contains some default values or boundaries for config values. </summary>
|
||||
public static class Constants
|
||||
|
|
@ -152,41 +154,39 @@ public class Configuration : IPluginConfiguration
|
|||
public const int DefaultScaledSize = 20;
|
||||
public const int MinScaledSize = 5;
|
||||
|
||||
public static readonly ISortMode< Mod >[] ValidSortModes =
|
||||
public static readonly ISortMode<Mod>[] ValidSortModes =
|
||||
{
|
||||
ISortMode< Mod >.FoldersFirst,
|
||||
ISortMode< Mod >.Lexicographical,
|
||||
ISortMode<Mod>.FoldersFirst,
|
||||
ISortMode<Mod>.Lexicographical,
|
||||
new ModFileSystem.ImportDate(),
|
||||
new ModFileSystem.InverseImportDate(),
|
||||
ISortMode< Mod >.InverseFoldersFirst,
|
||||
ISortMode< Mod >.InverseLexicographical,
|
||||
ISortMode< Mod >.FoldersLast,
|
||||
ISortMode< Mod >.InverseFoldersLast,
|
||||
ISortMode< Mod >.InternalOrder,
|
||||
ISortMode< Mod >.InverseInternalOrder,
|
||||
ISortMode<Mod>.InverseFoldersFirst,
|
||||
ISortMode<Mod>.InverseLexicographical,
|
||||
ISortMode<Mod>.FoldersLast,
|
||||
ISortMode<Mod>.InverseFoldersLast,
|
||||
ISortMode<Mod>.InternalOrder,
|
||||
ISortMode<Mod>.InverseInternalOrder,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary> Convert SortMode Types to their name. </summary>
|
||||
private class SortModeConverter : JsonConverter< ISortMode< Mod > >
|
||||
private class SortModeConverter : JsonConverter<ISortMode<Mod>>
|
||||
{
|
||||
public override void WriteJson( JsonWriter writer, ISortMode< Mod >? value, JsonSerializer serializer )
|
||||
public override void WriteJson(JsonWriter writer, ISortMode<Mod>? value, JsonSerializer serializer)
|
||||
{
|
||||
value ??= ISortMode< Mod >.FoldersFirst;
|
||||
serializer.Serialize( writer, value.GetType().Name );
|
||||
value ??= ISortMode<Mod>.FoldersFirst;
|
||||
serializer.Serialize(writer, value.GetType().Name);
|
||||
}
|
||||
|
||||
public override ISortMode< Mod > ReadJson( JsonReader reader, Type objectType, ISortMode< Mod >? existingValue,
|
||||
public override ISortMode<Mod> ReadJson(JsonReader reader, Type objectType, ISortMode<Mod>? existingValue,
|
||||
bool hasExistingValue,
|
||||
JsonSerializer serializer )
|
||||
JsonSerializer serializer)
|
||||
{
|
||||
var name = serializer.Deserialize< string >( reader );
|
||||
if( name == null || !Constants.ValidSortModes.FindFirst( s => s.GetType().Name == name, out var mode ) )
|
||||
{
|
||||
return existingValue ?? ISortMode< Mod >.FoldersFirst;
|
||||
}
|
||||
var name = serializer.Deserialize<string>(reader);
|
||||
if (name == null || !Constants.ValidSortModes.FindFirst(s => s.GetType().Name == name, out var mode))
|
||||
return existingValue ?? ISortMode<Mod>.FoldersFirst;
|
||||
|
||||
return mode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue