mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-15 21:24:18 +01:00
Some fixes.
This commit is contained in:
parent
2d5afde612
commit
f86f29b44a
2 changed files with 22 additions and 15 deletions
|
|
@ -158,10 +158,10 @@ public class ModOptionEditor(CommunicatorService communicator, SaveService saveS
|
||||||
{
|
{
|
||||||
var group = mod.Groups[groupIdx];
|
var group = mod.Groups[groupIdx];
|
||||||
var option = group[optionIdx];
|
var option = group[optionIdx];
|
||||||
if (option.Description == newDescription || option is not SubMod s)
|
if (option.Description == newDescription)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
s.Description = newDescription;
|
option.Description = newDescription;
|
||||||
saveService.QueueSave(new ModSaveGroup(mod, groupIdx, config.ReplaceNonAsciiOnImport));
|
saveService.QueueSave(new ModSaveGroup(mod, groupIdx, config.ReplaceNonAsciiOnImport));
|
||||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.DisplayChange, mod, groupIdx, optionIdx, -1);
|
communicator.ModOptionChanged.Invoke(ModOptionChangeType.DisplayChange, mod, groupIdx, optionIdx, -1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,8 +72,9 @@ public readonly struct ModSaveGroup : ISavable
|
||||||
|
|
||||||
public void Save(StreamWriter writer)
|
public void Save(StreamWriter writer)
|
||||||
{
|
{
|
||||||
using var j = new JsonTextWriter(writer) { Formatting = Formatting.Indented };
|
using var j = new JsonTextWriter(writer);
|
||||||
var serializer = new JsonSerializer { Formatting = Formatting.Indented };
|
j.Formatting = Formatting.Indented;
|
||||||
|
var serializer = new JsonSerializer { Formatting = Formatting.Indented };
|
||||||
if (_groupIdx >= 0)
|
if (_groupIdx >= 0)
|
||||||
{
|
{
|
||||||
j.WriteStartObject();
|
j.WriteStartObject();
|
||||||
|
|
@ -87,19 +88,25 @@ public readonly struct ModSaveGroup : ISavable
|
||||||
j.WriteValue(_group.Type.ToString());
|
j.WriteValue(_group.Type.ToString());
|
||||||
j.WritePropertyName(nameof(_group.DefaultSettings));
|
j.WritePropertyName(nameof(_group.DefaultSettings));
|
||||||
j.WriteValue(_group.DefaultSettings.Value);
|
j.WriteValue(_group.DefaultSettings.Value);
|
||||||
j.WritePropertyName("Options");
|
switch (_group)
|
||||||
j.WriteStartArray();
|
|
||||||
for (var idx = 0; idx < _group.Count; ++idx)
|
|
||||||
{
|
{
|
||||||
SubMod.WriteSubMod(j, serializer, _group[idx], _basePath, _group.Type switch
|
case SingleModGroup single:
|
||||||
{
|
j.WritePropertyName("Options");
|
||||||
GroupType.Multi => _group.OptionPriority(idx),
|
j.WriteStartArray();
|
||||||
_ => null,
|
foreach (var option in single.OptionData)
|
||||||
});
|
SubMod.WriteSubMod(j, serializer, option, _basePath, null);
|
||||||
|
j.WriteEndArray();
|
||||||
|
j.WriteEndObject();
|
||||||
|
break;
|
||||||
|
case MultiModGroup multi:
|
||||||
|
j.WritePropertyName("Options");
|
||||||
|
j.WriteStartArray();
|
||||||
|
foreach (var (option, priority) in multi.PrioritizedOptions)
|
||||||
|
SubMod.WriteSubMod(j, serializer, option, _basePath, priority);
|
||||||
|
j.WriteEndArray();
|
||||||
|
j.WriteEndObject();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
j.WriteEndArray();
|
|
||||||
j.WriteEndObject();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue