mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Moved the string
to int?
conversion logic into SettingsNumberBox
This commit is contained in:
@ -147,7 +147,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
[Resolved]
|
||||
protected IAPIProvider API { get; private set; }
|
||||
|
||||
private readonly Bindable<string> beatmapId = new Bindable<string>();
|
||||
private readonly Bindable<int?> beatmapId = new Bindable<int?>();
|
||||
|
||||
private readonly Bindable<string> mods = new Bindable<string>();
|
||||
|
||||
@ -220,14 +220,12 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetStore rulesets)
|
||||
{
|
||||
beatmapId.Value = Model.ID.ToString();
|
||||
beatmapId.BindValueChanged(idString =>
|
||||
beatmapId.Value = Model.ID;
|
||||
beatmapId.BindValueChanged(idInt =>
|
||||
{
|
||||
int.TryParse(idString.NewValue, out var parsed);
|
||||
Model.ID = idInt.NewValue ?? 0;
|
||||
|
||||
Model.ID = parsed;
|
||||
|
||||
if (idString.NewValue != idString.OldValue)
|
||||
if (idInt.NewValue != idInt.OldValue)
|
||||
Model.BeatmapInfo = null;
|
||||
|
||||
if (Model.BeatmapInfo != null)
|
||||
|
@ -147,7 +147,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
[Resolved]
|
||||
protected IAPIProvider API { get; private set; }
|
||||
|
||||
private readonly Bindable<string> beatmapId = new Bindable<string>();
|
||||
private readonly Bindable<int?> beatmapId = new Bindable<int?>();
|
||||
|
||||
private readonly Bindable<string> score = new Bindable<string>();
|
||||
|
||||
@ -228,16 +228,12 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetStore rulesets)
|
||||
{
|
||||
beatmapId.Value = Model.ID.ToString();
|
||||
beatmapId.BindValueChanged(idString =>
|
||||
beatmapId.Value = Model.ID;
|
||||
beatmapId.BindValueChanged(idInt =>
|
||||
{
|
||||
int parsed;
|
||||
Model.ID = idInt.NewValue ?? 0;
|
||||
|
||||
int.TryParse(idString.NewValue, out parsed);
|
||||
|
||||
Model.ID = parsed;
|
||||
|
||||
if (idString.NewValue != idString.OldValue)
|
||||
if (idInt.NewValue != idInt.OldValue)
|
||||
Model.BeatmapInfo = null;
|
||||
|
||||
if (Model.BeatmapInfo != null)
|
||||
|
@ -214,7 +214,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
[Resolved]
|
||||
private TournamentGameBase game { get; set; }
|
||||
|
||||
private readonly Bindable<string> userId = new Bindable<string>();
|
||||
private readonly Bindable<int?> userId = new Bindable<int?>();
|
||||
|
||||
private readonly Container drawableContainer;
|
||||
|
||||
@ -278,14 +278,12 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
userId.Value = user.Id.ToString();
|
||||
userId.BindValueChanged(idString =>
|
||||
userId.Value = user.Id;
|
||||
userId.BindValueChanged(idInt =>
|
||||
{
|
||||
int.TryParse(idString.NewValue, out var parsed);
|
||||
user.Id = idInt.NewValue ?? 0;
|
||||
|
||||
user.Id = parsed;
|
||||
|
||||
if (idString.NewValue != idString.OldValue)
|
||||
if (idInt.NewValue != idInt.OldValue)
|
||||
user.Username = string.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(user.Username))
|
||||
|
Reference in New Issue
Block a user