From d909cce8d6b1f5e47da00d762d795c701b28e4af Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 21 Mar 2018 20:06:10 +0900 Subject: [PATCH 1/5] Add the ability to skin the gameplay cursor --- .../UI/Cursor/GameplayCursor.cs | 117 +++++++++--------- 1 file changed, 59 insertions(+), 58 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs index 34940a084a..ac81d93309 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Bindings; using osu.Game.Beatmaps; using osu.Game.Configuration; +using osu.Game.Skinning; using OpenTK; using OpenTK.Graphics; @@ -82,7 +83,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor public class OsuCursor : Container { - private Container cursorContainer; + private Drawable cursorContainer; private Bindable cursorScale; private Bindable autoCursorScale; @@ -97,66 +98,66 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor [BackgroundDependencyLoader] private void load(OsuConfigManager config, OsuGameBase game) { - Children = new Drawable[] + Child = cursorContainer = new SkinnableDrawable("cursor", _ => new CircularContainer { - cursorContainer = new CircularContainer + RelativeSizeAxes = Axes.Both, + Masking = true, + BorderThickness = Size.X / 6, + BorderColour = Color4.White, + EdgeEffect = new EdgeEffectParameters { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Masking = true, - BorderThickness = Size.X / 6, - BorderColour = Color4.White, - EdgeEffect = new EdgeEffectParameters - { - Type = EdgeEffectType.Shadow, - Colour = Color4.Pink.Opacity(0.5f), - Radius = 5, - }, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true, - }, - new CircularContainer - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Masking = true, - BorderThickness = Size.X / 3, - BorderColour = Color4.White.Opacity(0.5f), - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true, - }, - }, - }, - new CircularContainer - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Scale = new Vector2(0.1f), - Masking = true, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.White, - }, - }, - }, - } + Type = EdgeEffectType.Shadow, + Colour = Color4.Pink.Opacity(0.5f), + Radius = 5, }, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true, + }, + new CircularContainer + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Masking = true, + BorderThickness = Size.X / 3, + BorderColour = Color4.White.Opacity(0.5f), + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true, + }, + }, + }, + new CircularContainer + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Scale = new Vector2(0.1f), + Masking = true, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + }, + }, + }, + } + }, restrictSize: false) + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + RelativeSizeAxes = Axes.Both, }; beatmap = game.Beatmap.GetBoundCopy(); From d4aeb3d00bb021dde49b742ed1aad3a0c69ed6f9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 23 Mar 2018 01:06:05 +0900 Subject: [PATCH 2/5] Fix BeatmapCarousel's flush not correctly applying selection changes They may have been delayed until the next Update, which is too late in this case. --- osu.Game/Screens/Select/BeatmapCarousel.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index c2bb155753..aed8fb110f 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -328,7 +328,10 @@ namespace osu.Game.Screens.Select public void FlushPendingFilterOperations() { if (FilterTask?.Completed == false) + { applyActiveCriteria(false, false); + Update(); + } } public void Filter(FilterCriteria newCriteria, bool debounce = true) From b56eee1927f6c80bf777f2529687537fc9699e36 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 23 Mar 2018 15:04:40 +0900 Subject: [PATCH 3/5] Fix background loaded player never being disposed if early exit occurs --- osu.Game/Screens/Play/PlayerLoader.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 89082cfbd5..6d55cdb9ca 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.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.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -27,6 +28,8 @@ namespace osu.Game.Screens.Play private bool showOverlays = true; public override bool ShowOverlaysOnEnter => showOverlays; + private Task loadTask; + public PlayerLoader(Player player) { this.player = player; @@ -55,7 +58,7 @@ namespace osu.Game.Screens.Play Margin = new MarginPadding(25) }); - LoadComponentAsync(player); + loadTask = LoadComponentAsync(player); } protected override void OnResuming(Screen last) @@ -65,7 +68,7 @@ namespace osu.Game.Screens.Play contentIn(); //we will only be resumed if the player has requested a re-run (see ValidForResume setting above) - LoadComponentAsync(player = new Player + loadTask = LoadComponentAsync(player = new Player { RestartCount = player.RestartCount + 1, RestartRequested = player.RestartRequested, @@ -154,6 +157,8 @@ namespace osu.Game.Screens.Play { if (!IsCurrentScreen) return; + loadTask = null; + if (!Push(player)) Exit(); else @@ -192,6 +197,14 @@ namespace osu.Game.Screens.Play return base.OnExiting(next); } + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + // if the player never got pushed, we should explicitly dispose it. + loadTask?.ContinueWith(_ => player.Dispose()); + } + private class BeatmapMetadataDisplay : Container { private class MetadataLine : Container From eb751fa607d25c187947cb53bd4d7988f8824114 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 23 Mar 2018 15:05:28 +0900 Subject: [PATCH 4/5] Fix event unbind not being unbound correctly --- osu.Game/Skinning/LocalSkinOverrideContainer.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index b7e2bd0daf..d000127859 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -48,13 +48,15 @@ namespace osu.Game.Skinning this.source = source; } + private void onSourceChanged() => SourceChanged?.Invoke(); + protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) { var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); fallbackSource = dependencies.Get(); if (fallbackSource != null) - fallbackSource.SourceChanged += () => SourceChanged?.Invoke(); + fallbackSource.SourceChanged += onSourceChanged; dependencies.CacheAs(this); @@ -66,7 +68,7 @@ namespace osu.Game.Skinning base.Dispose(isDisposing); if (fallbackSource != null) - fallbackSource.SourceChanged -= SourceChanged; + fallbackSource.SourceChanged -= onSourceChanged; } } } From 52fa837447ba745843331a11e36d3a908115fd03 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 23 Mar 2018 18:17:14 +0900 Subject: [PATCH 5/5] Fix volume glow being cut off Fixes #2285. --- osu.Game/Overlays/Volume/VolumeMeter.cs | 27 ++++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index 64b9e513c4..b1951f4d72 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Bindings; +using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Input.Bindings; @@ -93,19 +94,25 @@ namespace osu.Game.Overlays.Volume Colour = colours.Gray2, Size = new Vector2(0.8f) }, - (volumeCircle = new CircularProgress + new Container { - RelativeSizeAxes = Axes.Both, - InnerRadius = 0.05f, - Rotation = 180, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(0.8f) - }).WithEffect(new GlowEffect - { - Colour = meterColour, - Strength = 2 - }), + RelativeSizeAxes = Axes.Both, + Size = new Vector2(0.8f), + Padding = new MarginPadding(-Blur.KernelSize(5)), + Rotation = 180, + Child = (volumeCircle = new CircularProgress + { + RelativeSizeAxes = Axes.Both, + InnerRadius = 0.05f, + }).WithEffect(new GlowEffect + { + Colour = meterColour, + Strength = 2, + PadExtent = true + }), + }, maxGlow = (text = new OsuSpriteText { Anchor = Anchor.Centre,