From 6dfb9630d62c19c5330a4090fcb3a94115bce64d Mon Sep 17 00:00:00 2001 From: mk56-spn Date: Thu, 26 Jan 2023 13:53:17 +0100 Subject: [PATCH] Implement ShearedNub.cs as well as tweak the syntax in NormalNub.cs --- osu.Game/Graphics/UserInterface/NormalNub.cs | 6 ++--- osu.Game/Graphics/UserInterface/Nub.cs | 4 +++ osu.Game/Graphics/UserInterface/ShearedNub.cs | 27 +++++++++++++++++++ 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 osu.Game/Graphics/UserInterface/ShearedNub.cs diff --git a/osu.Game/Graphics/UserInterface/NormalNub.cs b/osu.Game/Graphics/UserInterface/NormalNub.cs index 1fe87da7a8..e6939d060b 100644 --- a/osu.Game/Graphics/UserInterface/NormalNub.cs +++ b/osu.Game/Graphics/UserInterface/NormalNub.cs @@ -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, }; - } } } diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index 7830381d10..6f875e8594 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -22,6 +22,10 @@ namespace osu.Game.Graphics.UserInterface private readonly Box fill; private readonly Container main; + /// + /// Implements the shape for the nub, allowing for any type of container to be used. + /// + /// protected abstract Container CreateNubContainer(); protected Nub() diff --git a/osu.Game/Graphics/UserInterface/ShearedNub.cs b/osu.Game/Graphics/UserInterface/ShearedNub.cs new file mode 100644 index 0000000000..6c3fbaf7e6 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/ShearedNub.cs @@ -0,0 +1,27 @@ +// 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; +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, + }; + } +}