1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-10 01:12:56 +08:00

Adjust appearance further in response to feedback

This commit is contained in:
Bartłomiej Dach 2024-11-07 09:18:57 +01:00
parent aede94a3f3
commit 98ae45d763
No known key found for this signature in database
4 changed files with 55 additions and 13 deletions

View File

@ -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);
}
}
}

View File

@ -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<ScrollingDirection> 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;

View File

@ -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<ScrollingDirection> 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<ScrollingDirection> direction);
protected override void Update()
{

View File

@ -1,9 +1,12 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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<ScrollingDirection> direction)
{
notePiece.Scale = new Vector2(1, direction.NewValue == ScrollingDirection.Down ? 1 : -1);
}
}
}