1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-07 21:23:22 +08:00

Move control point colour specifications to common location and use for formatting timing screen table

This commit is contained in:
Dean Herbert 2020-10-01 19:29:34 +09:00
parent fcccce8b4e
commit e96e30a19d
10 changed files with 57 additions and 12 deletions

View File

@ -2,6 +2,8 @@
// 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 System; using System;
using osu.Game.Graphics;
using osuTK.Graphics;
namespace osu.Game.Beatmaps.ControlPoints namespace osu.Game.Beatmaps.ControlPoints
{ {
@ -18,6 +20,8 @@ namespace osu.Game.Beatmaps.ControlPoints
public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time); public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time);
public virtual Color4 GetRepresentingColour(OsuColour colours) => colours.Yellow;
/// <summary> /// <summary>
/// Determines whether this <see cref="ControlPoint"/> results in a meaningful change when placed alongside another. /// Determines whether this <see cref="ControlPoint"/> results in a meaningful change when placed alongside another.
/// </summary> /// </summary>

View File

@ -2,6 +2,8 @@
// 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.Bindables; using osu.Framework.Bindables;
using osu.Game.Graphics;
using osuTK.Graphics;
namespace osu.Game.Beatmaps.ControlPoints namespace osu.Game.Beatmaps.ControlPoints
{ {
@ -23,6 +25,8 @@ namespace osu.Game.Beatmaps.ControlPoints
MaxValue = 10 MaxValue = 10
}; };
public override Color4 GetRepresentingColour(OsuColour colours) => colours.GreenDark;
/// <summary> /// <summary>
/// The speed multiplier at this control point. /// The speed multiplier at this control point.
/// </summary> /// </summary>

View File

@ -2,6 +2,8 @@
// 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.Bindables; using osu.Framework.Bindables;
using osu.Game.Graphics;
using osuTK.Graphics;
namespace osu.Game.Beatmaps.ControlPoints namespace osu.Game.Beatmaps.ControlPoints
{ {
@ -18,6 +20,8 @@ namespace osu.Game.Beatmaps.ControlPoints
/// </summary> /// </summary>
public readonly BindableBool OmitFirstBarLineBindable = new BindableBool(); public readonly BindableBool OmitFirstBarLineBindable = new BindableBool();
public override Color4 GetRepresentingColour(OsuColour colours) => colours.Purple;
/// <summary> /// <summary>
/// Whether the first bar line of this control point is ignored. /// Whether the first bar line of this control point is ignored.
/// </summary> /// </summary>

View File

@ -3,6 +3,8 @@
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Game.Audio; using osu.Game.Audio;
using osu.Game.Graphics;
using osuTK.Graphics;
namespace osu.Game.Beatmaps.ControlPoints namespace osu.Game.Beatmaps.ControlPoints
{ {
@ -16,6 +18,8 @@ namespace osu.Game.Beatmaps.ControlPoints
SampleVolumeBindable = { Disabled = true } SampleVolumeBindable = { Disabled = true }
}; };
public override Color4 GetRepresentingColour(OsuColour colours) => colours.Pink;
/// <summary> /// <summary>
/// The default sample bank at this control point. /// The default sample bank at this control point.
/// </summary> /// </summary>

View File

@ -3,6 +3,8 @@
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Game.Beatmaps.Timing; using osu.Game.Beatmaps.Timing;
using osu.Game.Graphics;
using osuTK.Graphics;
namespace osu.Game.Beatmaps.ControlPoints namespace osu.Game.Beatmaps.ControlPoints
{ {
@ -18,6 +20,8 @@ namespace osu.Game.Beatmaps.ControlPoints
/// </summary> /// </summary>
private const double default_beat_length = 60000.0 / 60.0; private const double default_beat_length = 60000.0 / 60.0;
public override Color4 GetRepresentingColour(OsuColour colours) => colours.YellowDark;
public static readonly TimingControlPoint DEFAULT = new TimingControlPoint public static readonly TimingControlPoint DEFAULT = new TimingControlPoint
{ {
BeatLengthBindable = BeatLengthBindable =

View File

@ -15,12 +15,15 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{ {
public class DifficultyPointPiece : CompositeDrawable public class DifficultyPointPiece : CompositeDrawable
{ {
private readonly DifficultyControlPoint difficultyPoint;
private OsuSpriteText speedMultiplierText; private OsuSpriteText speedMultiplierText;
private readonly BindableNumber<double> speedMultiplier; private readonly BindableNumber<double> speedMultiplier;
public DifficultyPointPiece(DifficultyControlPoint point) public DifficultyPointPiece(DifficultyControlPoint difficultyPoint)
{ {
speedMultiplier = point.SpeedMultiplierBindable.GetBoundCopy(); this.difficultyPoint = difficultyPoint;
speedMultiplier = difficultyPoint.SpeedMultiplierBindable.GetBoundCopy();
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -29,7 +32,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
RelativeSizeAxes = Axes.Y; RelativeSizeAxes = Axes.Y;
AutoSizeAxes = Axes.X; AutoSizeAxes = Axes.X;
Color4 colour = colours.GreenDark; Color4 colour = difficultyPoint.GetRepresentingColour(colours);
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {

View File

@ -3,6 +3,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -16,6 +17,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{ {
public class SamplePointPiece : CompositeDrawable public class SamplePointPiece : CompositeDrawable
{ {
private readonly SampleControlPoint samplePoint;
private readonly Bindable<string> bank; private readonly Bindable<string> bank;
private readonly BindableNumber<int> volume; private readonly BindableNumber<int> volume;
@ -24,6 +27,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
public SamplePointPiece(SampleControlPoint samplePoint) public SamplePointPiece(SampleControlPoint samplePoint)
{ {
this.samplePoint = samplePoint;
volume = samplePoint.SampleVolumeBindable.GetBoundCopy(); volume = samplePoint.SampleVolumeBindable.GetBoundCopy();
bank = samplePoint.SampleBankBindable.GetBoundCopy(); bank = samplePoint.SampleBankBindable.GetBoundCopy();
} }
@ -37,7 +41,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
AutoSizeAxes = Axes.X; AutoSizeAxes = Axes.X;
RelativeSizeAxes = Axes.Y; RelativeSizeAxes = Axes.Y;
Color4 colour = colours.PinkDarker; Color4 colour = samplePoint.GetRepresentingColour(colours);
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
@ -57,7 +61,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
}, },
new Box new Box
{ {
Colour = colours.Pink, Colour = colour.Lighten(0.2f),
Width = 2, Width = 2,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
}, },

View File

@ -11,16 +11,20 @@ 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; 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 TimingPointPiece : CompositeDrawable public class TimingPointPiece : CompositeDrawable
{ {
private readonly TimingControlPoint point;
private readonly BindableNumber<double> beatLength; private readonly BindableNumber<double> beatLength;
private OsuSpriteText bpmText; private OsuSpriteText bpmText;
public TimingPointPiece(TimingControlPoint point) public TimingPointPiece(TimingControlPoint point)
{ {
this.point = point;
beatLength = point.BeatLengthBindable.GetBoundCopy(); beatLength = point.BeatLengthBindable.GetBoundCopy();
} }
@ -32,12 +36,14 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Color4 colour = point.GetRepresentingColour(colours);
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new Box new Box
{ {
Alpha = 0.9f, Alpha = 0.9f,
Colour = ColourInfo.GradientHorizontal(colours.YellowDark, colours.YellowDark.Opacity(0.5f)), Colour = ColourInfo.GradientHorizontal(colour, colour.Opacity(0.5f)),
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
bpmText = new OsuSpriteText bpmText = new OsuSpriteText

View File

@ -114,7 +114,14 @@ namespace osu.Game.Screens.Edit.Timing
controlPoints = group.ControlPoints.GetBoundCopy(); controlPoints = group.ControlPoints.GetBoundCopy();
controlPoints.CollectionChanged += (_, __) => createChildren(); controlPoints.CollectionChanged += (_, __) => createChildren();
}
[Resolved]
private OsuColour colours { get; set; }
[BackgroundDependencyLoader]
private void load()
{
createChildren(); createChildren();
} }
@ -125,20 +132,22 @@ namespace osu.Game.Screens.Edit.Timing
private Drawable createAttribute(ControlPoint controlPoint) private Drawable createAttribute(ControlPoint controlPoint)
{ {
Color4 colour = controlPoint.GetRepresentingColour(colours);
switch (controlPoint) switch (controlPoint)
{ {
case TimingControlPoint timing: case TimingControlPoint timing:
return new RowAttribute("timing", () => $"{60000 / timing.BeatLength:n1}bpm {timing.TimeSignature}"); return new RowAttribute("timing", () => $"{60000 / timing.BeatLength:n1}bpm {timing.TimeSignature}", colour);
case DifficultyControlPoint difficulty: case DifficultyControlPoint difficulty:
return new RowAttribute("difficulty", () => $"{difficulty.SpeedMultiplier:n2}x"); return new RowAttribute("difficulty", () => $"{difficulty.SpeedMultiplier:n2}x", colour);
case EffectControlPoint effect: case EffectControlPoint effect:
return new RowAttribute("effect", () => $"{(effect.KiaiMode ? "Kiai " : "")}{(effect.OmitFirstBarLine ? "NoBarLine " : "")}"); return new RowAttribute("effect", () => $"{(effect.KiaiMode ? "Kiai " : "")}{(effect.OmitFirstBarLine ? "NoBarLine " : "")}", colour);
case SampleControlPoint sample: case SampleControlPoint sample:
return new RowAttribute("sample", () => $"{sample.SampleBank} {sample.SampleVolume}%"); return new RowAttribute("sample", () => $"{sample.SampleBank} {sample.SampleVolume}%", colour);
} }
return null; return null;

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osuTK.Graphics;
namespace osu.Game.Screens.Edit.Timing namespace osu.Game.Screens.Edit.Timing
{ {
@ -16,11 +17,13 @@ namespace osu.Game.Screens.Edit.Timing
{ {
private readonly string header; private readonly string header;
private readonly Func<string> content; private readonly Func<string> content;
private readonly Color4 colour;
public RowAttribute(string header, Func<string> content) public RowAttribute(string header, Func<string> content, Color4 colour)
{ {
this.header = header; this.header = header;
this.content = content; this.content = content;
this.colour = colour;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -40,7 +43,7 @@ namespace osu.Game.Screens.Edit.Timing
{ {
new Box new Box
{ {
Colour = colours.Yellow, Colour = colour,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
new OsuSpriteText new OsuSpriteText