mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 09:07:25 +08:00
Add new settings to the big black box
This commit is contained in:
parent
458136dfe7
commit
e4211104b0
@ -2,9 +2,11 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
@ -19,6 +21,19 @@ namespace osu.Game.Skinning.Components
|
||||
{
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
[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;
|
||||
|
||||
public BigBlackBox()
|
||||
{
|
||||
Size = new Vector2(150);
|
||||
@ -29,13 +44,12 @@ namespace osu.Game.Skinning.Components
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
box = new Box
|
||||
{
|
||||
Colour = Color4.Black,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
|
||||
new OsuSpriteText
|
||||
text = new OsuSpriteText
|
||||
{
|
||||
Text = "Big Black Box",
|
||||
Anchor = Anchor.Centre,
|
||||
@ -43,5 +57,19 @@ namespace osu.Game.Skinning.Components
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user