mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-15 05:04:15 +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 option = group[optionIdx];
|
||||
if (option.Description == newDescription || option is not SubMod s)
|
||||
if (option.Description == newDescription)
|
||||
return;
|
||||
|
||||
s.Description = newDescription;
|
||||
option.Description = newDescription;
|
||||
saveService.QueueSave(new ModSaveGroup(mod, groupIdx, config.ReplaceNonAsciiOnImport));
|
||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.DisplayChange, mod, groupIdx, optionIdx, -1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,8 +72,9 @@ public readonly struct ModSaveGroup : ISavable
|
|||
|
||||
public void Save(StreamWriter writer)
|
||||
{
|
||||
using var j = new JsonTextWriter(writer) { Formatting = Formatting.Indented };
|
||||
var serializer = new JsonSerializer { Formatting = Formatting.Indented };
|
||||
using var j = new JsonTextWriter(writer);
|
||||
j.Formatting = Formatting.Indented;
|
||||
var serializer = new JsonSerializer { Formatting = Formatting.Indented };
|
||||
if (_groupIdx >= 0)
|
||||
{
|
||||
j.WriteStartObject();
|
||||
|
|
@ -87,19 +88,25 @@ public readonly struct ModSaveGroup : ISavable
|
|||
j.WriteValue(_group.Type.ToString());
|
||||
j.WritePropertyName(nameof(_group.DefaultSettings));
|
||||
j.WriteValue(_group.DefaultSettings.Value);
|
||||
j.WritePropertyName("Options");
|
||||
j.WriteStartArray();
|
||||
for (var idx = 0; idx < _group.Count; ++idx)
|
||||
switch (_group)
|
||||
{
|
||||
SubMod.WriteSubMod(j, serializer, _group[idx], _basePath, _group.Type switch
|
||||
{
|
||||
GroupType.Multi => _group.OptionPriority(idx),
|
||||
_ => null,
|
||||
});
|
||||
case SingleModGroup single:
|
||||
j.WritePropertyName("Options");
|
||||
j.WriteStartArray();
|
||||
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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue