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.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..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,8 +1,14 @@  + + + + + + WinExe - netcoreapp2.1;net471 + netcoreapp2.1 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) 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.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj index 77504fdc3c..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,8 +1,14 @@  + + + + + + 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..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,8 +1,14 @@  + + + + + + WinExe - netcoreapp2.1;net471 + netcoreapp2.1 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); } } 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..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,8 +1,14 @@  + + + + + + WinExe - netcoreapp2.1;net471 + netcoreapp2.1 diff --git a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs new file mode 100644 index 0000000000..d41739bfb5 --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs @@ -0,0 +1,41 @@ +// 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.Framework.Graphics.Containers; +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() + { + Child = new Container + { + 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", + } + }; + } + } +} diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 532915100b..478a06ed30 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -1,8 +1,14 @@  + + + + + + WinExe - netcoreapp2.1;net471 + netcoreapp2.1 diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index 24e6021421..c7e97cef55 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -23,7 +23,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)?.ToUpperInvariant(); } } 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/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); } } 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/OsuGame.cs b/osu.Game/OsuGame.cs index 18a1d018d0..83912944d4 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -580,10 +580,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 applyRestrictions = !currentScreen?.AllowBeatmapRulesetChange ?? false; + bool applyBeatmapRulesetRestrictions = !currentScreen?.AllowBeatmapRulesetChange ?? false; - ruleset.Disabled = applyRestrictions; - Beatmap.Disabled = applyRestrictions; + ruleset.Disabled = applyBeatmapRulesetRestrictions; + Beatmap.Disabled = applyBeatmapRulesetRestrictions; mainContent.Padding = new MarginPadding { Top = ToolbarOffset }; 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)) diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index 89d9d2231c..85fdecaaba 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Chat public string Header { get { return header.Text; } - set { header.Text = value.ToUpper(); } + 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 ce79e70b1c..a27278e002 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -62,7 +62,7 @@ namespace osu.Game.Overlays.MedalSplash { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = "Medal Unlocked".ToUpper(), + Text = "Medal Unlocked".ToUpperInvariant(), TextSize = 24, Font = @"Exo2.0-Light", Alpha = 0f, diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 3def4c144e..886b5fb95b 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 = progress => current?.Track.Seek(progress) + OnSeek = attemptSeek } }, }, @@ -198,6 +198,12 @@ namespace osu.Game.Overlays playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); } + private void attemptSeek(double progress) + { + if (!beatmap.Disabled) + current?.Track.Seek(progress); + } + private void playlistOrderChanged(BeatmapSetInfo beatmapSetInfo, int index) { beatmapSets.Remove(beatmapSetInfo); @@ -219,6 +225,7 @@ namespace osu.Game.Overlays if (disabled) playlist.Hide(); + playButton.Enabled.Value = !disabled; prevButton.Enabled.Value = !disabled; nextButton.Enabled.Value = !disabled; playlistButton.Enabled.Value = !disabled; diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index c166624d2b..f41e3e876f 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -55,7 +55,7 @@ namespace osu.Game.Overlays.Notifications set { title = value; - if (titleText != null) titleText.Text = title.ToUpper(); + if (titleText != null) titleText.Text = title.ToUpperInvariant(); } } @@ -101,7 +101,7 @@ namespace osu.Game.Overlays.Notifications { titleText = new OsuSpriteText { - Text = title.ToUpper(), + Text = title.ToUpperInvariant(), Font = @"Exo2.0-Black", }, countText = new OsuSpriteText @@ -154,7 +154,7 @@ namespace osu.Game.Overlays.Notifications public string Text { get { return text.Text; } - set { text.Text = value.ToUpper(); } + set { text.Text = value.ToUpperInvariant(); } } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 5a5b90ee25..041ceab365 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -176,9 +176,9 @@ namespace osu.Game.Overlays { Schedule(() => { - textLine1.Text = description.Name.ToUpper(); + textLine1.Text = description.Name.ToUpperInvariant(); textLine2.Text = description.Value; - textLine3.Text = description.Shortcut.ToUpper(); + 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 82589a99bd..9296972749 100644 --- a/osu.Game/Overlays/Settings/SettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/SettingsSubsection.cs @@ -51,7 +51,7 @@ namespace osu.Game.Overlays.Settings { new OsuSpriteText { - Text = Header.ToUpper(), + 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 74ee025823..5de14ae579 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Judgements Child = new SkinnableDrawable($"Play/{Judgement.Result}", _ => JudgementText = new OsuSpriteText { - Text = Judgement.Result.GetDescription().ToUpper(), + Text = Judgement.Result.GetDescription().ToUpperInvariant(), Font = @"Venera", Colour = judgementColour(Judgement.Result), Scale = new Vector2(0.85f, 1), 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/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs new file mode 100644 index 0000000000..94200b7f4e --- /dev/null +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -0,0 +1,137 @@ +// 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; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.UserInterface; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents +{ + public class LabelledTextBox : CompositeDrawable + { + private const float label_container_width = 150; + 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; + private const float default_label_text_size = 16; + + public event TextBox.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; + set => textBox.PlaceholderText = value; + } + + public string Text + { + get => textBox.Text; + set => textBox.Text = value; + } + + public Color4 LabelTextColour + { + get => label.Colour; + set => label.Colour = value; + } + + public Color4 BackgroundColour + { + get => content.Colour; + set => content.Colour = value; + } + + private readonly OsuTextBox textBox; + private readonly Container content; + private readonly OsuSpriteText label; + + public LabelledTextBox() + { + RelativeSizeAxes = Axes.X; + Height = default_height; + CornerRadius = corner_radius; + Masking = true; + + InternalChild = new Container + { + RelativeSizeAxes = Axes.Both, + CornerRadius = corner_radius, + Masking = true, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex("1c2125"), + }, + 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, + Font = @"Exo2.0-Bold", + }, + textBox = new OsuTextBox + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + RelativeSizeAxes = Axes.Both, + Height = 1, + CornerRadius = corner_radius, + }, + }, + }, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, label_container_width), + new Dimension() + } + } + } + }; + + textBox.OnCommit += OnCommit; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + textBox.BorderColour = colours.Blue; + } + } +} 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(); } diff --git a/osu.Game/Screens/Play/Break/BreakInfo.cs b/osu.Game/Screens/Play/Break/BreakInfo.cs index 77c9c967b4..51d39762d2 100644 --- a/osu.Game/Screens/Play/Break/BreakInfo.cs +++ b/osu.Game/Screens/Play/Break/BreakInfo.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Play.Break { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = "current progress".ToUpper(), + Text = "current progress".ToUpperInvariant(), TextSize = 15, Font = "Exo2.0-Black", }, diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 4f37b59e6e..cc649960ea 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, RulesetContainer.GameplayStartTime - beatmap.BeatmapInfo.AudioLeadIn) : RulesetContainer.GameplayStartTime); adjustableClock.ProcessFrame(); @@ -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,13 @@ 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. diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index 1813d02d02..c4767f404d 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs @@ -94,7 +94,7 @@ namespace osu.Game.Screens.Play.PlayerSettings { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Text = Title.ToUpper(), + Text = Title.ToUpperInvariant(), TextSize = 17, Font = @"Exo2.0-Bold", Margin = new MarginPadding { Left = 10 }, 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) diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 49a46b96e3..63d29d5cd7 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -323,7 +323,7 @@ namespace osu.Game.Screens.Tournament if (string.IsNullOrEmpty(line)) continue; - if (line.ToUpper().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 b1bcd6052c..6845d8fc48 100644 --- a/osu.Game/Screens/Tournament/Group.cs +++ b/osu.Game/Screens/Tournament/Group.cs @@ -51,7 +51,7 @@ namespace osu.Game.Screens.Tournament Position = new Vector2(0, 7f), - Text = $"GROUP {name.ToUpper()}", + Text = $"GROUP {name.ToUpperInvariant()}", TextSize = 8f, Font = @"Exo2.0-Bold", Colour = new Color4(255, 204, 34, 255), @@ -161,7 +161,7 @@ namespace osu.Game.Screens.Tournament Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = team.Acronym.ToUpper(), + Text = team.Acronym.ToUpperInvariant(), TextSize = 10f, Font = @"Exo2.0-Bold" } 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 @@ - + diff --git a/osu.TestProject.props b/osu.TestProject.props index c2e6048a60..a73a4f8ce2 100644 --- a/osu.TestProject.props +++ b/osu.TestProject.props @@ -13,9 +13,6 @@ - - -