refactor(hud/gameplay/SongProgressInfo): minor changes to text positioning, font and colour

This commit is contained in:
tsrk 2023-01-09 21:57:32 +01:00
parent f6265197e8
commit 28d2d766eb
No known key found for this signature in database
GPG Key ID: EBD46BB3049B56D6

View File

@ -10,6 +10,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using System; using System;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Screens.Play.HUD namespace osu.Game.Screens.Play.HUD
{ {
@ -27,13 +28,33 @@ namespace osu.Game.Screens.Play.HUD
private double songLength => endTime - startTime; private double songLength => endTime - startTime;
private const int margin = 10; public FontUsage Font
{
set
{
timeCurrent.Font = value;
timeLeft.Font = value;
progress.Font = value;
}
}
public Colour4 TextColour
{
set
{
timeCurrent.Colour = value;
timeLeft.Colour = value;
progress.Colour = value;
}
}
public double StartTime public double StartTime
{ {
set => startTime = value; set => startTime = value;
} }
public bool ShowProgress = true;
public double EndTime public double EndTime
{ {
set => endTime = value; set => endTime = value;
@ -76,6 +97,7 @@ namespace osu.Game.Screens.Play.HUD
Origin = Anchor.Centre, Origin = Anchor.Centre,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Alpha = ShowProgress ? 1 : 0,
Child = new UprightAspectMaintainingContainer Child = new UprightAspectMaintainingContainer
{ {
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -99,15 +121,15 @@ namespace osu.Game.Screens.Play.HUD
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Child = new UprightAspectMaintainingContainer Child = new UprightAspectMaintainingContainer
{ {
Origin = Anchor.Centre, Origin = Anchor.CentreRight,
Anchor = Anchor.Centre, Anchor = Anchor.CentreRight,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Scaling = ScaleMode.Vertical, Scaling = ScaleMode.Vertical,
ScalingFactor = 0.5f, ScalingFactor = 0.5f,
Child = timeLeft = new SizePreservingSpriteText Child = timeLeft = new SizePreservingSpriteText
{ {
Origin = Anchor.Centre, Origin = Anchor.CentreRight,
Anchor = Anchor.Centre, Anchor = Anchor.CentreRight,
Colour = colours.BlueLighter, Colour = colours.BlueLighter,
Font = OsuFont.Numeric, Font = OsuFont.Numeric,
} }
@ -128,7 +150,7 @@ namespace osu.Game.Screens.Play.HUD
if (currentPercent != previousPercent) if (currentPercent != previousPercent)
{ {
progress.Text = currentPercent.ToString() + @"%"; progress.Text = currentPercent + @"%";
previousPercent = currentPercent; previousPercent = currentPercent;
} }