diff --git a/osu.Game.Tournament/Components/DateTextBox.cs b/osu.Game.Tournament/Components/DateTextBox.cs new file mode 100644 index 0000000000..171196f348 --- /dev/null +++ b/osu.Game.Tournament/Components/DateTextBox.cs @@ -0,0 +1,44 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Configuration; +using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays.Settings; + +namespace osu.Game.Tournament.Components +{ + public class DateTextBox : SettingsTextBox + { + public new Bindable Bindable + { + get { return bindable; } + + set + { + bindable = value; + bindable.BindValueChanged(dto => + base.Bindable.Value = dto.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"), true); + } + } + + // hold a reference to the provided bindable so we don't have to in every settings section. + private Bindable bindable; + + public DateTextBox() + { + base.Bindable = new Bindable(); + ((OsuTextBox)Control).OnCommit = (sender, newText) => + { + try + { + bindable.Value = DateTimeOffset.Parse(sender.Text); + } + catch + { + bindable.TriggerChange(); + } + }; + } + } +} diff --git a/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs b/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs index b0bd17fe83..d5d3d1dbda 100644 --- a/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs @@ -4,13 +4,13 @@ using System; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; +using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; namespace osu.Game.Tournament.Screens.Groupings @@ -74,7 +74,7 @@ namespace osu.Game.Tournament.Screens.Groupings updateGroupings(); } - private void updateGroupings() + private void updateGroupings() { LadderInfo.Groupings = items.Children.Select(c => c.Grouping).ToList(); } @@ -118,36 +118,4 @@ namespace osu.Game.Tournament.Screens.Groupings } } } - - public class DateTextBox : SettingsTextBox - { - public DateTextBox() - { - base.Bindable = new Bindable(); - ((OsuTextBox)Control).OnCommit = (sender, newText) => { - try - { - bindable.Value = DateTimeOffset.Parse(sender.Text); - } - catch - { - bindable.TriggerChange(); - } - }; - } - - // hold a reference to the provided bindable so we don't have to in every settings section. - private Bindable bindable; - - public new Bindable Bindable - { - get { return bindable; } - - set - { - bindable = value; - bindable.BindValueChanged(dto => base.Bindable.Value = dto.ToUniversalTime().ToString(), true); - } - } - } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index 34b16ccab3..bb80a845e3 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -12,7 +12,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; using osu.Game.Screens.Play.PlayerSettings; -using osu.Game.Tournament.Screens.Groupings; +using osu.Game.Tournament.Components; namespace osu.Game.Tournament.Screens.Ladder.Components {