1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-12 10:27:20 +08:00

Add back BPM and adjust sizing of bottom bar a bit more

This commit is contained in:
Dean Herbert 2024-07-12 12:34:43 +09:00
parent 95464ebf36
commit fb4f620c90
No known key found for this signature in database
2 changed files with 42 additions and 8 deletions

View File

@ -31,7 +31,7 @@ namespace osu.Game.Screens.Edit
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Height = 40; Height = 50;
Masking = true; Masking = true;
EdgeEffect = new EdgeEffectParameters EdgeEffect = new EdgeEffectParameters
@ -48,7 +48,7 @@ namespace osu.Game.Screens.Edit
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[] ColumnDimensions = new[]
{ {
new Dimension(GridSizeMode.Absolute, 170), new Dimension(GridSizeMode.Absolute, 150),
new Dimension(), new Dimension(),
new Dimension(GridSizeMode.Absolute, 220), new Dimension(GridSizeMode.Absolute, 220),
new Dimension(GridSizeMode.Absolute, HitObjectComposer.TOOLBOX_CONTRACTED_SIZE_RIGHT), new Dimension(GridSizeMode.Absolute, HitObjectComposer.TOOLBOX_CONTRACTED_SIZE_RIGHT),

View File

@ -17,6 +17,8 @@ namespace osu.Game.Screens.Edit.Components
{ {
public partial class TimeInfoContainer : BottomBarContainer public partial class TimeInfoContainer : BottomBarContainer
{ {
private OsuSpriteText bpm = null!;
[Resolved] [Resolved]
private EditorBeatmap editorBeatmap { get; set; } = null!; private EditorBeatmap editorBeatmap { get; set; } = null!;
@ -24,16 +26,38 @@ namespace osu.Game.Screens.Edit.Components
private EditorClock editorClock { get; set; } = null!; private EditorClock editorClock { get; set; } = null!;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider) private void load(OsuColour colours, OverlayColourProvider colourProvider)
{ {
Background.Colour = colourProvider.Background5; Background.Colour = colourProvider.Background5;
Children = new Drawable[] Children = new Drawable[]
{ {
new TimestampControl(), new TimestampControl(),
bpm = new OsuSpriteText
{
Colour = colours.Orange1,
Anchor = Anchor.CentreLeft,
Font = OsuFont.Torus.With(size: 14, weight: FontWeight.SemiBold),
Position = new Vector2(2, 4),
}
}; };
} }
private double? lastBPM;
protected override void Update()
{
base.Update();
double newBPM = editorBeatmap.ControlPointInfo.TimingPointAt(editorClock.CurrentTime).BPM;
if (lastBPM != newBPM)
{
lastBPM = newBPM;
bpm.Text = @$"{newBPM:0} BPM";
}
}
private partial class TimestampControl : OsuClickableContainer private partial class TimestampControl : OsuClickableContainer
{ {
private Container hoverLayer = null!; private Container hoverLayer = null!;
@ -63,7 +87,8 @@ namespace osu.Game.Screens.Edit.Components
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding Padding = new MarginPadding
{ {
Top = 5, Top = 4,
Bottom = 1,
Horizontal = -2 Horizontal = -2
}, },
Child = new Container Child = new Container
@ -83,12 +108,13 @@ namespace osu.Game.Screens.Edit.Components
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Spacing = new Vector2(-2, 0), Spacing = new Vector2(-2, 0),
Font = OsuFont.Torus.With(size: 36, fixedWidth: true, weight: FontWeight.Light), Font = OsuFont.Torus.With(size: 32, fixedWidth: true, weight: FontWeight.Light),
}, },
inputTextBox = new OsuTextBox inputTextBox = new TimestampTextBox
{ {
Width = 150, Position = new Vector2(-2, 4),
Height = 36, Width = 128,
Height = 26,
Alpha = 0, Alpha = 0,
CommitOnFocusLost = true, CommitOnFocusLost = true,
}, },
@ -136,6 +162,14 @@ namespace osu.Game.Screens.Edit.Components
showingHoverLayer = shouldShowHoverLayer; showingHoverLayer = shouldShowHoverLayer;
} }
} }
private partial class TimestampTextBox : OsuTextBox
{
public TimestampTextBox()
{
TextContainer.Height = 0.8f;
}
}
} }
} }
} }