2022-03-08 18:55:25 +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 JetBrains.Annotations;
|
2022-03-08 19:33:15 +08:00
|
|
|
using osu.Framework.Bindables;
|
2022-03-08 18:55:25 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2022-03-08 19:33:15 +08:00
|
|
|
using osu.Game.Configuration;
|
2022-03-08 18:55:25 +08:00
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
using osuTK;
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
|
|
namespace osu.Game.Skinning.Components
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Intended to be a test bed for skinning. May be removed at some point in the future.
|
|
|
|
/// </summary>
|
|
|
|
[UsedImplicitly]
|
|
|
|
public class BigBlackBox : CompositeDrawable, ISkinnableDrawable
|
|
|
|
{
|
|
|
|
public bool UsesFixedAnchor { get; set; }
|
|
|
|
|
2022-03-08 19:33:15 +08:00
|
|
|
[SettingSource("Spin", "Should the text spin")]
|
|
|
|
public Bindable<bool> TextSpin { get; } = new BindableBool();
|
|
|
|
|
|
|
|
[SettingSource("Alpha", "The alpha value of this box")]
|
|
|
|
public BindableNumber<float> BoxAlpha { get; } = new BindableNumber<float>(1)
|
|
|
|
{
|
|
|
|
MinValue = 0,
|
|
|
|
MaxValue = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
private readonly Box box;
|
|
|
|
private readonly OsuSpriteText text;
|
|
|
|
|
2022-03-08 18:55:25 +08:00
|
|
|
public BigBlackBox()
|
|
|
|
{
|
|
|
|
Size = new Vector2(150);
|
|
|
|
|
|
|
|
Masking = true;
|
|
|
|
CornerRadius = 20;
|
|
|
|
CornerExponent = 5;
|
|
|
|
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
2022-03-08 19:33:15 +08:00
|
|
|
box = new Box
|
2022-03-08 18:55:25 +08:00
|
|
|
{
|
|
|
|
Colour = Color4.Black,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
},
|
2022-03-08 19:33:15 +08:00
|
|
|
text = new OsuSpriteText
|
2022-03-08 18:55:25 +08:00
|
|
|
{
|
|
|
|
Text = "Big Black Box",
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2022-03-08 19:33:15 +08:00
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
BoxAlpha.BindValueChanged(alpha => box.Alpha = alpha.NewValue, true);
|
|
|
|
TextSpin.BindValueChanged(spin =>
|
|
|
|
{
|
|
|
|
if (spin.NewValue)
|
|
|
|
text.Spin(1000, RotationDirection.Clockwise);
|
|
|
|
else
|
|
|
|
text.ClearTransforms();
|
|
|
|
}, true);
|
|
|
|
}
|
2022-03-08 18:55:25 +08:00
|
|
|
}
|
|
|
|
}
|