1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:43:01 +08:00

Merge pull request #10315 from peppy/colourise-control-point-table

Colourise control point table
This commit is contained in:
Dean Herbert 2020-10-05 21:29:59 +09:00 committed by GitHub
commit 3630aa30d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 58 additions and 13 deletions

View File

@ -2,6 +2,8 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Graphics;
using osuTK.Graphics;
namespace osu.Game.Beatmaps.ControlPoints
{
@ -18,6 +20,8 @@ namespace osu.Game.Beatmaps.ControlPoints
public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time);
public virtual Color4 GetRepresentingColour(OsuColour colours) => colours.Yellow;
/// <summary>
/// Determines whether this <see cref="ControlPoint"/> results in a meaningful change when placed alongside another.
/// </summary>

View File

@ -2,6 +2,8 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Game.Graphics;
using osuTK.Graphics;
namespace osu.Game.Beatmaps.ControlPoints
{
@ -23,6 +25,8 @@ namespace osu.Game.Beatmaps.ControlPoints
MaxValue = 10
};
public override Color4 GetRepresentingColour(OsuColour colours) => colours.GreenDark;
/// <summary>
/// The speed multiplier at this control point.
/// </summary>

View File

@ -2,6 +2,8 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Game.Graphics;
using osuTK.Graphics;
namespace osu.Game.Beatmaps.ControlPoints
{
@ -18,6 +20,8 @@ namespace osu.Game.Beatmaps.ControlPoints
/// </summary>
public readonly BindableBool OmitFirstBarLineBindable = new BindableBool();
public override Color4 GetRepresentingColour(OsuColour colours) => colours.Purple;
/// <summary>
/// Whether the first bar line of this control point is ignored.
/// </summary>

View File

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

View File

@ -3,6 +3,8 @@
using osu.Framework.Bindables;
using osu.Game.Beatmaps.Timing;
using osu.Game.Graphics;
using osuTK.Graphics;
namespace osu.Game.Beatmaps.ControlPoints
{
@ -18,6 +20,8 @@ namespace osu.Game.Beatmaps.ControlPoints
/// </summary>
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
{
BeatLengthBindable =

View File

@ -15,12 +15,15 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
public class DifficultyPointPiece : CompositeDrawable
{
private readonly DifficultyControlPoint difficultyPoint;
private OsuSpriteText speedMultiplierText;
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]
@ -29,7 +32,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
RelativeSizeAxes = Axes.Y;
AutoSizeAxes = Axes.X;
Color4 colour = colours.GreenDark;
Color4 colour = difficultyPoint.GetRepresentingColour(colours);
InternalChildren = new Drawable[]
{

View File

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

View File

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

View File

@ -114,7 +114,14 @@ namespace osu.Game.Screens.Edit.Timing
controlPoints = group.ControlPoints.GetBoundCopy();
controlPoints.CollectionChanged += (_, __) => createChildren();
}
[Resolved]
private OsuColour colours { get; set; }
[BackgroundDependencyLoader]
private void load()
{
createChildren();
}
@ -125,20 +132,22 @@ namespace osu.Game.Screens.Edit.Timing
private Drawable createAttribute(ControlPoint controlPoint)
{
Color4 colour = controlPoint.GetRepresentingColour(colours);
switch (controlPoint)
{
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:
return new RowAttribute("difficulty", () => $"{difficulty.SpeedMultiplier:n2}x");
return new RowAttribute("difficulty", () => $"{difficulty.SpeedMultiplier:n2}x", colour);
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:
return new RowAttribute("sample", () => $"{sample.SampleBank} {sample.SampleVolume}%");
return new RowAttribute("sample", () => $"{sample.SampleBank} {sample.SampleVolume}%", colour);
}
return null;

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK.Graphics;
namespace osu.Game.Screens.Edit.Timing
{
@ -16,11 +17,13 @@ namespace osu.Game.Screens.Edit.Timing
{
private readonly string header;
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.content = content;
this.colour = colour;
}
[BackgroundDependencyLoader]
@ -40,7 +43,7 @@ namespace osu.Game.Screens.Edit.Timing
{
new Box
{
Colour = colours.Yellow,
Colour = colour,
RelativeSizeAxes = Axes.Both,
},
new OsuSpriteText
@ -50,7 +53,7 @@ namespace osu.Game.Screens.Edit.Timing
Origin = Anchor.Centre,
Font = OsuFont.Default.With(weight: FontWeight.SemiBold, size: 12),
Text = header,
Colour = colours.Gray3
Colour = colours.Gray0
},
};
}