mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Combine logic of Difficulty and Timing pieces where feasible
This commit is contained in:
@ -25,7 +25,7 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
MaxValue = 10
|
MaxValue = 10
|
||||||
};
|
};
|
||||||
|
|
||||||
public override Color4 GetRepresentingColour(OsuColour colours) => colours.GreenDark;
|
public override Color4 GetRepresentingColour(OsuColour colours) => colours.Lime1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The speed multiplier at this control point.
|
/// The speed multiplier at this control point.
|
||||||
|
@ -1,67 +1,27 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Bindables;
|
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.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||||
{
|
{
|
||||||
public class DifficultyPointPiece : CompositeDrawable
|
public class DifficultyPointPiece : TopPointPiece
|
||||||
{
|
{
|
||||||
private readonly DifficultyControlPoint difficultyPoint;
|
|
||||||
|
|
||||||
private OsuSpriteText speedMultiplierText;
|
|
||||||
private readonly BindableNumber<double> speedMultiplier;
|
private readonly BindableNumber<double> speedMultiplier;
|
||||||
|
|
||||||
public DifficultyPointPiece(DifficultyControlPoint difficultyPoint)
|
public DifficultyPointPiece(DifficultyControlPoint point)
|
||||||
|
: base(point)
|
||||||
{
|
{
|
||||||
this.difficultyPoint = difficultyPoint;
|
speedMultiplier = point.SpeedMultiplierBindable.GetBoundCopy();
|
||||||
speedMultiplier = difficultyPoint.SpeedMultiplierBindable.GetBoundCopy();
|
|
||||||
|
Y = Height;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
protected override void LoadComplete()
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y;
|
base.LoadComplete();
|
||||||
AutoSizeAxes = Axes.X;
|
speedMultiplier.BindValueChanged(multiplier => Label.Text = $"{multiplier.NewValue:n2}x", true);
|
||||||
|
|
||||||
Color4 colour = difficultyPoint.GetRepresentingColour(colours);
|
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
Colour = colour,
|
|
||||||
Width = 2,
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
Colour = colour,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
},
|
|
||||||
speedMultiplierText = new OsuSpriteText
|
|
||||||
{
|
|
||||||
Font = OsuFont.Default.With(weight: FontWeight.Bold),
|
|
||||||
Colour = Color4.White,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
speedMultiplier.BindValueChanged(multiplier => speedMultiplierText.Text = $"{multiplier.NewValue:n2}x", true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,58 +3,27 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
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.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||||
{
|
{
|
||||||
public class TimingPointPiece : CompositeDrawable
|
public class TimingPointPiece : TopPointPiece
|
||||||
{
|
{
|
||||||
private readonly TimingControlPoint point;
|
|
||||||
|
|
||||||
private readonly BindableNumber<double> beatLength;
|
private readonly BindableNumber<double> beatLength;
|
||||||
private OsuSpriteText bpmText;
|
|
||||||
|
|
||||||
public TimingPointPiece(TimingControlPoint point)
|
public TimingPointPiece(TimingControlPoint point)
|
||||||
|
: base(point)
|
||||||
{
|
{
|
||||||
this.point = point;
|
|
||||||
beatLength = point.BeatLengthBindable.GetBoundCopy();
|
beatLength = point.BeatLengthBindable.GetBoundCopy();
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Vertical = 10 };
|
|
||||||
|
|
||||||
const float corner_radius = 5;
|
|
||||||
|
|
||||||
AutoSizeAxes = Axes.Both;
|
|
||||||
Masking = true;
|
|
||||||
CornerRadius = corner_radius;
|
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
Colour = point.GetRepresentingColour(colours),
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
},
|
|
||||||
bpmText = new OsuSpriteText
|
|
||||||
{
|
|
||||||
Alpha = 0.9f,
|
|
||||||
Padding = new MarginPadding { Vertical = 3, Horizontal = 6 },
|
|
||||||
Font = OsuFont.Default.With(size: 20, weight: FontWeight.SemiBold),
|
|
||||||
Colour = colours.B5,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
beatLength.BindValueChanged(beatLength =>
|
beatLength.BindValueChanged(beatLength =>
|
||||||
{
|
{
|
||||||
bpmText.Text = $"{60000 / beatLength.NewValue:n1} BPM";
|
Label.Text = $"{60000 / beatLength.NewValue:n1} BPM";
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,55 @@
|
|||||||
|
// 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.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||||
|
{
|
||||||
|
public class TopPointPiece : CompositeDrawable
|
||||||
|
{
|
||||||
|
private readonly ControlPoint point;
|
||||||
|
|
||||||
|
protected OsuSpriteText Label { get; private set; }
|
||||||
|
|
||||||
|
public TopPointPiece(ControlPoint point)
|
||||||
|
{
|
||||||
|
this.point = point;
|
||||||
|
AutoSizeAxes = Axes.X;
|
||||||
|
Height = 16;
|
||||||
|
Margin = new MarginPadding(4);
|
||||||
|
|
||||||
|
Masking = true;
|
||||||
|
CornerRadius = Height / 2;
|
||||||
|
|
||||||
|
Origin = Anchor.TopCentre;
|
||||||
|
Anchor = Anchor.TopCentre;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Colour = point.GetRepresentingColour(colours),
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
Label = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Padding = new MarginPadding(3),
|
||||||
|
Font = OsuFont.Default.With(size: 14, weight: FontWeight.SemiBold),
|
||||||
|
Colour = colours.B5,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user