mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 06:52:56 +08:00
Add new display for difficulty row attribute
This commit is contained in:
parent
d3cebfb6fb
commit
3aad0a8b9c
@ -138,7 +138,7 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
return new TimingRowAttribute(timing);
|
||||
|
||||
case DifficultyControlPoint difficulty:
|
||||
return new EmptyRowAttribute("difficulty", () => $"{difficulty.SpeedMultiplier:n2}x", colour);
|
||||
return new DifficultyRowAttribute(difficulty);
|
||||
|
||||
case EffectControlPoint effect:
|
||||
return new EmptyRowAttribute("effect", () => string.Join(" ",
|
||||
|
@ -15,14 +15,16 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
{
|
||||
public class RowAttribute : CompositeDrawable
|
||||
{
|
||||
private readonly ControlPoint point;
|
||||
protected readonly ControlPoint Point;
|
||||
|
||||
private readonly string label;
|
||||
|
||||
protected FillFlowContainer Content { get; private set; }
|
||||
|
||||
public RowAttribute(ControlPoint point, string label)
|
||||
{
|
||||
this.point = point;
|
||||
Point = point;
|
||||
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
@ -65,7 +67,7 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Colour = point.GetRepresentingColour(colours),
|
||||
Colour = Point.GetRepresentingColour(colours),
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new OsuSpriteText
|
||||
|
@ -0,0 +1,41 @@
|
||||
// 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.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Overlays;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Timing.RowAttributes
|
||||
{
|
||||
public class AttributeProgressBar : ProgressBar
|
||||
{
|
||||
private readonly ControlPoint controlPoint;
|
||||
|
||||
public AttributeProgressBar(ControlPoint controlPoint)
|
||||
: base(false)
|
||||
{
|
||||
this.controlPoint = controlPoint;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, OverlayColourProvider overlayColours)
|
||||
{
|
||||
Anchor = Anchor.CentreLeft;
|
||||
Origin = Anchor.CentreLeft;
|
||||
|
||||
Masking = true;
|
||||
|
||||
RelativeSizeAxes = Axes.None;
|
||||
|
||||
Size = new Vector2(80, 8);
|
||||
CornerRadius = Height / 2;
|
||||
|
||||
BackgroundColour = overlayColours.Background6;
|
||||
Colour = controlPoint.GetRepresentingColour(colours);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
// 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.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Timing.RowAttributes
|
||||
{
|
||||
public class DifficultyRowAttribute : RowAttribute
|
||||
{
|
||||
private readonly BindableNumber<double> speedMultiplier;
|
||||
|
||||
private OsuSpriteText text;
|
||||
|
||||
public DifficultyRowAttribute(DifficultyControlPoint difficulty)
|
||||
: base(difficulty, "difficulty")
|
||||
{
|
||||
speedMultiplier = difficulty.SpeedMultiplierBindable.GetBoundCopy();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Content.AddRange(new Drawable[]
|
||||
{
|
||||
text = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Width = 40,
|
||||
Font = OsuFont.GetFont(size: EditorTable.TEXT_SIZE, weight: FontWeight.Regular),
|
||||
},
|
||||
new AttributeProgressBar(Point)
|
||||
{
|
||||
Current = speedMultiplier,
|
||||
}
|
||||
});
|
||||
|
||||
speedMultiplier.BindValueChanged(_ => updateText(), true);
|
||||
}
|
||||
|
||||
private void updateText() => text.Text = $"{speedMultiplier.Value:n2}x";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user