only save the options to disk

when they get removed from the ui
This commit is contained in:
Ell 2024-06-27 20:54:03 +02:00
parent 3da4807b57
commit c0cc18b0a0

View file

@ -152,11 +152,9 @@ public class ExampleMod : Mod {
group.AddChild(new Paragraph(Anchor.AutoLeft, 1, _ => $"{Localization.Get(LnCategory.Ui, "ExampleMod.DarkShirtSpeedOption")}: {ExampleMod.Options.DarkShirtSpeedIncrease}")); group.AddChild(new Paragraph(Anchor.AutoLeft, 1, _ => $"{Localization.Get(LnCategory.Ui, "ExampleMod.DarkShirtSpeedOption")}: {ExampleMod.Options.DarkShirtSpeedIncrease}"));
group.AddChild(new Slider(Anchor.AutoLeft, new Vector2(1, 10), 5, 5) { group.AddChild(new Slider(Anchor.AutoLeft, new Vector2(1, 10), 5, 5) {
CurrentValue = ExampleMod.Options.DarkShirtSpeedIncrease, CurrentValue = ExampleMod.Options.DarkShirtSpeedIncrease,
OnValueChanged = (_, v) => { OnValueChanged = (_, v) => ExampleMod.Options.DarkShirtSpeedIncrease = v
ExampleMod.Options.DarkShirtSpeedIncrease = v;
info.SaveOptions(ExampleMod.Options);
}
}); });
group.OnRemovedFromUi += _ => info.SaveOptions(ExampleMod.Options);
} }
} }