1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 21:07:33 +08:00

Add new display for effect row attribute

This commit is contained in:
Dean Herbert 2021-04-19 16:28:18 +09:00
parent ec249a0edb
commit f8b20ca8aa
2 changed files with 39 additions and 7 deletions

View File

@ -14,7 +14,6 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Edit.Timing.RowAttributes;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Screens.Edit.Timing
{
@ -130,8 +129,6 @@ namespace osu.Game.Screens.Edit.Timing
private Drawable createAttribute(ControlPoint controlPoint)
{
Color4 colour = controlPoint.GetRepresentingColour(colours);
switch (controlPoint)
{
case TimingControlPoint timing:
@ -141,10 +138,7 @@ namespace osu.Game.Screens.Edit.Timing
return new DifficultyRowAttribute(difficulty);
case EffectControlPoint effect:
return new EmptyRowAttribute("effect", () => string.Join(" ",
effect.KiaiMode ? "Kiai" : string.Empty,
effect.OmitFirstBarLine ? "NoBarLine" : string.Empty
).Trim(), colour);
return new EffectRowAttribute(effect);
case SampleControlPoint sample:
return new SampleRowAttribute(sample);

View File

@ -0,0 +1,38 @@
// 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;
namespace osu.Game.Screens.Edit.Timing.RowAttributes
{
public class EffectRowAttribute : RowAttribute
{
private readonly Bindable<bool> kiaiMode;
private readonly Bindable<bool> omitBarLine;
private AttributeBubbledWord kiaiModeBubble;
private AttributeBubbledWord omitBarLineBubble;
public EffectRowAttribute(EffectControlPoint effect)
: base(effect, "effect")
{
kiaiMode = effect.KiaiModeBindable.GetBoundCopy();
omitBarLine = effect.OmitFirstBarLineBindable.GetBoundCopy();
}
[BackgroundDependencyLoader]
private void load()
{
Content.AddRange(new Drawable[]
{
kiaiModeBubble = new AttributeBubbledWord(Point) { Text = "kiai" },
omitBarLineBubble = new AttributeBubbledWord(Point) { Text = "no barline" },
});
kiaiMode.BindValueChanged(enabled => kiaiModeBubble.FadeTo(enabled.NewValue ? 1 : 0), true);
omitBarLine.BindValueChanged(enabled => omitBarLineBubble.FadeTo(enabled.NewValue ? 1 : 0), true);
}
}
}