2024-08-14 04:05:01 +08:00
|
|
|
// 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.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2024-08-14 04:13:17 +08:00
|
|
|
using osu.Game.Rulesets.Edit;
|
2024-08-14 04:05:01 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.Edit.Components.TernaryButtons
|
|
|
|
{
|
2024-08-19 17:07:34 +08:00
|
|
|
public partial class SampleBankTernaryButton : CompositeDrawable
|
2024-08-14 04:05:01 +08:00
|
|
|
{
|
2024-08-19 17:07:34 +08:00
|
|
|
public readonly TernaryButton NormalButton;
|
|
|
|
public readonly TernaryButton AdditionsButton;
|
2024-08-14 04:05:01 +08:00
|
|
|
|
2024-08-19 17:07:34 +08:00
|
|
|
public SampleBankTernaryButton(TernaryButton normalButton, TernaryButton additionsButton)
|
2024-08-14 04:05:01 +08:00
|
|
|
{
|
2024-08-19 17:07:34 +08:00
|
|
|
NormalButton = normalButton;
|
|
|
|
AdditionsButton = additionsButton;
|
2024-08-14 04:05:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
Masking = true;
|
|
|
|
CornerRadius = 5;
|
|
|
|
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
Width = 0.5f,
|
|
|
|
Padding = new MarginPadding { Right = 1 },
|
2024-08-19 17:07:34 +08:00
|
|
|
Child = new InlineDrawableTernaryButton(NormalButton),
|
2024-08-14 04:05:01 +08:00
|
|
|
},
|
|
|
|
new Container
|
|
|
|
{
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
Width = 0.5f,
|
|
|
|
Padding = new MarginPadding { Left = 1 },
|
2024-08-19 17:07:34 +08:00
|
|
|
Child = new InlineDrawableTernaryButton(AdditionsButton),
|
2024-08-14 04:05:01 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2024-08-19 17:07:34 +08:00
|
|
|
private partial class InlineDrawableTernaryButton : DrawableTernaryButton
|
2024-08-14 04:05:01 +08:00
|
|
|
{
|
2024-08-19 17:07:34 +08:00
|
|
|
public InlineDrawableTernaryButton(TernaryButton button)
|
|
|
|
: base(button)
|
|
|
|
{
|
|
|
|
}
|
2024-08-14 04:05:01 +08:00
|
|
|
|
2024-08-19 17:07:34 +08:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
|
|
|
Content.Masking = false;
|
|
|
|
Content.CornerRadius = 0;
|
|
|
|
Icon.X = 4.5f;
|
|
|
|
}
|
2024-08-14 04:05:01 +08:00
|
|
|
|
2024-08-19 17:07:34 +08:00
|
|
|
protected override SpriteText CreateText() => new ExpandableSpriteText
|
|
|
|
{
|
|
|
|
Depth = -1,
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
X = 31f
|
|
|
|
};
|
|
|
|
}
|
2024-08-14 04:05:01 +08:00
|
|
|
}
|
|
|
|
}
|