From dfda5e1b66b6274f565be99532fa1b1c7162f758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 5 Nov 2024 15:23:09 +0100 Subject: [PATCH 01/12] Improve visual appearance of mania selection blueprints --- .../Components/EditHoldNoteEndPiece.cs | 13 +++++++-- .../Blueprints/Components/EditNotePiece.cs | 29 ++++++++++++++++--- .../Blueprints/HoldNoteSelectionBlueprint.cs | 5 ++++ .../Edit/Blueprints/NoteSelectionBlueprint.cs | 11 ++++++- 4 files changed, 51 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditHoldNoteEndPiece.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditHoldNoteEndPiece.cs index 0aa72c28b8..285226e8b4 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditHoldNoteEndPiece.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditHoldNoteEndPiece.cs @@ -4,6 +4,7 @@ using System; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; using osu.Game.Graphics; @@ -29,7 +30,11 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components CornerRadius = 5; Masking = true; - InternalChild = new DefaultNotePiece(); + InternalChild = new EditNotePiece + { + RelativeSizeAxes = Axes.Both, + Height = 1, + }; } protected override void LoadComplete() @@ -60,19 +65,23 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components { base.OnDrag(e); Dragging?.Invoke(e.ScreenSpaceMousePosition); + updateState(); } protected override void OnDragEnd(DragEndEvent e) { base.OnDragEnd(e); DragEnded?.Invoke(); + updateState(); } private void updateState() { + InternalChild.Colour = Colour4.White; + var colour = colours.Yellow; - if (IsHovered) + if (IsHovered || IsDragged) colour = colour.Lighten(1); Colour = colour; diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs index 48dde29a9f..63f67d6150 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs @@ -1,10 +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 System; using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Rulesets.Mania.Skinning.Default; +using osuTK.Graphics; namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components { @@ -12,12 +16,17 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components { public EditNotePiece() { + Masking = true; + BorderThickness = 9; // organoleptically chosen to look good enough for all default skins + BorderColour = Color4.White; Height = DefaultNotePiece.NOTE_HEIGHT; - CornerRadius = 5; - Masking = true; - - InternalChild = new DefaultNotePiece(); + InternalChild = new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true, + }; } [BackgroundDependencyLoader] @@ -25,5 +34,17 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components { Colour = colours.Yellow; } + + protected override void Update() + { + base.Update(); + + // from anecdotal experience, there are generally two types of user skins: + // one type uses rectangles for notes, and the other uses circles / squarish sprites (various stepmania-likes). + // this is a crude heuristic that attempts to choose the best of both worlds based on aspect ratio alone. + float aspectRatio = DrawWidth / DrawHeight; + bool isSquarish = aspectRatio > 4f / 5 && aspectRatio < 5f / 4; + CornerRadius = isSquarish ? Math.Min(DrawWidth, DrawHeight) / 2 : 5; + } } } diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs index b8e6aa26a0..2f2ad4bbba 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs @@ -10,6 +10,7 @@ using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Edit.Blueprints.Components; using osu.Game.Rulesets.Mania.Objects; +using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Screens.Edit; using osuTK; @@ -32,6 +33,8 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints private EditHoldNoteEndPiece head = null!; private EditHoldNoteEndPiece tail = null!; + protected new DrawableHoldNote DrawableObject => (DrawableHoldNote)base.DrawableObject; + public HoldNoteSelectionBlueprint(HoldNote hold) : base(hold) { @@ -99,7 +102,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints { base.Update(); + head.Height = DrawableObject.Head.DrawHeight; head.Y = HitObjectContainer.PositionAtTime(HitObject.Head.StartTime, HitObject.StartTime); + tail.Height = DrawableObject.Tail.DrawHeight; tail.Y = HitObjectContainer.PositionAtTime(HitObject.Tail.StartTime, HitObject.StartTime); Height = HitObjectContainer.LengthAtTime(HitObject.StartTime, HitObject.EndTime) + tail.DrawHeight; } diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs index 01c7bd502a..c2df09e92a 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs @@ -9,10 +9,19 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints { public partial class NoteSelectionBlueprint : ManiaSelectionBlueprint { + private readonly EditNotePiece notePiece; + public NoteSelectionBlueprint(Note note) : base(note) { - AddInternal(new EditNotePiece { RelativeSizeAxes = Axes.X }); + AddInternal(notePiece = new EditNotePiece { RelativeSizeAxes = Axes.X }); + } + + protected override void Update() + { + base.Update(); + + notePiece.Height = DrawableObject.DrawHeight; } } } From 3d4f5d4d105cc14cde1730818680625365686a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 5 Nov 2024 15:29:52 +0100 Subject: [PATCH 02/12] Fix test --- .../Editor/TestSceneManiaSelectionHandler.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaSelectionHandler.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaSelectionHandler.cs index a70b90789d..0f7d696c7f 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaSelectionHandler.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaSelectionHandler.cs @@ -5,6 +5,8 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Testing; using osu.Game.Beatmaps; +using osu.Game.Rulesets.Mania.Edit.Blueprints; +using osu.Game.Rulesets.Mania.Edit.Blueprints.Components; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.UI; using osu.Game.Screens.Edit.Compose.Components; @@ -106,7 +108,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor AddStep("select everything", () => EditorBeatmap.SelectedHitObjects.AddRange(EditorBeatmap.HitObjects)); AddStep("start drag", () => { - InputManager.MoveMouseTo(this.ChildrenOfType().First()); + InputManager.MoveMouseTo(this.ChildrenOfType().Single(blueprint => blueprint.IsSelected && blueprint.HitObject.StartTime == 0)); InputManager.PressButton(MouseButton.Left); }); AddStep("end drag", () => From fd179666057d23d28db13eacb9612cfba84431c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 7 Nov 2024 08:39:58 +0100 Subject: [PATCH 03/12] Remove unused using directive --- .../Editor/TestSceneManiaSelectionHandler.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaSelectionHandler.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaSelectionHandler.cs index 0f7d696c7f..a920b3470f 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaSelectionHandler.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaSelectionHandler.cs @@ -6,7 +6,6 @@ using NUnit.Framework; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Edit.Blueprints; -using osu.Game.Rulesets.Mania.Edit.Blueprints.Components; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.UI; using osu.Game.Screens.Edit.Compose.Components; From aede94a3f3edcac2c0495f05c1193c4b08578b0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 7 Nov 2024 08:41:29 +0100 Subject: [PATCH 04/12] Use box variant of selection always --- .../Edit/Blueprints/Components/EditNotePiece.cs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs index 63f67d6150..a2a5955a9d 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs @@ -1,7 +1,6 @@ // 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 osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -17,6 +16,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components public EditNotePiece() { Masking = true; + CornerRadius = 5; BorderThickness = 9; // organoleptically chosen to look good enough for all default skins BorderColour = Color4.White; Height = DefaultNotePiece.NOTE_HEIGHT; @@ -34,17 +34,5 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components { Colour = colours.Yellow; } - - protected override void Update() - { - base.Update(); - - // from anecdotal experience, there are generally two types of user skins: - // one type uses rectangles for notes, and the other uses circles / squarish sprites (various stepmania-likes). - // this is a crude heuristic that attempts to choose the best of both worlds based on aspect ratio alone. - float aspectRatio = DrawWidth / DrawHeight; - bool isSquarish = aspectRatio > 4f / 5 && aspectRatio < 5f / 4; - CornerRadius = isSquarish ? Math.Min(DrawWidth, DrawHeight) / 2 : 5; - } } } From 98ae45d763cbf8a2ad34d7be780eba906fff34b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 7 Nov 2024 09:18:57 +0100 Subject: [PATCH 05/12] Adjust appearance further in response to feedback --- .../Blueprints/Components/EditNotePiece.cs | 20 +++++++++++++++--- .../Blueprints/HoldNoteSelectionBlueprint.cs | 21 ++++++++++++++++++- .../Blueprints/ManiaSelectionBlueprint.cs | 10 ++------- .../Edit/Blueprints/NoteSelectionBlueprint.cs | 17 ++++++++++++++- 4 files changed, 55 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs index a2a5955a9d..c626e8011e 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs @@ -3,22 +3,28 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Rulesets.Mania.Skinning.Default; -using osuTK.Graphics; +using osu.Game.Rulesets.Mania.UI; +using osu.Game.Rulesets.UI.Scrolling; +using osuTK; namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components { public partial class EditNotePiece : CompositeDrawable { + [Resolved] + private Column? column { get; set; } + public EditNotePiece() { Masking = true; CornerRadius = 5; - BorderThickness = 9; // organoleptically chosen to look good enough for all default skins - BorderColour = Color4.White; + BorderThickness = 6; + BorderColour = ColourInfo.GradientVertical(Colour4.White.Opacity(0.5f), Colour4.White); Height = DefaultNotePiece.NOTE_HEIGHT; InternalChild = new Box @@ -34,5 +40,13 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components { Colour = colours.Yellow; } + + protected override void Update() + { + base.Update(); + + if (column != null) + Scale = new Vector2(1, column.ScrollingInfo.Direction.Value == ScrollingDirection.Down ? 1 : -1); + } } } diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs index 2f2ad4bbba..66b914d320 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; @@ -11,6 +12,7 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Edit.Blueprints.Components; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; +using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Screens.Edit; using osuTK; @@ -32,6 +34,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints private EditHoldNoteEndPiece head = null!; private EditHoldNoteEndPiece tail = null!; + private Container body = null!; protected new DrawableHoldNote DrawableObject => (DrawableHoldNote)base.DrawableObject; @@ -48,6 +51,8 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints head = new EditHoldNoteEndPiece { RelativeSizeAxes = Axes.X, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, DragStarted = () => changeHandler?.BeginChange(), Dragging = pos => { @@ -67,6 +72,8 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints tail = new EditHoldNoteEndPiece { RelativeSizeAxes = Axes.X, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, DragStarted = () => changeHandler?.BeginChange(), Dragging = pos => { @@ -82,10 +89,12 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints }, DragEnded = () => changeHandler?.EndChange(), }, - new Container + body = new Container { RelativeSizeAxes = Axes.Both, Masking = true, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, BorderThickness = 1, BorderColour = colours.Yellow, Child = new Box @@ -109,6 +118,16 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints Height = HitObjectContainer.LengthAtTime(HitObject.StartTime, HitObject.EndTime) + tail.DrawHeight; } + protected override void OnDirectionChanged(ValueChangedEvent direction) + { + Origin = direction.NewValue == ScrollingDirection.Down ? Anchor.BottomCentre : Anchor.TopCentre; + + foreach (var child in InternalChildren) + child.Anchor = Origin; + + head.Scale = tail.Scale = new Vector2(1, direction.NewValue == ScrollingDirection.Down ? 1 : -1); + } + public override Quad SelectionQuad => ScreenSpaceDrawQuad; public override Vector2 ScreenSpaceSelectionPoint => head.ScreenSpaceDrawQuad.Centre; diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs index c645ddd98d..4bb9d5f5c1 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs @@ -37,16 +37,10 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints protected override void LoadComplete() { base.LoadComplete(); - directionBindable.BindValueChanged(onDirectionChanged, true); + directionBindable.BindValueChanged(OnDirectionChanged, true); } - private void onDirectionChanged(ValueChangedEvent direction) - { - var anchor = direction.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; - Anchor = Origin = anchor; - foreach (var child in InternalChildren) - child.Anchor = child.Origin = anchor; - } + protected abstract void OnDirectionChanged(ValueChangedEvent direction); protected override void Update() { diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs index c2df09e92a..3476f91568 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs @@ -1,9 +1,12 @@ // 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.Bindables; using osu.Framework.Graphics; using osu.Game.Rulesets.Mania.Edit.Blueprints.Components; using osu.Game.Rulesets.Mania.Objects; +using osu.Game.Rulesets.UI.Scrolling; +using osuTK; namespace osu.Game.Rulesets.Mania.Edit.Blueprints { @@ -14,7 +17,14 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints public NoteSelectionBlueprint(Note note) : base(note) { - AddInternal(notePiece = new EditNotePiece { RelativeSizeAxes = Axes.X }); + Anchor = Anchor.BottomCentre; + Origin = Anchor.BottomCentre; + AddInternal(notePiece = new EditNotePiece + { + RelativeSizeAxes = Axes.X, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + }); } protected override void Update() @@ -23,5 +33,10 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints notePiece.Height = DrawableObject.DrawHeight; } + + protected override void OnDirectionChanged(ValueChangedEvent direction) + { + notePiece.Scale = new Vector2(1, direction.NewValue == ScrollingDirection.Down ? 1 : -1); + } } } From e058f98bad3978234a7bbaf98edc8d061a7c4d5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 7 Nov 2024 09:36:28 +0100 Subject: [PATCH 06/12] Remove unused field --- .../Edit/Blueprints/HoldNoteSelectionBlueprint.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs index 66b914d320..4e0b0cea6c 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs @@ -34,7 +34,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints private EditHoldNoteEndPiece head = null!; private EditHoldNoteEndPiece tail = null!; - private Container body = null!; protected new DrawableHoldNote DrawableObject => (DrawableHoldNote)base.DrawableObject; @@ -89,7 +88,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints }, DragEnded = () => changeHandler?.EndChange(), }, - body = new Container + new Container { RelativeSizeAxes = Axes.Both, Masking = true, From dba065302daa5bca92e8d26fe0ba8199bc67f874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 7 Nov 2024 13:41:41 +0100 Subject: [PATCH 07/12] Adjust appearance once more --- .../Blueprints/Components/EditNotePiece.cs | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs index c626e8011e..3f15515ba6 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs @@ -2,8 +2,8 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; @@ -11,6 +11,7 @@ using osu.Game.Rulesets.Mania.Skinning.Default; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.UI.Scrolling; using osuTK; +using osuTK.Graphics; namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components { @@ -23,15 +24,31 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components { Masking = true; CornerRadius = 5; - BorderThickness = 6; - BorderColour = ColourInfo.GradientVertical(Colour4.White.Opacity(0.5f), Colour4.White); Height = DefaultNotePiece.NOTE_HEIGHT; - InternalChild = new Box + InternalChildren = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true, + new Container + { + RelativeSizeAxes = Axes.Both, + Masking = true, + CornerRadius = 5, + BorderThickness = 5, + BorderColour = Color4.White.Opacity(0.7f), + Child = new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true, + }, + }, + new Box + { + RelativeSizeAxes = Axes.X, + Height = 10, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + }, }; } From 84587564021072da9ecd70259a859b6965ac5bfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 12 Nov 2024 14:26:13 +0100 Subject: [PATCH 08/12] Adjust appearance a third time --- .../Blueprints/Components/EditBodyPiece.cs | 33 +++++++++++++++---- .../Components/EditHoldNoteEndPiece.cs | 3 -- .../Blueprints/Components/EditNotePiece.cs | 22 +++++-------- .../Blueprints/HoldNoteSelectionBlueprint.cs | 21 ++++-------- 4 files changed, 42 insertions(+), 37 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditBodyPiece.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditBodyPiece.cs index 6a12ec5088..652baccaa6 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditBodyPiece.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditBodyPiece.cs @@ -3,21 +3,42 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; using osu.Game.Rulesets.Mania.Skinning.Default; +using osuTK.Graphics; namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components { - public partial class EditBodyPiece : DefaultBodyPiece + public partial class EditBodyPiece : CompositeDrawable { + private readonly Container border; + + public EditBodyPiece() + { + InternalChildren = new Drawable[] + { + border = new Container + { + RelativeSizeAxes = Axes.Both, + Masking = true, + BorderThickness = 3, + Child = new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true, + }, + }, + }; + } + [BackgroundDependencyLoader] private void load(OsuColour colours) { - AccentColour.Value = colours.Yellow; - - Background.Alpha = 0.5f; + border.BorderColour = colours.YellowDarker; } - - protected override Drawable CreateForeground() => base.CreateForeground().With(d => d.Alpha = 0); } } diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditHoldNoteEndPiece.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditHoldNoteEndPiece.cs index 285226e8b4..d4b61b4661 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditHoldNoteEndPiece.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditHoldNoteEndPiece.cs @@ -27,9 +27,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components { Height = DefaultNotePiece.NOTE_HEIGHT; - CornerRadius = 5; - Masking = true; - InternalChild = new EditNotePiece { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs index 3f15515ba6..1f9f26b5e2 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs @@ -2,12 +2,10 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; -using osu.Game.Rulesets.Mania.Skinning.Default; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.UI.Scrolling; using osuTK; @@ -17,24 +15,21 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components { public partial class EditNotePiece : CompositeDrawable { + private readonly Container border; + private readonly Box box; + [Resolved] private Column? column { get; set; } public EditNotePiece() { - Masking = true; - CornerRadius = 5; - Height = DefaultNotePiece.NOTE_HEIGHT; - InternalChildren = new Drawable[] { - new Container + border = new Container { RelativeSizeAxes = Axes.Both, Masking = true, - CornerRadius = 5, - BorderThickness = 5, - BorderColour = Color4.White.Opacity(0.7f), + BorderThickness = 3, Child = new Box { RelativeSizeAxes = Axes.Both, @@ -42,10 +37,10 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components AlwaysPresent = true, }, }, - new Box + box = new Box { RelativeSizeAxes = Axes.X, - Height = 10, + Height = 3, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, }, @@ -55,7 +50,8 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components [BackgroundDependencyLoader] private void load(OsuColour colours) { - Colour = colours.Yellow; + border.BorderColour = colours.YellowDark; + box.Colour = colours.YellowLight; } protected override void Update() diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs index 4e0b0cea6c..8c8d58654e 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs @@ -47,6 +47,12 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints { InternalChildren = new Drawable[] { + new EditBodyPiece + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + }, head = new EditHoldNoteEndPiece { RelativeSizeAxes = Axes.X, @@ -88,21 +94,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints }, DragEnded = () => changeHandler?.EndChange(), }, - new Container - { - RelativeSizeAxes = Axes.Both, - Masking = true, - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - BorderThickness = 1, - BorderColour = colours.Yellow, - Child = new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true, - } - } }; } From 4c147327dfc2555cb21d33e68a170d68213a69b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 15 Nov 2024 10:19:34 +0100 Subject: [PATCH 09/12] Fix code quality --- .../Edit/Blueprints/Components/EditBodyPiece.cs | 3 --- .../Edit/Blueprints/Components/EditNotePiece.cs | 1 - .../Edit/Blueprints/HoldNoteSelectionBlueprint.cs | 2 -- 3 files changed, 6 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditBodyPiece.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditBodyPiece.cs index 652baccaa6..5cfcf00b33 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditBodyPiece.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditBodyPiece.cs @@ -6,9 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; -using osu.Game.Graphics.Backgrounds; -using osu.Game.Rulesets.Mania.Skinning.Default; -using osuTK.Graphics; namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components { diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs index 1f9f26b5e2..f68004db28 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs @@ -9,7 +9,6 @@ using osu.Game.Graphics; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.UI.Scrolling; using osuTK; -using osuTK.Graphics; namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components { diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs index 8c8d58654e..c0d2be229f 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs @@ -4,9 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Edit.Blueprints.Components; From 0c4c9bd2376df86af8168658f44f4412810f5cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 15 Nov 2024 10:27:07 +0100 Subject: [PATCH 10/12] Fix incorrect selection hold note blueprint display when upscroll active --- .../Edit/Blueprints/HoldNoteSelectionBlueprint.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs index c0d2be229f..aa21d53f8b 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs @@ -30,6 +30,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints [Resolved] private IPositionSnapProvider? positionSnapProvider { get; set; } + private EditBodyPiece body = null!; private EditHoldNoteEndPiece head = null!; private EditHoldNoteEndPiece tail = null!; @@ -45,7 +46,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints { InternalChildren = new Drawable[] { - new EditBodyPiece + body = new EditBodyPiece { RelativeSizeAxes = Axes.Both, Anchor = Anchor.BottomCentre, @@ -113,7 +114,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints foreach (var child in InternalChildren) child.Anchor = Origin; - head.Scale = tail.Scale = new Vector2(1, direction.NewValue == ScrollingDirection.Down ? 1 : -1); + head.Scale = tail.Scale = body.Scale = new Vector2(1, direction.NewValue == ScrollingDirection.Down ? 1 : -1); } public override Quad SelectionQuad => ScreenSpaceDrawQuad; From e5480f8346bc9170b79618db5cfb809f6de808bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 15 Nov 2024 10:37:56 +0100 Subject: [PATCH 11/12] Adjust appearance of placement blueprints to be closer to previous --- .../Blueprints/HoldNotePlacementBlueprint.cs | 27 +++++++++++++++---- .../Edit/Blueprints/NotePlacementBlueprint.cs | 21 ++++++++++++--- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNotePlacementBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNotePlacementBlueprint.cs index 991b7f476c..13cfc5f691 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNotePlacementBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNotePlacementBlueprint.cs @@ -4,8 +4,10 @@ using System; using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Framework.Utils; +using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Edit.Blueprints.Components; using osu.Game.Rulesets.Mania.Objects; @@ -17,9 +19,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints { public partial class HoldNotePlacementBlueprint : ManiaPlacementBlueprint { - private readonly EditBodyPiece bodyPiece; - private readonly EditNotePiece headPiece; - private readonly EditNotePiece tailPiece; + private EditBodyPiece bodyPiece = null!; + private Circle headPiece = null!; + private Circle tailPiece = null!; [Resolved] private IScrollingInfo scrollingInfo { get; set; } = null!; @@ -28,14 +30,29 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints public HoldNotePlacementBlueprint() : base(new HoldNote()) + { + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) { RelativeSizeAxes = Axes.Both; InternalChildren = new Drawable[] { bodyPiece = new EditBodyPiece { Origin = Anchor.TopCentre }, - headPiece = new EditNotePiece { Origin = Anchor.Centre }, - tailPiece = new EditNotePiece { Origin = Anchor.Centre } + headPiece = new Circle + { + Origin = Anchor.Centre, + Colour = colours.Yellow, + Height = 10 + }, + tailPiece = new Circle + { + Origin = Anchor.Centre, + Colour = colours.Yellow, + Height = 10 + }, }; } diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/NotePlacementBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/NotePlacementBlueprint.cs index b3ec3ef3e4..422215db57 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/NotePlacementBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/NotePlacementBlueprint.cs @@ -1,10 +1,12 @@ // 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.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; +using osu.Game.Graphics; using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Mania.Edit.Blueprints.Components; using osu.Game.Rulesets.Mania.Objects; using osuTK.Input; @@ -12,14 +14,25 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints { public partial class NotePlacementBlueprint : ManiaPlacementBlueprint { - private readonly EditNotePiece piece; + private Circle piece = null!; public NotePlacementBlueprint() : base(new Note()) { - RelativeSizeAxes = Axes.Both; + } - InternalChild = piece = new EditNotePiece { Origin = Anchor.Centre }; + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + RelativeSizeAxes = Axes.Both; + Masking = true; + + InternalChild = piece = new Circle + { + Origin = Anchor.Centre, + Colour = colours.Yellow, + Height = 10 + }; } public override void UpdateTimeAndPosition(SnapResult result) From 4ae13cfd6052f71de28bbffe70788201b11549d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 15 Nov 2024 10:58:06 +0100 Subject: [PATCH 12/12] Remove unused resolved property --- .../Edit/Blueprints/HoldNoteSelectionBlueprint.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs index aa21d53f8b..915706c044 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs @@ -5,7 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; -using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Edit.Blueprints.Components; using osu.Game.Rulesets.Mania.Objects; @@ -18,9 +17,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints { public partial class HoldNoteSelectionBlueprint : ManiaSelectionBlueprint { - [Resolved] - private OsuColour colours { get; set; } = null!; - [Resolved] private IEditorChangeHandler? changeHandler { get; set; }