diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs index 0ceb5f21d3..c0da605cdb 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs @@ -61,10 +61,17 @@ namespace osu.Game.Tests.Visual.Online FullName = "Belarus" }; + var unknownCountry = new Country + { + FlagName = "CK", + FullName = "Cook Islands" + }; + AddStep("Set country", () => countryBindable.Value = country); AddAssert("Check scope is Performance", () => scope.Value == RankingsScope.Performance); AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score); AddAssert("Check country is Null", () => countryBindable.Value == null); + AddStep("Set country with no flag", () => countryBindable.Value = unknownCountry); } } } diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index f532302de2..02d928ec66 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -83,11 +83,19 @@ namespace osu.Game.Graphics const int frames_to_wait = 3; int framesWaited = 0; - ScheduledDelegate waitDelegate = host.DrawThread.Scheduler.AddDelayed(() => framesWaited++, 0, true); - while (framesWaited < frames_to_wait) - Thread.Sleep(10); - waitDelegate.Cancel(); + using (var framesWaitedEvent = new ManualResetEventSlim(false)) + { + ScheduledDelegate waitDelegate = host.DrawThread.Scheduler.AddDelayed(() => + { + if (framesWaited++ < frames_to_wait) + // ReSharper disable once AccessToDisposedClosure + framesWaitedEvent.Set(); + }, 10, true); + + framesWaitedEvent.Wait(); + waitDelegate.Cancel(); + } } using (var image = await host.TakeScreenshotAsync()) diff --git a/osu.Game/Overlays/Rankings/RankingsHeader.cs b/osu.Game/Overlays/Rankings/RankingsHeader.cs index fbf3097f4f..6aa3e75df9 100644 --- a/osu.Game/Overlays/Rankings/RankingsHeader.cs +++ b/osu.Game/Overlays/Rankings/RankingsHeader.cs @@ -18,7 +18,6 @@ namespace osu.Game.Overlays.Rankings public class RankingsHeader : CompositeDrawable { private const int content_height = 250; - private const int dropdown_height = 50; public IEnumerable Spotlights { @@ -31,7 +30,6 @@ namespace osu.Game.Overlays.Rankings public readonly Bindable Country = new Bindable(); public readonly Bindable Spotlight = new Bindable(); - private readonly Container dropdownPlaceholder; private readonly OsuDropdown dropdown; public RankingsHeader() @@ -86,19 +84,13 @@ namespace osu.Game.Overlays.Rankings Scope = { BindTarget = Scope }, Country = { BindTarget = Country }, }, - dropdownPlaceholder = new Container + dropdown = new OsuDropdown { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.X, - Height = dropdown_height, Width = 0.8f, - AlwaysPresent = true, - Child = dropdown = new OsuDropdown - { - RelativeSizeAxes = Axes.X, - Current = Spotlight, - } + Current = Spotlight, } } }, @@ -115,7 +107,7 @@ namespace osu.Game.Overlays.Rankings } private void onScopeChanged(ValueChangedEvent scope) => - dropdownPlaceholder.FadeTo(scope.NewValue == RankingsScope.Spotlights ? 1 : 0, 200, Easing.OutQuint); + dropdown.FadeTo(scope.NewValue == RankingsScope.Spotlights ? 1 : 0, 200, Easing.OutQuint); private class HeaderBackground : Sprite { diff --git a/osu.Game/Users/Drawables/DrawableFlag.cs b/osu.Game/Users/Drawables/DrawableFlag.cs index 368354e48e..1d648e46b6 100644 --- a/osu.Game/Users/Drawables/DrawableFlag.cs +++ b/osu.Game/Users/Drawables/DrawableFlag.cs @@ -26,7 +26,7 @@ namespace osu.Game.Users.Drawables if (ts == null) throw new ArgumentNullException(nameof(ts)); - Texture = ts.Get($@"Flags/{country?.FlagName ?? @"__"}"); + Texture = ts.Get($@"Flags/{country?.FlagName ?? @"__"}") ?? ts.Get(@"Flags/__"); } } }