mirror of
https://github.com/ppy/osu.git
synced 2025-02-16 03:02:56 +08:00
Fix text position
This commit is contained in:
parent
8618d9ea0d
commit
12ef99a1a1
@ -5,15 +5,22 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play.HUD
|
namespace osu.Game.Screens.Play.HUD
|
||||||
{
|
{
|
||||||
public class SongProgressInfo : Container
|
public class SongProgressInfo : Container
|
||||||
{
|
{
|
||||||
|
private GrowToFitContainer timeCurrentContainer;
|
||||||
|
private GrowToFitContainer timeLeftContainer;
|
||||||
|
private GrowToFitContainer progressContainer;
|
||||||
|
|
||||||
private OsuSpriteText timeCurrent;
|
private OsuSpriteText timeCurrent;
|
||||||
private OsuSpriteText timeLeft;
|
private OsuSpriteText timeLeft;
|
||||||
private OsuSpriteText progress;
|
private OsuSpriteText progress;
|
||||||
@ -51,12 +58,14 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Child = timeCurrentContainer = new GrowToFitContainer
|
||||||
{
|
{
|
||||||
timeCurrent = new OsuSpriteText
|
Origin = Anchor.Centre,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Child = timeCurrent = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
@ -67,37 +76,37 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.Centre,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Child = timeLeftContainer = new GrowToFitContainer
|
||||||
{
|
{
|
||||||
progress = new OsuSpriteText
|
Origin = Anchor.Centre,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Child = progress = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Colour = colours.BlueLighter,
|
Colour = colours.BlueLighter,
|
||||||
Font = OsuFont.Numeric,
|
Font = OsuFont.Numeric,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.CentreRight,
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.CentreRight,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Child = progressContainer = new GrowToFitContainer
|
||||||
{
|
{
|
||||||
timeLeft = new OsuSpriteText
|
Origin = Anchor.Centre,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Child = timeLeft = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Colour = colours.BlueLighter,
|
Colour = colours.BlueLighter,
|
||||||
Font = OsuFont.Numeric,
|
Font = OsuFont.Numeric,
|
||||||
Margin = new MarginPadding
|
|
||||||
{
|
|
||||||
Right = margin,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,9 +148,9 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
private void keepTextSpritesUpright()
|
private void keepTextSpritesUpright()
|
||||||
{
|
{
|
||||||
timeCurrent.OnUpdate += (timeCurrent) => { Extensions.DrawableExtensions.KeepUprightAndUnstretched(timeCurrent); };
|
timeCurrentContainer.OnUpdate += (timeCurrentContainer) => { Extensions.DrawableExtensions.KeepUprightAndUnscaled(timeCurrentContainer); };
|
||||||
progress.OnUpdate += (timeCurrent) => { Extensions.DrawableExtensions.KeepUprightAndUnstretched(timeCurrent); };
|
progressContainer.OnUpdate += (progressContainer) => { Extensions.DrawableExtensions.KeepUprightAndUnscaled(progressContainer); };
|
||||||
timeLeft.OnUpdate += (timeCurrent) => { Extensions.DrawableExtensions.KeepUprightAndUnstretched(timeCurrent); };
|
timeLeftContainer.OnUpdate += (timeLeftContainer) => { Extensions.DrawableExtensions.KeepUprightAndUnscaled(timeLeftContainer); };
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user