mirror of
https://github.com/ppy/osu.git
synced 2025-03-17 22:17:25 +08:00
Merge pull request #14935 from Susko3/fix-SettingsTextBox-using-null-as-default
Fix usages of `SettingsTextBox` having `null` as the default
This commit is contained in:
commit
9be56829c9
@ -53,7 +53,11 @@ namespace osu.Game.Tests.Visual.Settings
|
||||
};
|
||||
|
||||
[SettingSource("Sample string", "Change something for a mod")]
|
||||
public Bindable<string> StringBindable { get; } = new Bindable<string>();
|
||||
public Bindable<string> StringBindable { get; } = new Bindable<string>
|
||||
{
|
||||
Default = string.Empty,
|
||||
Value = "Sample text"
|
||||
};
|
||||
}
|
||||
|
||||
private enum TestEnum
|
||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Tournament.Components
|
||||
|
||||
public DateTextBox()
|
||||
{
|
||||
base.Current = new Bindable<string>();
|
||||
base.Current = new Bindable<string>(string.Empty);
|
||||
|
||||
((OsuTextBox)Control).OnCommit += (sender, newText) =>
|
||||
{
|
||||
|
@ -10,7 +10,7 @@ namespace osu.Game.Tournament.Models
|
||||
{
|
||||
public List<SeedingBeatmap> Beatmaps = new List<SeedingBeatmap>();
|
||||
|
||||
public Bindable<string> Mod = new Bindable<string>();
|
||||
public Bindable<string> Mod = new Bindable<string>(string.Empty);
|
||||
|
||||
public Bindable<int> Seed = new BindableInt
|
||||
{
|
||||
|
@ -14,8 +14,8 @@ namespace osu.Game.Tournament.Models
|
||||
[Serializable]
|
||||
public class TournamentRound
|
||||
{
|
||||
public readonly Bindable<string> Name = new Bindable<string>();
|
||||
public readonly Bindable<string> Description = new Bindable<string>();
|
||||
public readonly Bindable<string> Name = new Bindable<string>(string.Empty);
|
||||
public readonly Bindable<string> Description = new Bindable<string>(string.Empty);
|
||||
|
||||
public readonly BindableInt BestOf = new BindableInt(9) { Default = 9, MinValue = 3, MaxValue = 23 };
|
||||
|
||||
|
@ -149,7 +149,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
|
||||
private readonly Bindable<int?> beatmapId = new Bindable<int?>();
|
||||
|
||||
private readonly Bindable<string> mods = new Bindable<string>();
|
||||
private readonly Bindable<string> mods = new Bindable<string>(string.Empty);
|
||||
|
||||
private readonly Container drawableContainer;
|
||||
|
||||
|
@ -149,7 +149,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
|
||||
private readonly Bindable<int?> beatmapId = new Bindable<int?>();
|
||||
|
||||
private readonly Bindable<string> score = new Bindable<string>();
|
||||
private readonly Bindable<string> score = new Bindable<string>(string.Empty);
|
||||
|
||||
private readonly Container drawableContainer;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Settings
|
||||
@ -13,5 +15,17 @@ namespace osu.Game.Overlays.Settings
|
||||
RelativeSizeAxes = Axes.X,
|
||||
CommitOnFocusLost = true
|
||||
};
|
||||
|
||||
public override Bindable<string> Current
|
||||
{
|
||||
get => base.Current;
|
||||
set
|
||||
{
|
||||
if (value.Default == null)
|
||||
throw new InvalidOperationException($"Bindable settings of type {nameof(Bindable<string>)} should have a non-null default value.");
|
||||
|
||||
base.Current = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user