From bf162f148e320f93cc85456ee780383c030878a2 Mon Sep 17 00:00:00 2001 From: mcendu Date: Sat, 28 Dec 2019 13:48:10 +0800 Subject: [PATCH 01/10] Move mania stage hint to its own class --- .../UI/Components/ColumnHitObjectArea.cs | 108 ++++++++++++------ .../UI/Components/StageHint.cs | 14 +++ 2 files changed, 90 insertions(+), 32 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/UI/Components/StageHint.cs diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs index 386bcbb724..dde718d5ba 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs @@ -22,26 +22,15 @@ namespace osu.Game.Rulesets.Mania.UI.Components private readonly IBindable direction = new Bindable(); - private readonly Container hitTargetLine; - private readonly Drawable hitTargetBar; + private readonly Drawable stageHint; public ColumnHitObjectArea(HitObjectContainer hitObjectContainer) { - InternalChildren = new[] + InternalChildren = new Drawable[] { - hitTargetBar = new Box + stageHint = new DefaultStageHint { RelativeSizeAxes = Axes.X, - Height = NotePiece.NOTE_HEIGHT, - Alpha = 0.6f, - Colour = Color4.Black - }, - hitTargetLine = new Container - { - RelativeSizeAxes = Axes.X, - Height = hit_target_bar_height, - Masking = true, - Child = new Box { RelativeSizeAxes = Axes.Both } }, hitObjectContainer }; @@ -55,17 +44,10 @@ namespace osu.Game.Rulesets.Mania.UI.Components { Anchor anchor = dir.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; - hitTargetBar.Anchor = hitTargetBar.Origin = anchor; - hitTargetLine.Anchor = hitTargetLine.Origin = anchor; + stageHint.Anchor = stageHint.Origin = anchor; }, true); } - protected override void LoadComplete() - { - base.LoadComplete(); - updateColours(); - } - private Color4 accentColour; public Color4 AccentColour @@ -77,22 +59,84 @@ namespace osu.Game.Rulesets.Mania.UI.Components return; accentColour = value; - - updateColours(); } } - private void updateColours() + private class DefaultStageHint : StageHint { - if (!IsLoaded) - return; + private readonly IBindable direction = new Bindable(); - hitTargetLine.EdgeEffect = new EdgeEffectParameters + private readonly Container hitTargetLine; + private readonly Drawable hitTargetBar; + + public DefaultStageHint() { - Type = EdgeEffectType.Glow, - Radius = 5, - Colour = accentColour.Opacity(0.5f), - }; + InternalChildren = new[] + { + hitTargetBar = new Box + { + RelativeSizeAxes = Axes.X, + Height = NotePiece.NOTE_HEIGHT, + Alpha = 0.6f, + Colour = Color4.Black + }, + hitTargetLine = new Container + { + RelativeSizeAxes = Axes.X, + Height = hit_target_bar_height, + Masking = true, + Child = new Box { RelativeSizeAxes = Axes.Both } + }, + }; + } + + [BackgroundDependencyLoader] + private void load(IScrollingInfo scrollingInfo) + { + direction.BindTo(scrollingInfo.Direction); + direction.BindValueChanged(dir => + { + Anchor anchor = dir.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; + + hitTargetBar.Anchor = hitTargetBar.Origin = anchor; + hitTargetLine.Anchor = hitTargetLine.Origin = anchor; + }, true); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + updateColours(); + } + + private Color4 accentColour; + + public override Color4 AccentColour + { + get => accentColour; + set + { + if (accentColour == value) + return; + + accentColour = value; + + updateColours(); + } + } + + private void updateColours() + { + if (!IsLoaded) + return; + + hitTargetLine.EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Glow, + Radius = 5, + Colour = accentColour.Opacity(0.5f), + }; + } } } } diff --git a/osu.Game.Rulesets.Mania/UI/Components/StageHint.cs b/osu.Game.Rulesets.Mania/UI/Components/StageHint.cs new file mode 100644 index 0000000000..9574f77eb5 --- /dev/null +++ b/osu.Game.Rulesets.Mania/UI/Components/StageHint.cs @@ -0,0 +1,14 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; +using osuTK.Graphics; + +namespace osu.Game.Rulesets.Mania.UI.Components +{ + public abstract class StageHint : CompositeDrawable, IHasAccentColour + { + public abstract Color4 AccentColour { get; set; } + } +} From 5d2b5cc950b5608cdf369c1d3e226733a7648689 Mon Sep 17 00:00:00 2001 From: mcendu Date: Sat, 28 Dec 2019 14:05:46 +0800 Subject: [PATCH 02/10] correct type of field stageHint --- osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs index dde718d5ba..6bfb2b89aa 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Mania.UI.Components private readonly IBindable direction = new Bindable(); - private readonly Drawable stageHint; + private readonly StageHint stageHint; public ColumnHitObjectArea(HitObjectContainer hitObjectContainer) { @@ -59,6 +59,8 @@ namespace osu.Game.Rulesets.Mania.UI.Components return; accentColour = value; + + stageHint.AccentColour = accentColour; } } From cdfbe96e9bdceecc7f04ff2262e23b4e207720e7 Mon Sep 17 00:00:00 2001 From: mcendu Date: Sun, 29 Dec 2019 14:52:51 +0800 Subject: [PATCH 03/10] Make AccentColour of StageHint virtual --- osu.Game.Rulesets.Mania/UI/Components/StageHint.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/UI/Components/StageHint.cs b/osu.Game.Rulesets.Mania/UI/Components/StageHint.cs index 9574f77eb5..813a6928c9 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/StageHint.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/StageHint.cs @@ -9,6 +9,6 @@ namespace osu.Game.Rulesets.Mania.UI.Components { public abstract class StageHint : CompositeDrawable, IHasAccentColour { - public abstract Color4 AccentColour { get; set; } + public virtual Color4 AccentColour { get; set; } } } From 61fb9f5613dc47c07a96b88eba4f40f23efeb0c2 Mon Sep 17 00:00:00 2001 From: mcendu Date: Sun, 29 Dec 2019 23:18:50 +0800 Subject: [PATCH 04/10] Remove class StageHint and usage --- .../UI/Components/ColumnHitObjectArea.cs | 9 +++++---- osu.Game.Rulesets.Mania/UI/Components/StageHint.cs | 14 -------------- 2 files changed, 5 insertions(+), 18 deletions(-) delete mode 100644 osu.Game.Rulesets.Mania/UI/Components/StageHint.cs diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs index 6bfb2b89aa..494da6c61b 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs @@ -22,11 +22,11 @@ namespace osu.Game.Rulesets.Mania.UI.Components private readonly IBindable direction = new Bindable(); - private readonly StageHint stageHint; + private readonly Drawable stageHint; public ColumnHitObjectArea(HitObjectContainer hitObjectContainer) { - InternalChildren = new Drawable[] + InternalChildren = new[] { stageHint = new DefaultStageHint { @@ -60,11 +60,12 @@ namespace osu.Game.Rulesets.Mania.UI.Components accentColour = value; - stageHint.AccentColour = accentColour; + if (stageHint is IHasAccentColour colouredHitTarget) + colouredHitTarget.AccentColour = accentColour; } } - private class DefaultStageHint : StageHint + private class DefaultStageHint : CompositeDrawable, IHasAccentColour { private readonly IBindable direction = new Bindable(); diff --git a/osu.Game.Rulesets.Mania/UI/Components/StageHint.cs b/osu.Game.Rulesets.Mania/UI/Components/StageHint.cs deleted file mode 100644 index 813a6928c9..0000000000 --- a/osu.Game.Rulesets.Mania/UI/Components/StageHint.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics.Containers; -using osu.Game.Graphics; -using osuTK.Graphics; - -namespace osu.Game.Rulesets.Mania.UI.Components -{ - public abstract class StageHint : CompositeDrawable, IHasAccentColour - { - public virtual Color4 AccentColour { get; set; } - } -} From 51000765ddca9c9f4b4a60605e10bd554e74c111 Mon Sep 17 00:00:00 2001 From: mcendu Date: Sun, 29 Dec 2019 23:29:00 +0800 Subject: [PATCH 05/10] remove override --- osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs index 494da6c61b..c78023a58b 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs @@ -114,7 +114,7 @@ namespace osu.Game.Rulesets.Mania.UI.Components private Color4 accentColour; - public override Color4 AccentColour + public Color4 AccentColour { get => accentColour; set From 20c5748342efacb4d36c6d971d9e9bcdf689d650 Mon Sep 17 00:00:00 2001 From: mcendu Date: Sun, 29 Dec 2019 23:37:28 +0800 Subject: [PATCH 06/10] Use hitTarget in place of stageHint --- .../UI/Components/ColumnHitObjectArea.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs index c78023a58b..ee2cec1bbd 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs @@ -22,13 +22,13 @@ namespace osu.Game.Rulesets.Mania.UI.Components private readonly IBindable direction = new Bindable(); - private readonly Drawable stageHint; + private readonly Drawable hitTarget; public ColumnHitObjectArea(HitObjectContainer hitObjectContainer) { InternalChildren = new[] { - stageHint = new DefaultStageHint + hitTarget = new DefaultHitTarget { RelativeSizeAxes = Axes.X, }, @@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Mania.UI.Components { Anchor anchor = dir.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; - stageHint.Anchor = stageHint.Origin = anchor; + hitTarget.Anchor = hitTarget.Origin = anchor; }, true); } @@ -60,19 +60,19 @@ namespace osu.Game.Rulesets.Mania.UI.Components accentColour = value; - if (stageHint is IHasAccentColour colouredHitTarget) + if (hitTarget is IHasAccentColour colouredHitTarget) colouredHitTarget.AccentColour = accentColour; } } - private class DefaultStageHint : CompositeDrawable, IHasAccentColour + private class DefaultHitTarget : CompositeDrawable, IHasAccentColour { private readonly IBindable direction = new Bindable(); private readonly Container hitTargetLine; private readonly Drawable hitTargetBar; - public DefaultStageHint() + public DefaultHitTarget() { InternalChildren = new[] { From 39d77386a809c4900600e97db86fe8558e18b52a Mon Sep 17 00:00:00 2001 From: Joehu Date: Sun, 29 Dec 2019 10:49:28 -0800 Subject: [PATCH 07/10] Fix context menus not showing on social panels --- .../SearchableList/SearchableListOverlay.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index 37478d902b..5975e94ffc 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Cursor; namespace osu.Game.Overlays.SearchableList { @@ -61,21 +62,20 @@ namespace osu.Game.Overlays.SearchableList scrollContainer = new Container { RelativeSizeAxes = Axes.Both, - Children = new[] + Child = new OsuContextMenuContainer { - new OsuScrollContainer + RelativeSizeAxes = Axes.Both, + Masking = true, + Child = new OsuScrollContainer { RelativeSizeAxes = Axes.Both, ScrollbarVisible = false, - Children = new[] + Child = ScrollFlow = new FillFlowContainer { - ScrollFlow = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Horizontal = WIDTH_PADDING, Bottom = 50 }, - Direction = FillDirection.Vertical, - }, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Horizontal = WIDTH_PADDING, Bottom = 50 }, + Direction = FillDirection.Vertical, }, }, }, From bcf7156882aeb0dd86fbd67a1feba7166e76d218 Mon Sep 17 00:00:00 2001 From: Joehu Date: Sun, 29 Dec 2019 11:19:46 -0800 Subject: [PATCH 08/10] Add context menu on direct panels --- osu.Game/Overlays/Direct/DirectPanel.cs | 27 +++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index c1c5113c5e..0ec0466580 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; @@ -9,21 +10,25 @@ using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using osuTK; using osuTK.Graphics; namespace osu.Game.Overlays.Direct { - public abstract class DirectPanel : Container + public abstract class DirectPanel : OsuClickableContainer, IHasContextMenu { public readonly BeatmapSetInfo SetInfo; @@ -44,6 +49,8 @@ namespace osu.Game.Overlays.Direct protected override Container Content => content; + protected Action ViewBeatmap; + protected DirectPanel(BeatmapSetInfo setInfo) { Debug.Assert(setInfo.OnlineBeatmapSetID != null); @@ -88,6 +95,12 @@ namespace osu.Game.Overlays.Direct }, } }); + + Action = ViewBeatmap = () => + { + Debug.Assert(SetInfo.OnlineBeatmapSetID != null); + beatmapSetOverlay?.FetchAndShowBeatmapSet(SetInfo.OnlineBeatmapSetID.Value); + }; } protected override void Update() @@ -120,13 +133,6 @@ namespace osu.Game.Overlays.Direct base.OnHoverLost(e); } - protected override bool OnClick(ClickEvent e) - { - Debug.Assert(SetInfo.OnlineBeatmapSetID != null); - beatmapSetOverlay?.FetchAndShowBeatmapSet(SetInfo.OnlineBeatmapSetID.Value); - return true; - } - protected override void LoadComplete() { base.LoadComplete(); @@ -203,5 +209,10 @@ namespace osu.Game.Overlays.Direct Value = value; } } + + public MenuItem[] ContextMenuItems => new MenuItem[] + { + new OsuMenuItem("View Beatmap", MenuItemType.Highlighted, ViewBeatmap), + }; } } From 0eccfc79cc84403609b080665bf70465992a3eae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Dec 2019 11:51:33 +0900 Subject: [PATCH 09/10] Remove unused field --- osu.Game/Overlays/Direct/DirectPanel.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 0ec0466580..4ad8e95512 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -37,8 +37,6 @@ namespace osu.Game.Overlays.Direct private Container content; - private BeatmapSetOverlay beatmapSetOverlay; - public PreviewTrack Preview => PlayButton.Preview; public Bindable PreviewPlaying => PlayButton?.Playing; @@ -77,8 +75,6 @@ namespace osu.Game.Overlays.Direct [BackgroundDependencyLoader(permitNulls: true)] private void load(BeatmapManager beatmaps, OsuColour colours, BeatmapSetOverlay beatmapSetOverlay) { - this.beatmapSetOverlay = beatmapSetOverlay; - AddInternal(content = new Container { RelativeSizeAxes = Axes.Both, From 8ae4cfaa5205111b5e2afe06aba07fe66e9c5f8c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 30 Dec 2019 07:33:49 +0000 Subject: [PATCH 10/10] Bump ppy.osu.Game.Resources from 2019.1227.0 to 2019.1230.0 Bumps [ppy.osu.Game.Resources](https://github.com/ppy/osu-resources) from 2019.1227.0 to 2019.1230.0. - [Release notes](https://github.com/ppy/osu-resources/releases) - [Commits](https://github.com/ppy/osu-resources/compare/2019.1227.0...2019.1230.0) Signed-off-by: dependabot-preview[bot] --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 6ff9416e47..0b41d5cda4 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -53,7 +53,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 806aadde84..565608b40f 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -22,7 +22,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 230ff01cce..60355b8592 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -73,7 +73,7 @@ - +