From 89db7f81cbd9d1d4b7d452cfc584b259f98751c7 Mon Sep 17 00:00:00 2001 From: Santeri Nogelainen Date: Wed, 2 May 2018 17:11:55 +0300 Subject: [PATCH 1/5] Selecting a mod now triggers on mouseup --- osu.Game/Overlays/Mods/ModButton.cs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 2a4f243606..3f1541aee3 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -147,18 +147,21 @@ namespace osu.Game.Overlays.Mods public virtual Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex); - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - switch (args.Button) + // only trigger the event if we are inside the area of the button + if (Contains(ToScreenSpace(state.Mouse.Position - Position))) { - case MouseButton.Left: - SelectNext(1); - break; - case MouseButton.Right: - SelectNext(-1); - break; + switch (args.Button) + { + case MouseButton.Left: + SelectNext(1); + break; + case MouseButton.Right: + SelectNext(-1); + break; + } } - return true; } From 4fc887b25f1addd4cc08d7cdcb6e93df23c3ad16 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 11 May 2018 21:40:36 +0900 Subject: [PATCH 2/5] Add a pressing effect to make mouse up response feel good --- osu.Game/Overlays/Mods/ModButton.cs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 3f1541aee3..1d012b1288 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -116,6 +116,7 @@ namespace osu.Game.Overlays.Mods } private Mod mod; + private Container scaleContainer; public Mod Mod { @@ -147,8 +148,16 @@ namespace osu.Game.Overlays.Mods public virtual Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex); + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + { + scaleContainer.ScaleTo(0.9f, 800, Easing.Out); + return base.OnMouseDown(state, args); + } + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { + scaleContainer.ScaleTo(1, 500, Easing.OutElastic); + // only trigger the event if we are inside the area of the button if (Contains(ToScreenSpace(state.Mouse.Position - Position))) { @@ -162,6 +171,7 @@ namespace osu.Game.Overlays.Mods break; } } + return true; } @@ -179,7 +189,8 @@ namespace osu.Game.Overlays.Mods start = Mods.Length - 1; for (int i = start; i < Mods.Length && i >= 0; i += direction) - if (SelectAt(i)) return; + if (SelectAt(i)) + return; Deselect(); } @@ -245,8 +256,14 @@ namespace osu.Game.Overlays.Mods Anchor = Anchor.TopCentre, Children = new Drawable[] { - iconsContainer = new Container + scaleContainer = new Container { + Child = iconsContainer = new Container + { + RelativeSizeAxes = Axes.Both, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + }, RelativeSizeAxes = Axes.Both, Origin = Anchor.Centre, Anchor = Anchor.Centre, From 7cb0d328e60fbccc495b419fc69eed730b348881 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 11 May 2018 21:40:48 +0900 Subject: [PATCH 3/5] Make mods screen dynamically testable --- osu.Game.Tests/Visual/TestCaseMods.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseMods.cs b/osu.Game.Tests/Visual/TestCaseMods.cs index dad8fb8fed..d3d21509fd 100644 --- a/osu.Game.Tests/Visual/TestCaseMods.cs +++ b/osu.Game.Tests/Visual/TestCaseMods.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; using System.ComponentModel; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -17,6 +18,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Mania.Mods; +using osu.Game.Rulesets.UI; using OpenTK.Graphics; namespace osu.Game.Tests.Visual @@ -24,6 +26,19 @@ namespace osu.Game.Tests.Visual [Description("mod select and icon display")] public class TestCaseMods : OsuTestCase { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(ModSelectOverlay), + typeof(ModDisplay), + typeof(ModSection), + typeof(ModIcon), + typeof(ModButton), + typeof(ModButtonEmpty), + typeof(DifficultyReductionSection), + typeof(DifficultyIncreaseSection), + typeof(SpecialSection), + }; + private const string unranked_suffix = " (Unranked)"; private RulesetStore rulesets; @@ -66,7 +81,8 @@ namespace osu.Game.Tests.Visual Ruleset ruleset = rulesetInfo.CreateInstance(); AddStep($"switch to {ruleset.Description}", () => modSelect.Ruleset.Value = rulesetInfo); - switch (ruleset) { + switch (ruleset) + { case OsuRuleset or: testOsuMods(or); break; From aa5d5ab2a844c5834134b159c1960b2c3f397dca Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 11 May 2018 21:48:35 +0900 Subject: [PATCH 4/5] Fix readonly field --- osu.Game/Overlays/Mods/ModButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 1d012b1288..f4e0e3db04 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -116,7 +116,7 @@ namespace osu.Game.Overlays.Mods } private Mod mod; - private Container scaleContainer; + private readonly Container scaleContainer; public Mod Mod { From 6ebe9f88e78b1c222fcecb6ba4b3ec5f0e003eed Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 12 May 2018 11:11:09 +0900 Subject: [PATCH 5/5] Update framework with upstream fixes --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 8c4f232694..f807997301 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 8c4f23269447d9ce21a5dbd3a0fd4f6caae9ab38 +Subproject commit f8079973011b54e84e5c0e677fe2b56e55947666