mirror of
https://github.com/Ellpeck/TinyLifeExampleMod.git
synced 2024-11-22 20:08:34 +01:00
only save the options to disk
when they get removed from the ui
This commit is contained in:
parent
3da4807b57
commit
c0cc18b0a0
1 changed files with 2 additions and 4 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue