From bb6478cdc3e98dee0cbfb8a6d722d012ae556233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Thu, 10 May 2018 10:15:47 +0200 Subject: [PATCH 01/41] Adds a check to disable music controller's seek --- osu.Game/Overlays/MusicController.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index b4021f2808..0605b211b0 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -206,7 +206,7 @@ namespace osu.Game.Overlays Anchor = Anchor.BottomCentre, Height = progress_height, FillColour = colours.Yellow, - OnSeek = progress => current?.Track.Seek(progress) + OnSeek = progress => ConditionalSeek(progress) } }, }, @@ -219,6 +219,13 @@ namespace osu.Game.Overlays playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); } + private bool? ConditionalSeek(double progress) + { + if (current.Track.Looping) + return current?.Track.Seek(progress); + return false; + } + protected override void LoadComplete() { beatmapBacking.ValueChanged += beatmapChanged; From 5b99d8df62c5176f1400d41c81e88905d7c108e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Thu, 10 May 2018 11:29:19 +0200 Subject: [PATCH 02/41] Fixes private method name capitalization --- osu.Game/Overlays/MusicController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 0605b211b0..ee928b3ccc 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -206,7 +206,7 @@ namespace osu.Game.Overlays Anchor = Anchor.BottomCentre, Height = progress_height, FillColour = colours.Yellow, - OnSeek = progress => ConditionalSeek(progress) + OnSeek = progress => conditionalSeek(progress) } }, }, @@ -219,7 +219,7 @@ namespace osu.Game.Overlays playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); } - private bool? ConditionalSeek(double progress) + private bool? conditionalSeek(double progress) { if (current.Track.Looping) return current?.Track.Seek(progress); From d54a7295f6a72a49cd7d7eece02cbb4cdb30f5b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Thu, 10 May 2018 13:20:04 +0200 Subject: [PATCH 03/41] Adds DisableSeek property to MusicController --- osu.Game/OsuGame.cs | 9 ++++++--- osu.Game/Overlays/MusicController.cs | 6 +++--- osu.Game/Screens/OsuScreen.cs | 2 ++ osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs | 2 ++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index d443ed36ae..4d6b4520fe 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -537,10 +537,13 @@ namespace osu.Game // we only want to apply these restrictions when we are inside a screen stack. // the use case for not applying is in visual/unit tests. - bool applyRestrictions = !currentScreen?.AllowBeatmapRulesetChange ?? false; + bool applyBeatmapRulesetRestrictions = !currentScreen?.AllowBeatmapRulesetChange ?? false; + bool applyUserSeekRestrictions = !currentScreen?.AllowUserSeek ?? false; - Ruleset.Disabled = applyRestrictions; - Beatmap.Disabled = applyRestrictions; + Ruleset.Disabled = applyBeatmapRulesetRestrictions; + Beatmap.Disabled = applyBeatmapRulesetRestrictions; + + musicController.DisableSeek = applyUserSeekRestrictions; mainContent.Padding = new MarginPadding { Top = ToolbarOffset }; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index ee928b3ccc..9cfce04685 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -221,9 +221,7 @@ namespace osu.Game.Overlays private bool? conditionalSeek(double progress) { - if (current.Track.Looping) - return current?.Track.Seek(progress); - return false; + return DisableSeek ? false : current?.Track.Seek(progress); } protected override void LoadComplete() @@ -235,6 +233,8 @@ namespace osu.Game.Overlays base.LoadComplete(); } + public bool DisableSeek { get; set; } + private void beatmapDisabledChanged(bool disabled) { if (disabled) diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 7a910574e0..48c3d95b0c 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -50,6 +50,8 @@ namespace osu.Game.Screens /// public virtual bool AllowBeatmapRulesetChange => true; + public virtual bool AllowUserSeek => true; + protected readonly Bindable Beatmap = new Bindable(); protected virtual float BackgroundParallaxAmount => 1; diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 1ccc5e2fe8..add02732d4 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -17,6 +17,8 @@ namespace osu.Game.Screens.Play public override bool AllowBeatmapRulesetChange => false; + public override bool AllowUserSeek => false; + protected const float BACKGROUND_FADE_DURATION = 800; protected float BackgroundOpacity => 1 - (float)DimLevel; From a877855fc615f697d4d205a304d4dde62031e70a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Fri, 11 May 2018 09:39:55 +0200 Subject: [PATCH 04/41] Changes conditionSeek return type to void --- osu.Game/Overlays/MusicController.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 9cfce04685..a0074ccee7 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -219,9 +219,11 @@ namespace osu.Game.Overlays playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); } - private bool? conditionalSeek(double progress) + private void conditionalSeek(double progress) { - return DisableSeek ? false : current?.Track.Seek(progress); + if (DisableSeek) + return; + current?.Track.Seek(progress); } protected override void LoadComplete() From 17ed5e48390cb3d19fb8ae2554b86c6aa60a3985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Fri, 11 May 2018 09:41:31 +0200 Subject: [PATCH 05/41] Moves seek restrictions to Player --- osu.Game/Screens/Play/Player.cs | 2 ++ osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 83958b2912..8989cbaad4 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -45,6 +45,8 @@ namespace osu.Game.Screens.Play public bool AllowLeadIn { get; set; } = true; public bool AllowResults { get; set; } = true; + public override bool AllowUserSeek => false; + private Bindable mouseWheelDisabled; private Bindable userAudioOffset; diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index add02732d4..1ccc5e2fe8 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -17,8 +17,6 @@ namespace osu.Game.Screens.Play public override bool AllowBeatmapRulesetChange => false; - public override bool AllowUserSeek => false; - protected const float BACKGROUND_FADE_DURATION = 800; protected float BackgroundOpacity => 1 - (float)DimLevel; From c55d47ff1085d0b215f3619678bcbac277c63adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Fri, 11 May 2018 09:56:23 +0200 Subject: [PATCH 06/41] Converts OnSeek assignment to method group --- osu.Game/Overlays/MusicController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index a0074ccee7..45a59a0f87 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -206,7 +206,7 @@ namespace osu.Game.Overlays Anchor = Anchor.BottomCentre, Height = progress_height, FillColour = colours.Yellow, - OnSeek = progress => conditionalSeek(progress) + OnSeek = conditionalSeek } }, }, From a7e7c3a74a2132d173f2be310e2583acd808d126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Sat, 12 May 2018 11:55:52 +0200 Subject: [PATCH 07/41] Enables/Disables seek and Play/Resume on call to beatmapDisabledChanged --- osu.Game/OsuGame.cs | 3 --- osu.Game/Overlays/MusicController.cs | 9 +++++---- osu.Game/Screens/OsuScreen.cs | 2 -- osu.Game/Screens/Play/Player.cs | 2 -- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 4d6b4520fe..4e79ea48ca 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -538,13 +538,10 @@ namespace osu.Game // we only want to apply these restrictions when we are inside a screen stack. // the use case for not applying is in visual/unit tests. bool applyBeatmapRulesetRestrictions = !currentScreen?.AllowBeatmapRulesetChange ?? false; - bool applyUserSeekRestrictions = !currentScreen?.AllowUserSeek ?? false; Ruleset.Disabled = applyBeatmapRulesetRestrictions; Beatmap.Disabled = applyBeatmapRulesetRestrictions; - musicController.DisableSeek = applyUserSeekRestrictions; - mainContent.Padding = new MarginPadding { Top = ToolbarOffset }; CursorOverrideContainer.CanShowCursor = currentScreen?.CursorVisible ?? false; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 45a59a0f87..8ff8dfb3ad 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -221,9 +221,8 @@ namespace osu.Game.Overlays private void conditionalSeek(double progress) { - if (DisableSeek) - return; - current?.Track.Seek(progress); + if (EnableSeek) + current?.Track.Seek(progress); } protected override void LoadComplete() @@ -235,16 +234,18 @@ namespace osu.Game.Overlays base.LoadComplete(); } - public bool DisableSeek { get; set; } + private bool EnableSeek { get; set; } private void beatmapDisabledChanged(bool disabled) { if (disabled) playlist.Hide(); + playButton.Enabled.Value = !disabled; prevButton.Enabled.Value = !disabled; nextButton.Enabled.Value = !disabled; playlistButton.Enabled.Value = !disabled; + EnableSeek = !disabled; } protected override void UpdateAfterChildren() diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 48c3d95b0c..7a910574e0 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -50,8 +50,6 @@ namespace osu.Game.Screens /// public virtual bool AllowBeatmapRulesetChange => true; - public virtual bool AllowUserSeek => true; - protected readonly Bindable Beatmap = new Bindable(); protected virtual float BackgroundParallaxAmount => 1; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2e6db93065..f397d0c3d4 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -45,8 +45,6 @@ namespace osu.Game.Screens.Play public bool AllowLeadIn { get; set; } = true; public bool AllowResults { get; set; } = true; - public override bool AllowUserSeek => false; - private Bindable mouseWheelDisabled; private Bindable userAudioOffset; From 861a8cf9a749a079f983ac38b4bb38fe0704f790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Sat, 12 May 2018 23:10:03 +0200 Subject: [PATCH 08/41] Fixes capitalization of enableSeek --- osu.Game/Overlays/MusicController.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 8ff8dfb3ad..0406bb812c 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -221,7 +221,7 @@ namespace osu.Game.Overlays private void conditionalSeek(double progress) { - if (EnableSeek) + if (enableSeek) current?.Track.Seek(progress); } @@ -234,7 +234,7 @@ namespace osu.Game.Overlays base.LoadComplete(); } - private bool EnableSeek { get; set; } + private bool enableSeek { get; set; } private void beatmapDisabledChanged(bool disabled) { @@ -245,7 +245,7 @@ namespace osu.Game.Overlays prevButton.Enabled.Value = !disabled; nextButton.Enabled.Value = !disabled; playlistButton.Enabled.Value = !disabled; - EnableSeek = !disabled; + enableSeek = !disabled; } protected override void UpdateAfterChildren() From 2979cb96a6eae23852f245042a248966e5e802ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Wed, 4 Jul 2018 21:09:28 +0200 Subject: [PATCH 09/41] attemptSeek accesses beatmap Disabled directly --- osu.Game/Overlays/MusicController.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index f7f0d7ec6a..94b69271fd 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -183,7 +183,7 @@ namespace osu.Game.Overlays Anchor = Anchor.BottomCentre, Height = progress_height, FillColour = colours.Yellow, - OnSeek = conditionalSeek + OnSeek = attemptSeek } }, }, @@ -198,9 +198,9 @@ namespace osu.Game.Overlays playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); } - private void conditionalSeek(double progress) + private void attemptSeek(double progress) { - if (enableSeek) + if (!beatmap.Disabled) current?.Track.Seek(progress); } @@ -220,8 +220,6 @@ namespace osu.Game.Overlays base.LoadComplete(); } - private bool enableSeek { get; set; } - private void beatmapDisabledChanged(bool disabled) { if (disabled) @@ -231,7 +229,6 @@ namespace osu.Game.Overlays prevButton.Enabled.Value = !disabled; nextButton.Enabled.Value = !disabled; playlistButton.Enabled.Value = !disabled; - enableSeek = !disabled; } protected override void UpdateAfterChildren() From fb09385f5135c187a281bab6b4fc09fb0adcf46c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 11:01:08 +0900 Subject: [PATCH 10/41] Remove net471 targeting --- osu.Desktop/osu.Desktop.csproj | 2 +- .../osu.Game.Rulesets.Catch.Tests.csproj | 2 +- .../osu.Game.Rulesets.Mania.Tests.csproj | 2 +- osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj | 2 +- .../osu.Game.Rulesets.Taiko.Tests.csproj | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 0289db20f0..1d9928134d 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -1,7 +1,7 @@  - net471;netcoreapp2.1 + netcoreapp2.1 WinExe AnyCPU true diff --git a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj index 93fa2c4d67..66c81dc14d 100644 --- a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj +++ b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj @@ -2,7 +2,7 @@ WinExe - netcoreapp2.1;net471 + netcoreapp2.1 diff --git a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj index 77504fdc3c..7427862c0d 100644 --- a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj +++ b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj @@ -2,7 +2,7 @@ WinExe - netcoreapp2.1;net471 + netcoreapp2.1 diff --git a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj index c5d9b26145..0d0e023e2a 100644 --- a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj +++ b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj @@ -2,7 +2,7 @@ WinExe - netcoreapp2.1;net471 + netcoreapp2.1 diff --git a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj index dea34d25e7..3c38a48be6 100644 --- a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj +++ b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj @@ -2,7 +2,7 @@ WinExe - netcoreapp2.1;net471 + netcoreapp2.1 diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 532915100b..066df5418a 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -2,7 +2,7 @@ WinExe - netcoreapp2.1;net471 + netcoreapp2.1 From 6254f4e0f7c584105c4c774d29a5822bf31fe9a9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 18:00:04 +0900 Subject: [PATCH 11/41] Fix tests --- appveyor.yml | 2 -- osu.TestProject.props | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 7c08eb9e9c..27f1484e32 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,8 +13,6 @@ install: before_build: - cmd: CodeFileSanity.exe - cmd: nuget restore -verbosity quiet -environment: - TargetFramework: net471 build: project: osu.sln parallel: true diff --git a/osu.TestProject.props b/osu.TestProject.props index c2e6048a60..1369af4aee 100644 --- a/osu.TestProject.props +++ b/osu.TestProject.props @@ -16,6 +16,7 @@ + From 1502edcdc6f2b194a088225c2dbfbb32b91727e8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 18:57:30 +0900 Subject: [PATCH 12/41] Specify tests directly --- appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 27f1484e32..4545feade0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,6 +17,8 @@ build: project: osu.sln parallel: true verbosity: minimal +test_script: + - cmd: dotnet test --configuration Debug --no-build --test-adapter-path:. --logger:Appveyor after_build: - cmd: inspectcode --o="inspectcodereport.xml" --projects:osu.Game* --caches-home="inspectcode" osu.sln > NUL - cmd: NVika parsereport "inspectcodereport.xml" --treatwarningsaserrors From f200cfe40dec998572f43a1ed1c859c97c7c9d15 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Fri, 20 Jul 2018 13:05:19 +0300 Subject: [PATCH 13/41] Add labelled text box files --- .../LabelledComponents/LabelledTextBox.cs | 207 ++++++++++++++++++ .../Setup/Components/OsuSetupTextBox.cs | 24 ++ 2 files changed, 231 insertions(+) create mode 100644 osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs create mode 100644 osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs new file mode 100644 index 0000000000..e0c734f764 --- /dev/null +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -0,0 +1,207 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using System; + +namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents +{ + public class LabelledTextBox : CompositeDrawable + { + private readonly OsuSetupTextBox textBox; + private readonly Container content; + private readonly OsuSpriteText label; + + public const float LABEL_CONTAINER_WIDTH = 150; + public const float OUTER_CORNER_RADIUS = 15; + public const float INNER_CORNER_RADIUS = 10; + public const float DEFAULT_HEIGHT = 40; + public const float DEFAULT_LABEL_LEFT_PADDING = 15; + public const float DEFAULT_LABEL_TOP_PADDING = 12; + public const float DEFAULT_LABEL_TEXT_SIZE = 16; + + public event Action TextBoxTextChanged; + + public void TriggerTextBoxTextChanged(string newText) + { + TextBoxTextChanged?.Invoke(newText); + } + + private bool readOnly; + public bool ReadOnly + { + get => readOnly; + set + { + textBox.ReadOnly = value; + readOnly = value; + } + } + + private string labelText; + public string LabelText + { + get => labelText; + set + { + labelText = value; + label.Text = value; + } + } + + private float labelTextSize; + public float LabelTextSize + { + get => labelTextSize; + set + { + labelTextSize = value; + label.TextSize = value; + } + } + + private string textBoxPlaceholderText; + public string TextBoxPlaceholderText + { + get => textBoxPlaceholderText; + set + { + textBoxPlaceholderText = value; + textBox.PlaceholderText = value; + } + } + + private string textBoxText; + public string TextBoxText + { + get => textBoxText; + set + { + textBoxText = value; + textBox.Text = value; + TextBoxTextChanged?.Invoke(value); + } + } + + private float height = DEFAULT_HEIGHT; + public float Height + { + get => height; + private set + { + height = value; + textBox.Height = value; + content.Height = value; + } + } + + public MarginPadding Padding + { + get => base.Padding; + set + { + base.Padding = value; + base.Height = Height + base.Padding.Top; + } + } + + public MarginPadding LabelPadding + { + get => label.Padding; + set => label.Padding = value; + } + + public MarginPadding TextBoxPadding + { + get => textBox.Padding; + set => textBox.Padding = value; + } + + public Color4 LabelTextColour + { + get => label.Colour; + set => label.Colour = value; + } + + public Color4 BackgroundColour + { + get => content.Colour; + set => content.Colour = value; + } + + public LabelledTextBox() + { + Masking = true; + CornerRadius = OUTER_CORNER_RADIUS; + RelativeSizeAxes = Axes.X; + base.Height = DEFAULT_HEIGHT + Padding.Top; + + InternalChildren = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.X, + Height = DEFAULT_HEIGHT, + CornerRadius = OUTER_CORNER_RADIUS, + Masking = true, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.X, + Height = DEFAULT_HEIGHT, + Colour = OsuColour.FromHex("1c2125"), + }, + new Container + { + RelativeSizeAxes = Axes.X, + Height = DEFAULT_HEIGHT, + Child = new GridContainer + { + RelativeSizeAxes = Axes.X, + Height = DEFAULT_HEIGHT, + Content = new[] + { + new Drawable[] + { + label = new OsuSpriteText + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + Padding = new MarginPadding { Left = DEFAULT_LABEL_LEFT_PADDING, Top = DEFAULT_LABEL_TOP_PADDING }, + Colour = Color4.White, + TextSize = DEFAULT_LABEL_TEXT_SIZE, + Text = LabelText, + Font = @"Exo2.0-Bold", + }, + textBox = new OsuSetupTextBox + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + RelativeSizeAxes = Axes.X, + Height = DEFAULT_HEIGHT, + ReadOnly = ReadOnly, + CornerRadius = INNER_CORNER_RADIUS, + }, + }, + }, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, LABEL_CONTAINER_WIDTH), + new Dimension() + } + } + } + } + } + }; + + textBox.OnCommit += delegate { TriggerTextBoxTextChanged(textBox.Text); }; + } + } +} diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs new file mode 100644 index 0000000000..1a31582291 --- /dev/null +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs @@ -0,0 +1,24 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Screens.Edit.Screens.Setup.Components +{ + public class OsuSetupTextBox : OsuTextBox + { + protected override float LeftRightPadding => 15; + + [BackgroundDependencyLoader] + private void load(OsuColour osuColour) + { + BorderColour = osuColour.Blue; + } + + protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Colour = BorderColour, TextSize = CalculatedTextSize }; + } +} From 6dd5c7e5ab46b6fe548eff85ffc6871c232b71d9 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Fri, 20 Jul 2018 14:28:39 +0300 Subject: [PATCH 14/41] Add test case --- .../Visual/TestCaseLabelledTextBox.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs diff --git a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs new file mode 100644 index 0000000000..a9f0375d39 --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs @@ -0,0 +1,37 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents; +using System; +using System.Collections.Generic; + +namespace osu.Game.Tests.Visual +{ + [TestFixture] + public class TestCaseLabelledTextBox : OsuTestCase + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(LabelledTextBox), + }; + + [BackgroundDependencyLoader] + private void load() + { + Children = new Drawable[] + { + new LabelledTextBox + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + LabelText = "Testing text", + TextBoxPlaceholderText = "This is definitely working as intended", + Padding = new MarginPadding { Left = 150, Right = 150 } + } + }; + } + } +} From 3c59ccadd05e22af7e8ec7e3dff722e6736ab4dc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 Jul 2018 22:19:58 +0200 Subject: [PATCH 15/41] Fix gameplay always skipping to first hitobject time Regresssed with previous build --- osu.Game/Screens/Play/Player.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 4f37b59e6e..e9e353d698 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -139,7 +139,7 @@ namespace osu.Game.Screens.Play adjustableClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false }; adjustableClock.Seek(AllowLeadIn - ? Math.Min(RulesetContainer.GameplayStartTime, beatmap.HitObjects.First().StartTime - beatmap.BeatmapInfo.AudioLeadIn) + ? Math.Min(0, beatmap.HitObjects.First().StartTime - beatmap.BeatmapInfo.AudioLeadIn) : RulesetContainer.GameplayStartTime); adjustableClock.ProcessFrame(); From 8501967b6a3a61c38a1499e53914a5d5030860a0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 Jul 2018 22:47:25 +0200 Subject: [PATCH 16/41] Fix testing regression --- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index b94fb42bf0..41c45f00f3 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -54,6 +54,12 @@ namespace osu.Game.Tests.Visual public new BeatmapCarousel Carousel => base.Carousel; } + protected override void Dispose(bool isDisposing) + { + factory.ResetDatabase(); + base.Dispose(isDisposing); + } + [BackgroundDependencyLoader] private void load() { From 479fe983351418fe01f39dc3b62284823f82625f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 Jul 2018 22:57:55 +0200 Subject: [PATCH 17/41] Add more prominent sound when skipping --- osu.Game/Screens/Play/SkipOverlay.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index 3e946288d9..06837c9274 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -4,6 +4,8 @@ using System; using osu.Framework; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Threading; @@ -214,17 +216,21 @@ namespace osu.Game.Screens.Play private Box background; private AspectContainer aspect; + private SampleChannel sampleConfirm; + public Button() { RelativeSizeAxes = Axes.Both; } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, AudioManager audio) { colourNormal = colours.Yellow; colourHover = colours.YellowDark; + sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection"); + Children = new Drawable[] { background = new Box @@ -311,6 +317,8 @@ namespace osu.Game.Screens.Play if (!Enabled) return false; + sampleConfirm.Play(); + box.FlashColour(Color4.White, 500, Easing.OutQuint); aspect.ScaleTo(1.2f, 2000, Easing.OutQuint); From 44a2ae5f9ac83238d151d848580a8ee33bedfdc8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 Jul 2018 08:33:47 +0200 Subject: [PATCH 18/41] Fix incorrect variable usage --- osu.Game/Screens/Play/Player.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e9e353d698..00ba1a8d12 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -139,7 +139,7 @@ namespace osu.Game.Screens.Play adjustableClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false }; adjustableClock.Seek(AllowLeadIn - ? Math.Min(0, beatmap.HitObjects.First().StartTime - beatmap.BeatmapInfo.AudioLeadIn) + ? Math.Min(0, RulesetContainer.GameplayStartTime - beatmap.BeatmapInfo.AudioLeadIn) : RulesetContainer.GameplayStartTime); adjustableClock.ProcessFrame(); From 1b456fd7166a5645d9b3b058a8fbd7783a345518 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 Jul 2018 13:11:06 +0200 Subject: [PATCH 19/41] Fix a potential InvalidOperationException when entering song select Closes #3052. --- osu.Game/Screens/Select/Carousel/CarouselGroup.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs index 2118cfdc78..ea461e7bd5 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs @@ -79,8 +79,13 @@ namespace osu.Game.Screens.Select.Carousel public override void Filter(FilterCriteria criteria) { base.Filter(criteria); - InternalChildren.Sort((x, y) => x.CompareTo(criteria, y)); - InternalChildren.ForEach(c => c.Filter(criteria)); + + var children = new List(InternalChildren); + + children.Sort((x, y) => x.CompareTo(criteria, y)); + children.ForEach(c => c.Filter(criteria)); + + InternalChildren = children; } protected virtual void ChildItemStateChanged(CarouselItem item, CarouselItemState value) From dd56a2d95fc15a3db53fbf4ad5d3252e79686072 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Mon, 23 Jul 2018 15:44:10 +0300 Subject: [PATCH 20/41] Apply proposed changes (untested) --- .../Visual/TestCaseLabelledTextBox.cs | 2 +- .../LabelledComponents/LabelledTextBox.cs | 74 +++++++++---------- .../{OsuSetupTextBox.cs => SetupTextBox.cs} | 2 +- 3 files changed, 36 insertions(+), 42 deletions(-) rename osu.Game/Screens/Edit/Screens/Setup/Components/{OsuSetupTextBox.cs => SetupTextBox.cs} (94%) diff --git a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs index a9f0375d39..be11562bb0 100644 --- a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs +++ b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs @@ -28,7 +28,7 @@ namespace osu.Game.Tests.Visual Anchor = Anchor.Centre, Origin = Anchor.Centre, LabelText = "Testing text", - TextBoxPlaceholderText = "This is definitely working as intended", + PlaceholderText = "This is definitely working as intended", Padding = new MarginPadding { Left = 150, Right = 150 } } }; diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index e0c734f764..806e6b6f6d 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -8,29 +8,25 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using System; +using static osu.Framework.Graphics.UserInterface.TextBox; namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents { public class LabelledTextBox : CompositeDrawable { - private readonly OsuSetupTextBox textBox; + private readonly SetupTextBox textBox; private readonly Container content; private readonly OsuSpriteText label; - public const float LABEL_CONTAINER_WIDTH = 150; - public const float OUTER_CORNER_RADIUS = 15; - public const float INNER_CORNER_RADIUS = 10; - public const float DEFAULT_HEIGHT = 40; - public const float DEFAULT_LABEL_LEFT_PADDING = 15; - public const float DEFAULT_LABEL_TOP_PADDING = 12; - public const float DEFAULT_LABEL_TEXT_SIZE = 16; + private const float label_container_width = 150; + private const float outer_corner_radius = 15; + private const float inner_corner_radius = 10; + private const float default_height = 40; + private const float default_label_left_padding = 15; + private const float default_label_top_padding = 12; + private const float default_label_text_size = 16; - public event Action TextBoxTextChanged; - - public void TriggerTextBoxTextChanged(string newText) - { - TextBoxTextChanged?.Invoke(newText); - } + public event OnCommitHandler TextBoxTextChanged; private bool readOnly; public bool ReadOnly @@ -65,30 +61,30 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents } } - private string textBoxPlaceholderText; - public string TextBoxPlaceholderText + private string placeholderText; + public string PlaceholderText { - get => textBoxPlaceholderText; + get => placeholderText; set { - textBoxPlaceholderText = value; + placeholderText = value; textBox.PlaceholderText = value; } } - private string textBoxText; - public string TextBoxText + private string text; + public string Text { - get => textBoxText; + get => text; set { - textBoxText = value; + text = value; textBox.Text = value; - TextBoxTextChanged?.Invoke(value); + TextBoxTextChanged?.Invoke(textBox, true); } } - private float height = DEFAULT_HEIGHT; + private float height = default_height; public float Height { get => height; @@ -137,34 +133,32 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents public LabelledTextBox() { Masking = true; - CornerRadius = OUTER_CORNER_RADIUS; + CornerRadius = outer_corner_radius; RelativeSizeAxes = Axes.X; - base.Height = DEFAULT_HEIGHT + Padding.Top; + base.Height = default_height + Padding.Top; InternalChildren = new Drawable[] { new Container { - RelativeSizeAxes = Axes.X, - Height = DEFAULT_HEIGHT, - CornerRadius = OUTER_CORNER_RADIUS, + RelativeSizeAxes = Axes.Both, + CornerRadius = outer_corner_radius, Masking = true, Children = new Drawable[] { new Box { - RelativeSizeAxes = Axes.X, - Height = DEFAULT_HEIGHT, + RelativeSizeAxes = Axes.Both, Colour = OsuColour.FromHex("1c2125"), }, new Container { RelativeSizeAxes = Axes.X, - Height = DEFAULT_HEIGHT, + Height = default_height, Child = new GridContainer { RelativeSizeAxes = Axes.X, - Height = DEFAULT_HEIGHT, + Height = default_height, Content = new[] { new Drawable[] @@ -173,26 +167,26 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, - Padding = new MarginPadding { Left = DEFAULT_LABEL_LEFT_PADDING, Top = DEFAULT_LABEL_TOP_PADDING }, + Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding }, Colour = Color4.White, - TextSize = DEFAULT_LABEL_TEXT_SIZE, + TextSize = default_label_text_size, Text = LabelText, Font = @"Exo2.0-Bold", }, - textBox = new OsuSetupTextBox + textBox = new SetupTextBox { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, RelativeSizeAxes = Axes.X, - Height = DEFAULT_HEIGHT, + Height = default_height, ReadOnly = ReadOnly, - CornerRadius = INNER_CORNER_RADIUS, + CornerRadius = inner_corner_radius, }, }, }, ColumnDimensions = new[] { - new Dimension(GridSizeMode.Absolute, LABEL_CONTAINER_WIDTH), + new Dimension(GridSizeMode.Absolute, label_container_width), new Dimension() } } @@ -201,7 +195,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents } }; - textBox.OnCommit += delegate { TriggerTextBoxTextChanged(textBox.Text); }; + textBox.OnCommit += (_, a) => TextBoxTextChanged?.Invoke(textBox, a); } } } diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs similarity index 94% rename from osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs rename to osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs index 1a31582291..206170e1eb 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs @@ -9,7 +9,7 @@ using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Edit.Screens.Setup.Components { - public class OsuSetupTextBox : OsuTextBox + public class SetupTextBox : OsuTextBox { protected override float LeftRightPadding => 15; From a833fa3d924e05df4047d5ba00965819156f4a2a Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 09:19:45 +0300 Subject: [PATCH 21/41] Update framework and apply suggested changes --- .../Setup/Components/LabelledComponents/LabelledTextBox.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 806e6b6f6d..09797e3180 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -26,7 +26,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents private const float default_label_top_padding = 12; private const float default_label_text_size = 16; - public event OnCommitHandler TextBoxTextChanged; + public event OnCommitHandler OnCommit; private bool readOnly; public bool ReadOnly @@ -80,7 +80,6 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents { text = value; textBox.Text = value; - TextBoxTextChanged?.Invoke(textBox, true); } } @@ -195,7 +194,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents } }; - textBox.OnCommit += (_, a) => TextBoxTextChanged?.Invoke(textBox, a); + textBox.OnCommit += OnCommit; } } } From 2f452c162cb9b9c09dd21dba9780f6630fdb3270 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 09:21:01 +0300 Subject: [PATCH 22/41] Make text colour white --- .../Screens/Edit/Screens/Setup/Components/SetupTextBox.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs index 206170e1eb..c3938fae9c 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs @@ -12,13 +12,5 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components public class SetupTextBox : OsuTextBox { protected override float LeftRightPadding => 15; - - [BackgroundDependencyLoader] - private void load(OsuColour osuColour) - { - BorderColour = osuColour.Blue; - } - - protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Colour = BorderColour, TextSize = CalculatedTextSize }; } } From 765c6e4eccbe0a3744fd6c3dfca1f42aa1522f34 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 09:46:24 +0300 Subject: [PATCH 23/41] Remove custom text box --- .../LabelledComponents/LabelledTextBox.cs | 5 +++-- .../Screens/Setup/Components/SetupTextBox.cs | 16 ---------------- 2 files changed, 3 insertions(+), 18 deletions(-) delete mode 100644 osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 09797e3180..15723c0eaf 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using System; using static osu.Framework.Graphics.UserInterface.TextBox; @@ -14,7 +15,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents { public class LabelledTextBox : CompositeDrawable { - private readonly SetupTextBox textBox; + private readonly OsuTextBox textBox; private readonly Container content; private readonly OsuSpriteText label; @@ -172,7 +173,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents Text = LabelText, Font = @"Exo2.0-Bold", }, - textBox = new SetupTextBox + textBox = new OsuTextBox { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs deleted file mode 100644 index c3938fae9c..0000000000 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; - -namespace osu.Game.Screens.Edit.Screens.Setup.Components -{ - public class SetupTextBox : OsuTextBox - { - protected override float LeftRightPadding => 15; - } -} From 0e50e4ee346d6e7f1d06e89a7749b72d95cd239c Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 10:10:17 +0300 Subject: [PATCH 24/41] Clean code --- .../LabelledComponents/LabelledTextBox.cs | 82 +++++++++---------- 1 file changed, 38 insertions(+), 44 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 15723c0eaf..5f4e88b52c 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using System; using static osu.Framework.Graphics.UserInterface.TextBox; namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents @@ -132,63 +131,58 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents public LabelledTextBox() { - Masking = true; - CornerRadius = outer_corner_radius; RelativeSizeAxes = Axes.X; base.Height = default_height + Padding.Top; + CornerRadius = outer_corner_radius; + Masking = true; - InternalChildren = new Drawable[] + InternalChild = new Container { - new Container + RelativeSizeAxes = Axes.Both, + CornerRadius = outer_corner_radius, + Masking = true, + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both, - CornerRadius = outer_corner_radius, - Masking = true, - Children = new Drawable[] + new Box { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.FromHex("1c2125"), - }, - new Container + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex("1c2125"), + }, + new Container + { + RelativeSizeAxes = Axes.X, + Height = default_height, + Child = new GridContainer { RelativeSizeAxes = Axes.X, Height = default_height, - Child = new GridContainer + Content = new[] { - RelativeSizeAxes = Axes.X, - Height = default_height, - Content = new[] + new Drawable[] { - new Drawable[] + label = new OsuSpriteText { - label = new OsuSpriteText - { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding }, - Colour = Color4.White, - TextSize = default_label_text_size, - Text = LabelText, - Font = @"Exo2.0-Bold", - }, - textBox = new OsuTextBox - { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - RelativeSizeAxes = Axes.X, - Height = default_height, - ReadOnly = ReadOnly, - CornerRadius = inner_corner_radius, - }, + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding }, + Colour = Color4.White, + TextSize = default_label_text_size, + Font = @"Exo2.0-Bold", + }, + textBox = new OsuTextBox + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + RelativeSizeAxes = Axes.X, + Height = default_height, + CornerRadius = inner_corner_radius, }, }, - ColumnDimensions = new[] - { - new Dimension(GridSizeMode.Absolute, label_container_width), - new Dimension() - } + }, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, label_container_width), + new Dimension() } } } From ab9340f4be8ab5410177a0eb4b611437177a28b4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jul 2018 11:34:06 +0200 Subject: [PATCH 25/41] Fix usage of culture local ToUpper causing incorrect display on Turkish machines Closes #3098. --- osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs | 3 ++- osu.Game/Overlays/Chat/ChannelSection.cs | 3 ++- osu.Game/Overlays/MedalSplash/DrawableMedal.cs | 3 ++- osu.Game/Overlays/Notifications/NotificationSection.cs | 7 ++++--- osu.Game/Overlays/OnScreenDisplay.cs | 5 +++-- osu.Game/Overlays/Settings/SettingsSubsection.cs | 3 ++- osu.Game/Rulesets/Judgements/DrawableJudgement.cs | 3 ++- osu.Game/Screens/Play/Break/BreakInfo.cs | 3 ++- .../Screens/Play/PlayerSettings/PlayerSettingsGroup.cs | 3 ++- osu.Game/Screens/Tournament/Drawings.cs | 3 ++- osu.Game/Screens/Tournament/Group.cs | 5 +++-- 11 files changed, 26 insertions(+), 15 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index 24e6021421..4e92f49937 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Globalization; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -23,7 +24,7 @@ namespace osu.Game.Beatmaps.Drawables if (value == status) return; status = value; - statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpper(); + statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpper(CultureInfo.InvariantCulture); } } diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index 89d9d2231c..2d0c406ef2 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using System.Globalization; using System.Linq; using OpenTK; using osu.Framework.Graphics; @@ -30,7 +31,7 @@ namespace osu.Game.Overlays.Chat public string Header { get { return header.Text; } - set { header.Text = value.ToUpper(); } + set { header.Text = value.ToUpper(CultureInfo.InvariantCulture); } } public IEnumerable Channels diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index ce79e70b1c..222c966a2b 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Globalization; using osu.Framework; using OpenTK; using osu.Framework.Allocation; @@ -62,7 +63,7 @@ namespace osu.Game.Overlays.MedalSplash { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = "Medal Unlocked".ToUpper(), + Text = "Medal Unlocked".ToUpper(CultureInfo.InvariantCulture), TextSize = 24, Font = @"Exo2.0-Light", Alpha = 0f, diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index c166624d2b..1537c65a1f 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; @@ -55,7 +56,7 @@ namespace osu.Game.Overlays.Notifications set { title = value; - if (titleText != null) titleText.Text = title.ToUpper(); + if (titleText != null) titleText.Text = title.ToUpper(CultureInfo.InvariantCulture); } } @@ -101,7 +102,7 @@ namespace osu.Game.Overlays.Notifications { titleText = new OsuSpriteText { - Text = title.ToUpper(), + Text = title.ToUpper(CultureInfo.InvariantCulture), Font = @"Exo2.0-Black", }, countText = new OsuSpriteText @@ -154,7 +155,7 @@ namespace osu.Game.Overlays.Notifications public string Text { get { return text.Text; } - set { text.Text = value.ToUpper(); } + set { text.Text = value.ToUpper(CultureInfo.InvariantCulture); } } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 5a5b90ee25..ba5bb9c49e 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Configuration.Tracking; @@ -176,9 +177,9 @@ namespace osu.Game.Overlays { Schedule(() => { - textLine1.Text = description.Name.ToUpper(); + textLine1.Text = description.Name.ToUpper(CultureInfo.InvariantCulture); textLine2.Text = description.Value; - textLine3.Text = description.Shortcut.ToUpper(); + textLine3.Text = description.Shortcut.ToUpper(CultureInfo.InvariantCulture); if (string.IsNullOrEmpty(textLine3.Text)) textLine3.Text = "NO KEY BOUND"; diff --git a/osu.Game/Overlays/Settings/SettingsSubsection.cs b/osu.Game/Overlays/Settings/SettingsSubsection.cs index 82589a99bd..4498828118 100644 --- a/osu.Game/Overlays/Settings/SettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/SettingsSubsection.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; using System.Collections.Generic; +using System.Globalization; using System.Linq; using osu.Framework.Allocation; @@ -51,7 +52,7 @@ namespace osu.Game.Overlays.Settings { new OsuSpriteText { - Text = Header.ToUpper(), + Text = Header.ToUpper(CultureInfo.InvariantCulture), Margin = new MarginPadding { Bottom = 10, Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS }, Font = @"Exo2.0-Black", }, diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index 74ee025823..6fa10977d0 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Globalization; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Extensions; @@ -51,7 +52,7 @@ namespace osu.Game.Rulesets.Judgements Child = new SkinnableDrawable($"Play/{Judgement.Result}", _ => JudgementText = new OsuSpriteText { - Text = Judgement.Result.GetDescription().ToUpper(), + Text = Judgement.Result.GetDescription().ToUpper(CultureInfo.InvariantCulture), Font = @"Venera", Colour = judgementColour(Judgement.Result), Scale = new Vector2(0.85f, 1), diff --git a/osu.Game/Screens/Play/Break/BreakInfo.cs b/osu.Game/Screens/Play/Break/BreakInfo.cs index 77c9c967b4..fb7f6cd03b 100644 --- a/osu.Game/Screens/Play/Break/BreakInfo.cs +++ b/osu.Game/Screens/Play/Break/BreakInfo.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Globalization; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -28,7 +29,7 @@ namespace osu.Game.Screens.Play.Break { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = "current progress".ToUpper(), + Text = "current progress".ToUpper(CultureInfo.InvariantCulture), TextSize = 15, Font = "Exo2.0-Black", }, diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index 1813d02d02..9a17e7708b 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Globalization; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -94,7 +95,7 @@ namespace osu.Game.Screens.Play.PlayerSettings { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Text = Title.ToUpper(), + Text = Title.ToUpper(CultureInfo.InvariantCulture), TextSize = 17, Font = @"Exo2.0-Bold", Margin = new MarginPadding { Left = 10 }, diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 49a46b96e3..7bc8217329 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -323,7 +324,7 @@ namespace osu.Game.Screens.Tournament if (string.IsNullOrEmpty(line)) continue; - if (line.ToUpper().StartsWith("GROUP")) + if (line.ToUpper(CultureInfo.InvariantCulture).StartsWith("GROUP")) continue; // ReSharper disable once AccessToModifiedClosure diff --git a/osu.Game/Screens/Tournament/Group.cs b/osu.Game/Screens/Tournament/Group.cs index b1bcd6052c..f62c26a62e 100644 --- a/osu.Game/Screens/Tournament/Group.cs +++ b/osu.Game/Screens/Tournament/Group.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Text; using osu.Framework.Allocation; @@ -51,7 +52,7 @@ namespace osu.Game.Screens.Tournament Position = new Vector2(0, 7f), - Text = $"GROUP {name.ToUpper()}", + Text = $"GROUP {name.ToUpper(CultureInfo.InvariantCulture)}", TextSize = 8f, Font = @"Exo2.0-Bold", Colour = new Color4(255, 204, 34, 255), @@ -161,7 +162,7 @@ namespace osu.Game.Screens.Tournament Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = team.Acronym.ToUpper(), + Text = team.Acronym.ToUpper(CultureInfo.InvariantCulture), TextSize = 10f, Font = @"Exo2.0-Bold" } From b38da34da9df8e8910e293a3a93766b58aab4bf0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jul 2018 12:11:14 +0200 Subject: [PATCH 26/41] Fix resetting database failing due to incorrect disposal logic --- osu.Game/Database/DatabaseContextFactory.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Database/DatabaseContextFactory.cs b/osu.Game/Database/DatabaseContextFactory.cs index c20d4569f6..e70d753114 100644 --- a/osu.Game/Database/DatabaseContextFactory.cs +++ b/osu.Game/Database/DatabaseContextFactory.cs @@ -5,6 +5,7 @@ using System; using System.Linq; using System.Threading; using Microsoft.EntityFrameworkCore.Storage; +using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Platform; namespace osu.Game.Database @@ -115,7 +116,11 @@ namespace osu.Game.Database } } - private void recycleThreadContexts() => threadContexts = new ThreadLocal(CreateContext); + private void recycleThreadContexts() + { + threadContexts?.Values.ForEach(c => c.Dispose()); + threadContexts = new ThreadLocal(CreateContext, true); + } protected virtual OsuDbContext CreateContext() => new OsuDbContext(storage.GetDatabaseConnectionString(database_name)) { @@ -127,8 +132,6 @@ namespace osu.Game.Database lock (writeLock) { recycleThreadContexts(); - GC.Collect(); - GC.WaitForPendingFinalizers(); storage.DeleteDatabase(database_name); } } From 1d86083981b80ee725645ce9b10719c384a9687a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jul 2018 12:11:20 +0200 Subject: [PATCH 27/41] Hide unnecessary log output --- osu.Game/OsuGameBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 63cc883844..bada2a794d 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -224,7 +224,7 @@ namespace osu.Game // todo: we probably want a better (non-destructive) migrations/recovery process at a later point than this. contextFactory.ResetDatabase(); - Logger.Log("Database purged successfully.", LoggingTarget.Database, LogLevel.Important); + Logger.Log("Database purged successfully.", LoggingTarget.Database); // only run once more, then hard bail. using (var db = contextFactory.GetForWrite(false)) From 5364a6148a2b6adcbd77fbde14359cc1d6b9b259 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jul 2018 14:42:06 +0200 Subject: [PATCH 28/41] Use ToUpperInvariant --- osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs | 3 +-- osu.Game/Overlays/Chat/ChannelSection.cs | 3 +-- osu.Game/Overlays/MedalSplash/DrawableMedal.cs | 3 +-- osu.Game/Overlays/Notifications/NotificationSection.cs | 7 +++---- osu.Game/Overlays/OnScreenDisplay.cs | 5 ++--- osu.Game/Overlays/Settings/SettingsSubsection.cs | 3 +-- osu.Game/Rulesets/Judgements/DrawableJudgement.cs | 3 +-- osu.Game/Screens/Play/Break/BreakInfo.cs | 3 +-- .../Screens/Play/PlayerSettings/PlayerSettingsGroup.cs | 3 +-- osu.Game/Screens/Tournament/Drawings.cs | 3 +-- osu.Game/Screens/Tournament/Group.cs | 5 ++--- 11 files changed, 15 insertions(+), 26 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index 4e92f49937..c7e97cef55 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Globalization; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -24,7 +23,7 @@ namespace osu.Game.Beatmaps.Drawables if (value == status) return; status = value; - statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpper(CultureInfo.InvariantCulture); + statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpperInvariant(); } } diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index 2d0c406ef2..85fdecaaba 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using System.Globalization; using System.Linq; using OpenTK; using osu.Framework.Graphics; @@ -31,7 +30,7 @@ namespace osu.Game.Overlays.Chat public string Header { get { return header.Text; } - set { header.Text = value.ToUpper(CultureInfo.InvariantCulture); } + set { header.Text = value.ToUpperInvariant(); } } public IEnumerable Channels diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index 222c966a2b..a27278e002 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Globalization; using osu.Framework; using OpenTK; using osu.Framework.Allocation; @@ -63,7 +62,7 @@ namespace osu.Game.Overlays.MedalSplash { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = "Medal Unlocked".ToUpper(CultureInfo.InvariantCulture), + Text = "Medal Unlocked".ToUpperInvariant(), TextSize = 24, Font = @"Exo2.0-Light", Alpha = 0f, diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index 1537c65a1f..f41e3e876f 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; @@ -56,7 +55,7 @@ namespace osu.Game.Overlays.Notifications set { title = value; - if (titleText != null) titleText.Text = title.ToUpper(CultureInfo.InvariantCulture); + if (titleText != null) titleText.Text = title.ToUpperInvariant(); } } @@ -102,7 +101,7 @@ namespace osu.Game.Overlays.Notifications { titleText = new OsuSpriteText { - Text = title.ToUpper(CultureInfo.InvariantCulture), + Text = title.ToUpperInvariant(), Font = @"Exo2.0-Black", }, countText = new OsuSpriteText @@ -155,7 +154,7 @@ namespace osu.Game.Overlays.Notifications public string Text { get { return text.Text; } - set { text.Text = value.ToUpper(CultureInfo.InvariantCulture); } + set { text.Text = value.ToUpperInvariant(); } } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index ba5bb9c49e..041ceab365 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Globalization; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Configuration.Tracking; @@ -177,9 +176,9 @@ namespace osu.Game.Overlays { Schedule(() => { - textLine1.Text = description.Name.ToUpper(CultureInfo.InvariantCulture); + textLine1.Text = description.Name.ToUpperInvariant(); textLine2.Text = description.Value; - textLine3.Text = description.Shortcut.ToUpper(CultureInfo.InvariantCulture); + textLine3.Text = description.Shortcut.ToUpperInvariant(); if (string.IsNullOrEmpty(textLine3.Text)) textLine3.Text = "NO KEY BOUND"; diff --git a/osu.Game/Overlays/Settings/SettingsSubsection.cs b/osu.Game/Overlays/Settings/SettingsSubsection.cs index 4498828118..9296972749 100644 --- a/osu.Game/Overlays/Settings/SettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/SettingsSubsection.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; using System.Collections.Generic; -using System.Globalization; using System.Linq; using osu.Framework.Allocation; @@ -52,7 +51,7 @@ namespace osu.Game.Overlays.Settings { new OsuSpriteText { - Text = Header.ToUpper(CultureInfo.InvariantCulture), + Text = Header.ToUpperInvariant(), Margin = new MarginPadding { Bottom = 10, Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS }, Font = @"Exo2.0-Black", }, diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index 6fa10977d0..5de14ae579 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Globalization; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Extensions; @@ -52,7 +51,7 @@ namespace osu.Game.Rulesets.Judgements Child = new SkinnableDrawable($"Play/{Judgement.Result}", _ => JudgementText = new OsuSpriteText { - Text = Judgement.Result.GetDescription().ToUpper(CultureInfo.InvariantCulture), + Text = Judgement.Result.GetDescription().ToUpperInvariant(), Font = @"Venera", Colour = judgementColour(Judgement.Result), Scale = new Vector2(0.85f, 1), diff --git a/osu.Game/Screens/Play/Break/BreakInfo.cs b/osu.Game/Screens/Play/Break/BreakInfo.cs index fb7f6cd03b..51d39762d2 100644 --- a/osu.Game/Screens/Play/Break/BreakInfo.cs +++ b/osu.Game/Screens/Play/Break/BreakInfo.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Globalization; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -29,7 +28,7 @@ namespace osu.Game.Screens.Play.Break { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = "current progress".ToUpper(CultureInfo.InvariantCulture), + Text = "current progress".ToUpperInvariant(), TextSize = 15, Font = "Exo2.0-Black", }, diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index 9a17e7708b..c4767f404d 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Globalization; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -95,7 +94,7 @@ namespace osu.Game.Screens.Play.PlayerSettings { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Text = Title.ToUpper(CultureInfo.InvariantCulture), + Text = Title.ToUpperInvariant(), TextSize = 17, Font = @"Exo2.0-Bold", Margin = new MarginPadding { Left = 10 }, diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 7bc8217329..63d29d5cd7 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -324,7 +323,7 @@ namespace osu.Game.Screens.Tournament if (string.IsNullOrEmpty(line)) continue; - if (line.ToUpper(CultureInfo.InvariantCulture).StartsWith("GROUP")) + if (line.ToUpperInvariant().StartsWith("GROUP")) continue; // ReSharper disable once AccessToModifiedClosure diff --git a/osu.Game/Screens/Tournament/Group.cs b/osu.Game/Screens/Tournament/Group.cs index f62c26a62e..6845d8fc48 100644 --- a/osu.Game/Screens/Tournament/Group.cs +++ b/osu.Game/Screens/Tournament/Group.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using System.Globalization; using System.Linq; using System.Text; using osu.Framework.Allocation; @@ -52,7 +51,7 @@ namespace osu.Game.Screens.Tournament Position = new Vector2(0, 7f), - Text = $"GROUP {name.ToUpper(CultureInfo.InvariantCulture)}", + Text = $"GROUP {name.ToUpperInvariant()}", TextSize = 8f, Font = @"Exo2.0-Bold", Colour = new Color4(255, 204, 34, 255), @@ -162,7 +161,7 @@ namespace osu.Game.Screens.Tournament Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = team.Acronym.ToUpper(CultureInfo.InvariantCulture), + Text = team.Acronym.ToUpperInvariant(), TextSize = 10f, Font = @"Exo2.0-Bold" } From 3ca112aef0779c29fd7eaeca0dd9d9d24656e661 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 22:04:02 +0300 Subject: [PATCH 29/41] Clean code and apply requested changes --- .../LabelledComponents/LabelledTextBox.cs | 124 ++++++------------ 1 file changed, 39 insertions(+), 85 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 5f4e88b52c..9f364c6cf4 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -27,82 +27,41 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents private const float default_label_text_size = 16; public event OnCommitHandler OnCommit; - - private bool readOnly; + public bool ReadOnly { - get => readOnly; - set - { - textBox.ReadOnly = value; - readOnly = value; - } + get => textBox.ReadOnly; + set => textBox.ReadOnly = value; } - - private string labelText; + public string LabelText { - get => labelText; - set - { - labelText = value; - label.Text = value; - } + get => label.Text; + set => label.Text = value; } - - private float labelTextSize; + public float LabelTextSize { - get => labelTextSize; - set - { - labelTextSize = value; - label.TextSize = value; - } + get => label.TextSize; + set => label.TextSize = value; } - - private string placeholderText; + public string PlaceholderText { - get => placeholderText; - set - { - placeholderText = value; - textBox.PlaceholderText = value; - } + get => textBox.PlaceholderText; + set => textBox.PlaceholderText = value; } - private string text; public string Text { - get => text; - set - { - text = value; - textBox.Text = value; - } - } - - private float height = default_height; - public float Height - { - get => height; - private set - { - height = value; - textBox.Height = value; - content.Height = value; - } + get => textBox.Text; + set => textBox.Text = value; } public MarginPadding Padding { get => base.Padding; - set - { - base.Padding = value; - base.Height = Height + base.Padding.Top; - } + set => base.Padding = value; } public MarginPadding LabelPadding @@ -132,7 +91,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents public LabelledTextBox() { RelativeSizeAxes = Axes.X; - base.Height = default_height + Padding.Top; + Height = default_height; CornerRadius = outer_corner_radius; Masking = true; @@ -148,42 +107,37 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents RelativeSizeAxes = Axes.Both, Colour = OsuColour.FromHex("1c2125"), }, - new Container + new GridContainer { RelativeSizeAxes = Axes.X, Height = default_height, - Child = new GridContainer + Content = new[] { - RelativeSizeAxes = Axes.X, - Height = default_height, - Content = new[] + new Drawable[] { - new Drawable[] + label = new OsuSpriteText { - label = new OsuSpriteText - { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding }, - Colour = Color4.White, - TextSize = default_label_text_size, - Font = @"Exo2.0-Bold", - }, - textBox = new OsuTextBox - { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - RelativeSizeAxes = Axes.X, - Height = default_height, - CornerRadius = inner_corner_radius, - }, + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding }, + Colour = Color4.White, + TextSize = default_label_text_size, + Font = @"Exo2.0-Bold", + }, + textBox = new OsuTextBox + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + RelativeSizeAxes = Axes.Both, + Height = 1, + CornerRadius = inner_corner_radius, }, }, - ColumnDimensions = new[] - { - new Dimension(GridSizeMode.Absolute, label_container_width), - new Dimension() - } + }, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, label_container_width), + new Dimension() } } } From 6675c455f3d6761343b969849db8d92d376238c5 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 22:33:19 +0300 Subject: [PATCH 30/41] Trim whitespace that magically appeared --- .../Components/LabelledComponents/LabelledTextBox.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 9f364c6cf4..fbfb771c8a 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -27,25 +27,25 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents private const float default_label_text_size = 16; public event OnCommitHandler OnCommit; - + public bool ReadOnly { get => textBox.ReadOnly; set => textBox.ReadOnly = value; } - + public string LabelText { get => label.Text; set => label.Text = value; } - + public float LabelTextSize { get => label.TextSize; set => label.TextSize = value; } - + public string PlaceholderText { get => textBox.PlaceholderText; From da8fc0ee5dd169946155aa4150bf34354c14255e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 Jul 2018 07:37:05 +0200 Subject: [PATCH 31/41] ToLower -> ToLowerInvariant --- osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs | 4 ++-- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 2 +- osu.Game/Graphics/ScreenshotManager.cs | 2 +- osu.Game/Online/API/Requests/GetUserScoresRequest.cs | 2 +- osu.Game/Online/API/Requests/PostMessageRequest.cs | 2 +- osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs | 2 +- osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs | 4 ++-- osu.Game/Screens/Multi/Header.cs | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs index 64ed08373a..fdc8f362f7 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs @@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Mania.Tests return new ScrollingTestContainer(direction) { AutoSizeAxes = Axes.Both, - Child = new NoteContainer(direction, $"note, scrolling {direction.ToString().ToLower()}") + Child = new NoteContainer(direction, $"note, scrolling {direction.ToString().ToLowerInvariant()}") { Child = new DrawableNote(note) { AccentColour = Color4.OrangeRed } } @@ -77,7 +77,7 @@ namespace osu.Game.Rulesets.Mania.Tests return new ScrollingTestContainer(direction) { AutoSizeAxes = Axes.Both, - Child = new NoteContainer(direction, $"hold note, scrolling {direction.ToString().ToLower()}") + Child = new NoteContainer(direction, $"hold note, scrolling {direction.ToString().ToLowerInvariant()}") { Child = new DrawableHoldNote(note) { diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 52d9f31814..26f28c86ca 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -312,7 +312,7 @@ namespace osu.Game.Beatmaps.Formats omitFirstBarSignature = effectFlags.HasFlag(EffectFlags.OmitFirstBarLine); } - string stringSampleSet = sampleSet.ToString().ToLower(); + string stringSampleSet = sampleSet.ToString().ToLowerInvariant(); if (stringSampleSet == @"none") stringSampleSet = @"normal"; diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index 90580c50df..7b3337cb23 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -134,7 +134,7 @@ namespace osu.Game.Graphics private string getFileName() { var dt = DateTime.Now; - var fileExt = screenshotFormat.ToString().ToLower(); + var fileExt = screenshotFormat.ToString().ToLowerInvariant(); var withoutIndex = $"osu_{dt:yyyy-MM-dd_HH-mm-ss}.{fileExt}"; if (!storage.Exists(withoutIndex)) diff --git a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs index ea14135a61..4d4aa4d957 100644 --- a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs @@ -20,7 +20,7 @@ namespace osu.Game.Online.API.Requests } // ReSharper disable once ImpureMethodCallOnReadonlyValueField - protected override string Target => $@"users/{userId}/scores/{type.ToString().ToLower()}?offset={offset}"; + protected override string Target => $@"users/{userId}/scores/{type.ToString().ToLowerInvariant()}?offset={offset}"; } public enum ScoreType diff --git a/osu.Game/Online/API/Requests/PostMessageRequest.cs b/osu.Game/Online/API/Requests/PostMessageRequest.cs index 44429bdcd5..e0a9fb83b2 100644 --- a/osu.Game/Online/API/Requests/PostMessageRequest.cs +++ b/osu.Game/Online/API/Requests/PostMessageRequest.cs @@ -23,7 +23,7 @@ namespace osu.Game.Online.API.Requests req.Method = HttpMethod.POST; req.AddParameter(@"target_type", message.TargetType.GetDescription()); req.AddParameter(@"target_id", message.TargetId.ToString()); - req.AddParameter(@"is_action", message.IsAction.ToString().ToLower()); + req.AddParameter(@"is_action", message.IsAction.ToString().ToLowerInvariant()); req.AddParameter(@"message", message.Content); return req; diff --git a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs index 2a154d1230..3c808d1bee 100644 --- a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs +++ b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs @@ -29,7 +29,7 @@ namespace osu.Game.Online.API.Requests } // ReSharper disable once ImpureMethodCallOnReadonlyValueField - protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.ID ?? 0}&s={(int)searchCategory}&sort={sortCriteria.ToString().ToLower()}_{directionString}"; + protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.ID ?? 0}&s={(int)searchCategory}&sort={sortCriteria.ToString().ToLowerInvariant()}_{directionString}"; } public enum BeatmapSearchCategory diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 0ac8e585f8..c48060bfa9 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -197,10 +197,10 @@ namespace osu.Game.Rulesets.Objects.Legacy var bank = (LegacyBeatmapDecoder.LegacySampleBank)int.Parse(split[0]); var addbank = (LegacyBeatmapDecoder.LegacySampleBank)int.Parse(split[1]); - string stringBank = bank.ToString().ToLower(); + string stringBank = bank.ToString().ToLowerInvariant(); if (stringBank == @"none") stringBank = null; - string stringAddBank = addbank.ToString().ToLower(); + string stringAddBank = addbank.ToString().ToLowerInvariant(); if (stringAddBank == @"none") stringAddBank = null; diff --git a/osu.Game/Screens/Multi/Header.cs b/osu.Game/Screens/Multi/Header.cs index 46610a36d8..809fc25083 100644 --- a/osu.Game/Screens/Multi/Header.cs +++ b/osu.Game/Screens/Multi/Header.cs @@ -86,7 +86,7 @@ namespace osu.Game.Screens.Multi }, }; - breadcrumbs.Current.ValueChanged += s => screenType.Text = ((MultiplayerScreen)s).Type.ToLower(); + breadcrumbs.Current.ValueChanged += s => screenType.Text = ((MultiplayerScreen)s).Type.ToLowerInvariant(); breadcrumbs.Current.TriggerChange(); } From b60e4b0728cc24a0067d673c6552f12de6e331e9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 25 Jul 2018 18:34:47 +0900 Subject: [PATCH 32/41] Cleanup --- .../Components/LabelledComponents/LabelledTextBox.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index fbfb771c8a..4c8e90400a 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -5,19 +5,15 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using static osu.Framework.Graphics.UserInterface.TextBox; namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents { public class LabelledTextBox : CompositeDrawable { - private readonly OsuTextBox textBox; - private readonly Container content; - private readonly OsuSpriteText label; - private const float label_container_width = 150; private const float outer_corner_radius = 15; private const float inner_corner_radius = 10; @@ -26,7 +22,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents private const float default_label_top_padding = 12; private const float default_label_text_size = 16; - public event OnCommitHandler OnCommit; + public event TextBox.OnCommitHandler OnCommit; public bool ReadOnly { @@ -88,6 +84,10 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents set => content.Colour = value; } + private readonly OsuTextBox textBox; + private readonly Container content; + private readonly OsuSpriteText label; + public LabelledTextBox() { RelativeSizeAxes = Axes.X; From 206e3686f2dc2fd98273892f6d5faeee4dfad304 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 25 Jul 2018 18:38:50 +0900 Subject: [PATCH 33/41] Add back blue border --- .../Setup/Components/LabelledComponents/LabelledTextBox.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 4c8e90400a..736d785b41 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Allocation; using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -145,5 +146,11 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents textBox.OnCommit += OnCommit; } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + textBox.BorderColour = colours.Blue; + } } } From c4b1ba2979ede6c0b00c29c6912801ad6e4d0adf Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Wed, 25 Jul 2018 15:14:40 +0300 Subject: [PATCH 34/41] Remove padding, fix corner radiuses --- .../Visual/TestCaseLabelledTextBox.cs | 10 ++++--- .../LabelledComponents/LabelledTextBox.cs | 27 +++---------------- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs index be11562bb0..d41739bfb5 100644 --- a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs +++ b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs @@ -4,6 +4,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents; using System; using System.Collections.Generic; @@ -21,15 +22,18 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load() { - Children = new Drawable[] + Child = new Container { - new LabelledTextBox + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + Padding = new MarginPadding { Left = 150, Right = 150 }, + Child = new LabelledTextBox { Anchor = Anchor.Centre, Origin = Anchor.Centre, LabelText = "Testing text", PlaceholderText = "This is definitely working as intended", - Padding = new MarginPadding { Left = 150, Right = 150 } } }; } diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 736d785b41..94200b7f4e 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -16,8 +16,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents public class LabelledTextBox : CompositeDrawable { private const float label_container_width = 150; - private const float outer_corner_radius = 15; - private const float inner_corner_radius = 10; + private const float corner_radius = 15; private const float default_height = 40; private const float default_label_left_padding = 15; private const float default_label_top_padding = 12; @@ -55,24 +54,6 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents set => textBox.Text = value; } - public MarginPadding Padding - { - get => base.Padding; - set => base.Padding = value; - } - - public MarginPadding LabelPadding - { - get => label.Padding; - set => label.Padding = value; - } - - public MarginPadding TextBoxPadding - { - get => textBox.Padding; - set => textBox.Padding = value; - } - public Color4 LabelTextColour { get => label.Colour; @@ -93,13 +74,13 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents { RelativeSizeAxes = Axes.X; Height = default_height; - CornerRadius = outer_corner_radius; + CornerRadius = corner_radius; Masking = true; InternalChild = new Container { RelativeSizeAxes = Axes.Both, - CornerRadius = outer_corner_radius, + CornerRadius = corner_radius, Masking = true, Children = new Drawable[] { @@ -131,7 +112,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents Origin = Anchor.TopLeft, RelativeSizeAxes = Axes.Both, Height = 1, - CornerRadius = inner_corner_radius, + CornerRadius = corner_radius, }, }, }, From ff2a3a6e9208c6d3fb7324cecea974eef9d2785f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 26 Jul 2018 20:07:16 +0900 Subject: [PATCH 35/41] Fix hitobjects not properly expiring if scrolling in the editor --- .../Objects/Drawables/DrawableOsuHitObject.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 02def2189f..5dc141bed0 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -1,11 +1,13 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.ComponentModel; using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Graphics; using System.Linq; using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; using OpenTK.Graphics; @@ -32,7 +34,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { UpdatePreemptState(); - using (BeginDelayedSequence(HitObject.TimePreempt + (Judgements.FirstOrDefault()?.TimeOffset ?? 0), true)) + var judgementOffset = Math.Min(HitObject.HitWindows.HalfWindowFor(HitResult.Miss), Judgements.FirstOrDefault()?.TimeOffset ?? 0); + + using (BeginDelayedSequence(HitObject.TimePreempt + judgementOffset, true)) UpdateCurrentState(state); } } From 71c49de0312c769922b91250a1de42eb8f7f5831 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 26 Jul 2018 21:00:18 +0900 Subject: [PATCH 36/41] Fix possible nullref if no fruits are ever caught --- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 2f42902fd0..7b06426b07 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -52,6 +52,9 @@ namespace osu.Game.Rulesets.Catch.UI { void runAfterLoaded(Action action) { + if (lastPlateableFruit == null) + return; + // this is required to make this run after the last caught fruit runs UpdateState at least once. // TODO: find a better alternative if (lastPlateableFruit.IsLoaded) From d32a3ff0524696cf274edb1649632e08340cce64 Mon Sep 17 00:00:00 2001 From: phosphene47 Date: Sat, 28 Jul 2018 08:34:51 +1000 Subject: [PATCH 37/41] Esc at the end of play should push to result screen Closes #3060 --- osu.Game/Screens/Play/Player.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 00ba1a8d12..438e5a49e0 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -278,6 +278,8 @@ namespace osu.Game.Screens.Play ScoreProcessor.PopulateScore(score); score.User = RulesetContainer.Replay?.User ?? api.LocalUser.Value; Push(new Results(score)); + + onCompletionEvent = null; }); } } @@ -340,6 +342,14 @@ namespace osu.Game.Screens.Play protected override bool OnExiting(Screen next) { + if (onCompletionEvent != null) + { + // Proceed to result screen if beatmap already finished playing + onCompletionEvent.RunTask(); + + return true; + } + if ((!AllowPause || HasFailed || !ValidForResume || pauseContainer?.IsPaused != false || RulesetContainer?.HasReplayLoaded != false) && (!pauseContainer?.IsResuming ?? true)) { // In the case of replays, we may have changed the playback rate. From f57ba4ffb17634c6e43a47ba063f4d5dc4dc32b2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Jul 2018 13:00:24 +0900 Subject: [PATCH 38/41] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 56a1979382..85e9e7e181 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 0205916b9ec4325b5b0371955107d834dc8740af Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Jul 2018 14:39:45 +0900 Subject: [PATCH 39/41] Revert "Specify tests directly" This reverts commit 1502edcdc6f2b194a088225c2dbfbb32b91727e8. --- appveyor.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 4545feade0..27f1484e32 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,8 +17,6 @@ build: project: osu.sln parallel: true verbosity: minimal -test_script: - - cmd: dotnet test --configuration Debug --no-build --test-adapter-path:. --logger:Appveyor after_build: - cmd: inspectcode --o="inspectcodereport.xml" --projects:osu.Game* --caches-home="inspectcode" osu.sln > NUL - cmd: NVika parsereport "inspectcodereport.xml" --treatwarningsaserrors From 8c3583ac54a9e98f48ff4fb073635410002883a7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Jul 2018 14:55:03 +0900 Subject: [PATCH 40/41] Remove newline --- osu.Game/Screens/Play/Player.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 438e5a49e0..cc649960ea 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -346,7 +346,6 @@ namespace osu.Game.Screens.Play { // Proceed to result screen if beatmap already finished playing onCompletionEvent.RunTask(); - return true; } From 338496452d0e0600053b25d35d166b2ddf45e476 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Jul 2018 15:15:51 +0900 Subject: [PATCH 41/41] Move testing package references to somewhere appveyor will find them --- .../osu.Game.Rulesets.Catch.Tests.csproj | 6 ++++++ .../osu.Game.Rulesets.Mania.Tests.csproj | 6 ++++++ .../osu.Game.Rulesets.Osu.Tests.csproj | 6 ++++++ .../osu.Game.Rulesets.Taiko.Tests.csproj | 6 ++++++ osu.Game.Tests/osu.Game.Tests.csproj | 6 ++++++ osu.TestProject.props | 4 ---- 6 files changed, 30 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj index 66c81dc14d..9bef8f258c 100644 --- a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj +++ b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj @@ -1,5 +1,11 @@  + + + + + + WinExe netcoreapp2.1 diff --git a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj index 7427862c0d..61057a64a1 100644 --- a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj +++ b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj @@ -1,5 +1,11 @@  + + + + + + WinExe netcoreapp2.1 diff --git a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj index 0d0e023e2a..9e10a556a4 100644 --- a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj +++ b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj @@ -1,5 +1,11 @@  + + + + + + WinExe netcoreapp2.1 diff --git a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj index 3c38a48be6..0e29da1549 100644 --- a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj +++ b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj @@ -1,5 +1,11 @@  + + + + + + WinExe netcoreapp2.1 diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 066df5418a..478a06ed30 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -1,5 +1,11 @@  + + + + + + WinExe netcoreapp2.1 diff --git a/osu.TestProject.props b/osu.TestProject.props index 1369af4aee..a73a4f8ce2 100644 --- a/osu.TestProject.props +++ b/osu.TestProject.props @@ -13,10 +13,6 @@ - - - -