Add descriptions for SubMods

Adjusted importing of TexTools mods to give each option its own description instead of combining all option descriptions into the group description.
This commit is contained in:
Caraxi 2023-02-04 17:26:13 +10:30
parent e34aca68aa
commit 9f6a45041d
7 changed files with 64 additions and 19 deletions

View file

@ -10,6 +10,7 @@ public interface ISubMod
{
public string Name { get; }
public string FullName { get; }
public string Description { get; }
public IReadOnlyDictionary< Utf8GamePath, FullPath > Files { get; }
public IReadOnlyDictionary< Utf8GamePath, FullPath > FileSwaps { get; }
@ -22,6 +23,8 @@ public interface ISubMod
j.WriteStartObject();
j.WritePropertyName( nameof( Name ) );
j.WriteValue( mod.Name );
j.WritePropertyName( nameof(Description) );
j.WriteValue( mod.Description );
if( priority != null )
{
j.WritePropertyName( nameof( IModGroup.Priority ) );

View file

@ -107,6 +107,8 @@ public partial class Mod
public string FullName
=> GroupIdx < 0 ? "Default Option" : $"{ParentMod.Groups[ GroupIdx ].Name}: {Name}";
public string Description { get; set; } = string.Empty;
internal IMod ParentMod { get; private init; }
internal int GroupIdx { get; private set; }
internal int OptionIdx { get; private set; }
@ -143,8 +145,9 @@ public partial class Mod
ManipulationData.Clear();
// Every option has a name, but priorities are only relevant for multi group options.
Name = json[ nameof( ISubMod.Name ) ]?.ToObject< string >() ?? string.Empty;
priority = json[ nameof( IModGroup.Priority ) ]?.ToObject< int >() ?? 0;
Name = json[ nameof( ISubMod.Name ) ]?.ToObject< string >() ?? string.Empty;
Description = json[ nameof( ISubMod.Description ) ]?.ToObject< string >() ?? string.Empty;
priority = json[ nameof( IModGroup.Priority ) ]?.ToObject< int >() ?? 0;
var files = ( JObject? )json[ nameof( Files ) ];
if( files != null )