mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Add image strings to groups and mods to keep them in the json on saves.
This commit is contained in:
parent
40be298d67
commit
22af545e8d
8 changed files with 19 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ public interface IModGroup
|
|||
public Mod Mod { get; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Image { get; set; }
|
||||
public GroupType Type { get; }
|
||||
public GroupDrawBehaviour Behaviour { get; }
|
||||
public ModPriority Priority { get; set; }
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ public class ImcModGroup(Mod mod) : IModGroup
|
|||
public Mod Mod { get; } = mod;
|
||||
public string Name { get; set; } = "Option";
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public string Image { get; set; } = string.Empty;
|
||||
|
||||
public GroupType Type
|
||||
=> GroupType.Imc;
|
||||
|
|
@ -170,6 +171,7 @@ public class ImcModGroup(Mod mod) : IModGroup
|
|||
{
|
||||
Name = json[nameof(Name)]?.ToObject<string>() ?? string.Empty,
|
||||
Description = json[nameof(Description)]?.ToObject<string>() ?? string.Empty,
|
||||
Image = json[nameof(Image)]?.ToObject<string>() ?? string.Empty,
|
||||
Priority = json[nameof(Priority)]?.ToObject<ModPriority>() ?? ModPriority.Default,
|
||||
DefaultEntry = json[nameof(DefaultEntry)]?.ToObject<ImcEntry>() ?? new ImcEntry(),
|
||||
AllVariants = json[nameof(AllVariants)]?.ToObject<bool>() ?? false,
|
||||
|
|
|
|||
|
|
@ -88,6 +88,8 @@ public readonly struct ModSaveGroup : ISavable
|
|||
jWriter.WriteValue(group.Name);
|
||||
jWriter.WritePropertyName(nameof(group.Description));
|
||||
jWriter.WriteValue(group.Description);
|
||||
jWriter.WritePropertyName(nameof(group.Image));
|
||||
jWriter.WriteValue(group.Image);
|
||||
jWriter.WritePropertyName(nameof(group.Priority));
|
||||
jWriter.WriteValue(group.Priority.Value);
|
||||
jWriter.WritePropertyName(nameof(group.Type));
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ public sealed class MultiModGroup(Mod mod) : IModGroup, ITexToolsGroup
|
|||
public Mod Mod { get; } = mod;
|
||||
public string Name { get; set; } = "Group";
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public string Image { get; set; } = string.Empty;
|
||||
public ModPriority Priority { get; set; }
|
||||
public Setting DefaultSettings { get; set; }
|
||||
public readonly List<MultiSubMod> OptionData = [];
|
||||
|
|
@ -69,6 +70,7 @@ public sealed class MultiModGroup(Mod mod) : IModGroup, ITexToolsGroup
|
|||
{
|
||||
Name = json[nameof(Name)]?.ToObject<string>() ?? string.Empty,
|
||||
Description = json[nameof(Description)]?.ToObject<string>() ?? string.Empty,
|
||||
Image = json[nameof(Image)]?.ToObject<string>() ?? string.Empty,
|
||||
Priority = json[nameof(Priority)]?.ToObject<ModPriority>() ?? ModPriority.Default,
|
||||
DefaultSettings = json[nameof(DefaultSettings)]?.ToObject<Setting>() ?? Setting.Zero,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ public sealed class SingleModGroup(Mod mod) : IModGroup, ITexToolsGroup
|
|||
public Mod Mod { get; } = mod;
|
||||
public string Name { get; set; } = "Option";
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public string Image { get; set; } = string.Empty;
|
||||
public ModPriority Priority { get; set; }
|
||||
public Setting DefaultSettings { get; set; }
|
||||
|
||||
|
|
@ -65,6 +66,7 @@ public sealed class SingleModGroup(Mod mod) : IModGroup, ITexToolsGroup
|
|||
{
|
||||
Name = json[nameof(Name)]?.ToObject<string>() ?? string.Empty,
|
||||
Description = json[nameof(Description)]?.ToObject<string>() ?? string.Empty,
|
||||
Image = json[nameof(Image)]?.ToObject<string>() ?? string.Empty,
|
||||
Priority = json[nameof(Priority)]?.ToObject<ModPriority>() ?? ModPriority.Default,
|
||||
DefaultSettings = json[nameof(DefaultSettings)]?.ToObject<Setting>() ?? Setting.Zero,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ public enum ModDataChangeType : ushort
|
|||
Favorite = 0x0200,
|
||||
LocalTags = 0x0400,
|
||||
Note = 0x0800,
|
||||
Image = 0x1000,
|
||||
}
|
||||
|
||||
public class ModDataEditor(SaveService saveService, CommunicatorService communicatorService) : IService
|
||||
|
|
@ -113,6 +114,7 @@ public class ModDataEditor(SaveService saveService, CommunicatorService communic
|
|||
var newName = json[nameof(Mod.Name)]?.Value<string>() ?? string.Empty;
|
||||
var newAuthor = json[nameof(Mod.Author)]?.Value<string>() ?? string.Empty;
|
||||
var newDescription = json[nameof(Mod.Description)]?.Value<string>() ?? string.Empty;
|
||||
var newImage = json[nameof(Mod.Image)]?.Value<string>() ?? string.Empty;
|
||||
var newVersion = json[nameof(Mod.Version)]?.Value<string>() ?? string.Empty;
|
||||
var newWebsite = json[nameof(Mod.Website)]?.Value<string>() ?? string.Empty;
|
||||
var newFileVersion = json[nameof(ModMeta.FileVersion)]?.Value<uint>() ?? 0;
|
||||
|
|
@ -138,6 +140,12 @@ public class ModDataEditor(SaveService saveService, CommunicatorService communic
|
|||
mod.Description = newDescription;
|
||||
}
|
||||
|
||||
if (mod.Image != newImage)
|
||||
{
|
||||
changes |= ModDataChangeType.Image;
|
||||
mod.Image = newImage;
|
||||
}
|
||||
|
||||
if (mod.Version != newVersion)
|
||||
{
|
||||
changes |= ModDataChangeType.Version;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ public sealed class Mod : IMod
|
|||
public string Description { get; internal set; } = string.Empty;
|
||||
public string Version { get; internal set; } = string.Empty;
|
||||
public string Website { get; internal set; } = string.Empty;
|
||||
public string Image { get; internal set; } = string.Empty;
|
||||
public IReadOnlyList<string> ModTags { get; internal set; } = [];
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ public readonly struct ModMeta(Mod mod) : ISavable
|
|||
{ nameof(Mod.Name), JToken.FromObject(mod.Name) },
|
||||
{ nameof(Mod.Author), JToken.FromObject(mod.Author) },
|
||||
{ nameof(Mod.Description), JToken.FromObject(mod.Description) },
|
||||
{ nameof(Mod.Image), JToken.FromObject(mod.Image) },
|
||||
{ nameof(Mod.Version), JToken.FromObject(mod.Version) },
|
||||
{ nameof(Mod.Website), JToken.FromObject(mod.Website) },
|
||||
{ nameof(Mod.ModTags), JToken.FromObject(mod.ModTags) },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue