From b6fd5b0f17ca5e3f0c6fd8bbf35359eb171ccc60 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Dec 2017 13:58:24 +0900 Subject: [PATCH 1/5] Fix keyboard and mouse input not properly getting blocked by GameplayMenuOverlay --- .../Bindings/GlobalKeyBindingInputManager.cs | 3 +- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 37 ++++++++++--------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/osu.Game/Input/Bindings/GlobalKeyBindingInputManager.cs b/osu.Game/Input/Bindings/GlobalKeyBindingInputManager.cs index 759396e195..745508ec9e 100644 --- a/osu.Game/Input/Bindings/GlobalKeyBindingInputManager.cs +++ b/osu.Game/Input/Bindings/GlobalKeyBindingInputManager.cs @@ -5,11 +5,12 @@ using System.Collections.Generic; using System.ComponentModel; using System.Linq; using osu.Framework.Graphics; +using osu.Framework.Input; using osu.Framework.Input.Bindings; namespace osu.Game.Input.Bindings { - public class GlobalKeyBindingInputManager : DatabasedKeyBindingInputManager + public class GlobalKeyBindingInputManager : DatabasedKeyBindingInputManager, IHandleGlobalInput { private readonly Drawable handler; diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index 182c4efe89..e49ebb5590 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -26,6 +26,8 @@ namespace osu.Game.Screens.Play protected override bool BlockPassThroughKeyboard => true; + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + public Action OnRetry; public Action OnQuit; @@ -197,6 +199,7 @@ namespace osu.Game.Screens.Play } private int _selectionIndex = -1; + private int selectionIndex { get { return _selectionIndex; } @@ -219,26 +222,26 @@ namespace osu.Game.Screens.Play protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { - if (args.Repeat) - return false; - - switch (args.Key) + if (!args.Repeat) { - case Key.Up: - if (selectionIndex == -1 || selectionIndex == 0) - selectionIndex = InternalButtons.Count - 1; - else - selectionIndex--; - return true; - case Key.Down: - if (selectionIndex == -1 || selectionIndex == InternalButtons.Count - 1) - selectionIndex = 0; - else - selectionIndex++; - return true; + switch (args.Key) + { + case Key.Up: + if (selectionIndex == -1 || selectionIndex == 0) + selectionIndex = InternalButtons.Count - 1; + else + selectionIndex--; + return true; + case Key.Down: + if (selectionIndex == -1 || selectionIndex == InternalButtons.Count - 1) + selectionIndex = 0; + else + selectionIndex++; + return true; + } } - return false; + return base.OnKeyDown(state, args); } private void buttonSelectionChanged(DialogButton button, bool isSelected) From 052badc1bd50f1f1db8e23fdba83829ad46103df Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Dec 2017 19:42:44 +0900 Subject: [PATCH 2/5] Add a right-click context option to carousel panels to view online beatmap details --- .../Select/Carousel/DrawableCarouselBeatmapSet.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index 8abb93950f..4b999f9b87 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -17,6 +17,7 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; using OpenTK; using OpenTK.Graphics; @@ -26,6 +27,7 @@ namespace osu.Game.Screens.Select.Carousel { private Action deleteRequested; private Action restoreHiddenRequested; + private Action viewDetails; private readonly BeatmapSetInfo beatmapSet; @@ -37,14 +39,16 @@ namespace osu.Game.Screens.Select.Carousel beatmapSet = set.BeatmapSet; } - [BackgroundDependencyLoader] - private void load(LocalisationEngine localisation, BeatmapManager manager) + [BackgroundDependencyLoader(true)] + private void load(LocalisationEngine localisation, BeatmapManager manager, BeatmapSetOverlay beatmapOverlay) { if (localisation == null) throw new ArgumentNullException(nameof(localisation)); restoreHiddenRequested = s => s.Beatmaps.ForEach(manager.Restore); deleteRequested = manager.Delete; + if (beatmapOverlay != null) + viewDetails = beatmapOverlay.ShowBeatmapSet; Children = new Drawable[] { @@ -96,6 +100,9 @@ namespace osu.Game.Screens.Select.Carousel if (Item.State == CarouselItemState.NotSelected) items.Add(new OsuMenuItem("Expand", MenuItemType.Highlighted, () => Item.State.Value = CarouselItemState.Selected)); + if (beatmapSet.OnlineBeatmapSetID != null) + items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => viewDetails?.Invoke(beatmapSet.OnlineBeatmapSetID.Value))); + if (beatmapSet.Beatmaps.Any(b => b.Hidden)) items.Add(new OsuMenuItem("Restore all hidden", MenuItemType.Standard, () => restoreHiddenRequested?.Invoke(beatmapSet))); From fdd218c64189e25a8eb68d89cfee136431a1d8e0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 21 Dec 2017 20:11:00 +0900 Subject: [PATCH 3/5] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 28fbd0711c..f4fde31f8c 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 28fbd0711c09d3b06b51fc728b025f83ded2f0f8 +Subproject commit f4fde31f8c09305d2130064da2f7bae995be8286 From 6fbd06f96735179655a8d260866d38b131c7a107 Mon Sep 17 00:00:00 2001 From: Seokho Song <0xdevssh@gmail.com> Date: Tue, 19 Dec 2017 00:53:17 +0900 Subject: [PATCH 4/5] Fix Not update retry counter on PauseOverlay I've find "You've retried xx time(s)" message that something weird. That is not displayed pause overlay and only see count on FailOverlay I change code that PauseContainer.Retries property can be set call-back function. Signed-off-by: Seokho Song <0xdevssh@gmail.com> --- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 70 +++++++++++--------- osu.Game/Screens/Play/Player.cs | 2 +- 2 files changed, 40 insertions(+), 32 deletions(-) diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index 182c4efe89..cf3eba00a8 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -122,44 +122,20 @@ namespace osu.Game.Screens.Play }, }; - Retries = 0; + updateRetryCount(); } + private int retries; public int Retries { set { - if (retryCounterContainer != null) - { - // "You've retried 1,065 times in this session" - // "You've retried 1 time in this session" + if (value == retries) + return; - retryCounterContainer.Children = new Drawable[] - { - new OsuSpriteText - { - Text = "You've retried ", - Shadow = true, - ShadowColour = new Color4(0, 0, 0, 0.25f), - TextSize = 18 - }, - new OsuSpriteText - { - Text = $"{value:n0}", - Font = @"Exo2.0-Bold", - Shadow = true, - ShadowColour = new Color4(0, 0, 0, 0.25f), - TextSize = 18 - }, - new OsuSpriteText - { - Text = $" time{(value == 1 ? "" : "s")} in this session", - Shadow = true, - ShadowColour = new Color4(0, 0, 0, 0.25f), - TextSize = 18 - } - }; - } + retries = value; + if (retryCounterContainer != null) + updateRetryCount(); } } @@ -249,6 +225,38 @@ namespace osu.Game.Screens.Play selectionIndex = InternalButtons.IndexOf(button); } + private void updateRetryCount() + { + // "You've retried 1,065 times in this session" + // "You've retried 1 time in this session" + + retryCounterContainer.Children = new Drawable[] + { + new OsuSpriteText + { + Text = "You've retried ", + Shadow = true, + ShadowColour = new Color4(0, 0, 0, 0.25f), + TextSize = 18 + }, + new OsuSpriteText + { + Text = $"{retries:n0}", + Font = @"Exo2.0-Bold", + Shadow = true, + ShadowColour = new Color4(0, 0, 0, 0.25f), + TextSize = 18 + }, + new OsuSpriteText + { + Text = $" time{(retries == 1 ? "" : "s")} in this session", + Shadow = true, + ShadowColour = new Color4(0, 0, 0, 0.25f), + TextSize = 18 + } + }; + } + private class Button : DialogButton { protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index b5b09504da..e9992f2df7 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -161,8 +161,8 @@ namespace osu.Game.Screens.Play OnRetry = Restart, OnQuit = Exit, CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded, - Retries = RestartCount, OnPause = () => { + pauseContainer.Retries = RestartCount; hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused; }, OnResume = () => { From abe465358c2a2994808833a7430c0358a9ac7f22 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Dec 2017 21:46:57 +0900 Subject: [PATCH 5/5] Fix formatting --- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 45 ++++++++++---------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index ac355b82ca..6969cd915b 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -128,6 +128,7 @@ namespace osu.Game.Screens.Play } private int retries; + public int Retries { set @@ -235,28 +236,28 @@ namespace osu.Game.Screens.Play retryCounterContainer.Children = new Drawable[] { - new OsuSpriteText - { - Text = "You've retried ", - Shadow = true, - ShadowColour = new Color4(0, 0, 0, 0.25f), - TextSize = 18 - }, - new OsuSpriteText - { - Text = $"{retries:n0}", - Font = @"Exo2.0-Bold", - Shadow = true, - ShadowColour = new Color4(0, 0, 0, 0.25f), - TextSize = 18 - }, - new OsuSpriteText - { - Text = $" time{(retries == 1 ? "" : "s")} in this session", - Shadow = true, - ShadowColour = new Color4(0, 0, 0, 0.25f), - TextSize = 18 - } + new OsuSpriteText + { + Text = "You've retried ", + Shadow = true, + ShadowColour = new Color4(0, 0, 0, 0.25f), + TextSize = 18 + }, + new OsuSpriteText + { + Text = $"{retries:n0}", + Font = @"Exo2.0-Bold", + Shadow = true, + ShadowColour = new Color4(0, 0, 0, 0.25f), + TextSize = 18 + }, + new OsuSpriteText + { + Text = $" time{(retries == 1 ? "" : "s")} in this session", + Shadow = true, + ShadowColour = new Color4(0, 0, 0, 0.25f), + TextSize = 18 + } }; }