mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Display difficulty and sample control points associated with hitobjects
This commit is contained in:
@ -3,29 +3,20 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
{
|
||||
public class SamplePointPiece : CompositeDrawable
|
||||
public class SamplePointPiece : HitObjectPointPiece
|
||||
{
|
||||
private readonly SampleControlPoint samplePoint;
|
||||
|
||||
private readonly Bindable<string> bank;
|
||||
private readonly BindableNumber<int> volume;
|
||||
|
||||
private OsuSpriteText text;
|
||||
private Container volumeBox;
|
||||
|
||||
private const int max_volume_height = 22;
|
||||
|
||||
public SamplePointPiece(SampleControlPoint samplePoint)
|
||||
: base(samplePoint)
|
||||
{
|
||||
this.samplePoint = samplePoint;
|
||||
volume = samplePoint.SampleVolumeBindable.GetBoundCopy();
|
||||
@ -35,56 +26,13 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Margin = new MarginPadding { Vertical = 5 };
|
||||
volume.BindValueChanged(volume => updateText());
|
||||
bank.BindValueChanged(bank => updateText(), true);
|
||||
}
|
||||
|
||||
Origin = Anchor.BottomCentre;
|
||||
Anchor = Anchor.BottomCentre;
|
||||
|
||||
AutoSizeAxes = Axes.X;
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
|
||||
Color4 colour = samplePoint.GetRepresentingColour(colours);
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
volumeBox = new Circle
|
||||
{
|
||||
CornerRadius = 5,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Y = -20,
|
||||
Width = 10,
|
||||
Colour = colour,
|
||||
},
|
||||
new Container
|
||||
{
|
||||
AutoSizeAxes = Axes.X,
|
||||
Height = 16,
|
||||
Masking = true,
|
||||
CornerRadius = 8,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Colour = colour,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
text = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Padding = new MarginPadding(5),
|
||||
Font = OsuFont.Default.With(size: 12, weight: FontWeight.SemiBold),
|
||||
Colour = colours.B5,
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
volume.BindValueChanged(volume => volumeBox.Height = max_volume_height * volume.NewValue / 100f, true);
|
||||
bank.BindValueChanged(bank => text.Text = bank.NewValue, true);
|
||||
private void updateText()
|
||||
{
|
||||
Label.Text = $"{bank.Value} {volume.Value}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user