fixed min tickets being reset to 0 if an invalid input is given

This commit is contained in:
Ellpeck 2020-07-08 23:36:09 +02:00
parent ed322796a4
commit dd6b7fc89c

View file

@ -385,8 +385,10 @@ namespace TouchyTickets {
}); });
optionList.AddChild(new Paragraph(Anchor.AutoLeft, 1, Localization.Get("MinTicketsForAutoBuy") + ":")); optionList.AddChild(new Paragraph(Anchor.AutoLeft, 1, Localization.Get("MinTicketsForAutoBuy") + ":"));
var num = optionList.AddChild(ElementHelper.NumberField(Anchor.AutoLeft, new Vector2(1, 20), Options.Instance.MinTicketsForAutoBuy, 1000, null, (t, value) => { var num = optionList.AddChild(ElementHelper.NumberField(Anchor.AutoLeft, new Vector2(1, 20), Options.Instance.MinTicketsForAutoBuy, 1000, null, (t, value) => {
if (int.TryParse(value, out Options.Instance.MinTicketsForAutoBuy)) if (int.TryParse(value, out var ret)) {
Options.Instance.MinTicketsForAutoBuy = ret;
Options.Save(); Options.Save();
}
})); }));
num.PositionOffset = new Vector2(0, 1); num.PositionOffset = new Vector2(0, 1);
optionList.AddChild(new Paragraph(Anchor.AutoLeft, 1, p => Localization.Get("AutoBuyInterval") + ": " + Options.Instance.AutoBuyIntervalSecs)); optionList.AddChild(new Paragraph(Anchor.AutoLeft, 1, p => Localization.Get("AutoBuyInterval") + ": " + Options.Instance.AutoBuyIntervalSecs));