1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:23:00 +08:00

Implement ShearedNub.cs as well as tweak the syntax in NormalNub.cs

This commit is contained in:
mk56-spn 2023-01-26 13:53:17 +01:00
parent b8ae689b31
commit 6dfb9630d6
3 changed files with 33 additions and 4 deletions

View File

@ -18,9 +18,8 @@ namespace osu.Game.Graphics.UserInterface
Size = new Vector2(EXPANDED_SIZE, HEIGHT);
}
protected override Container CreateNubContainer()
{
return new CircularContainer
protected override Container CreateNubContainer() =>
new CircularContainer
{
BorderColour = Colour4.White,
BorderThickness = BORDER_WIDTH,
@ -29,6 +28,5 @@ namespace osu.Game.Graphics.UserInterface
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
};
}
}
}

View File

@ -22,6 +22,10 @@ namespace osu.Game.Graphics.UserInterface
private readonly Box fill;
private readonly Container main;
/// <summary>
/// Implements the shape for the nub, allowing for any type of container to be used.
/// </summary>
/// <returns></returns>
protected abstract Container CreateNubContainer();
protected Nub()

View File

@ -0,0 +1,27 @@
// 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.Graphics;
using osu.Framework.Graphics.Containers;
using osuTK;
namespace osu.Game.Graphics.UserInterface
{
public partial class ShearedNub : Nub
{
public static readonly Vector2 SHEAR = new Vector2(0.15f, 0);
protected override Container CreateNubContainer() =>
new Container
{
Shear = SHEAR,
BorderColour = Colour4.White,
BorderThickness = BORDER_WIDTH,
Masking = true,
CornerRadius = 5,
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
};
}
}