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

Automatically layout based on score display width

This commit is contained in:
ekrctb 2019-01-21 17:03:06 +09:00
parent 161d0f0564
commit e74f0057bd

View File

@ -50,9 +50,17 @@ namespace osu.Game.Screens.Play
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
AlwaysPresent = true, // The hud may be hidden but certain elements may need to still be updated AlwaysPresent = true, // The hud may be hidden but certain elements may need to still be updated
Children = new Drawable[] { Children = new Drawable[] {
ComboCounter = CreateComboCounter(), new Container {
ScoreCounter = CreateScoreCounter(), Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Y = 30,
AutoSizeAxes = Axes.Both,
Children = new Drawable[] {
AccuracyCounter = CreateAccuracyCounter(), AccuracyCounter = CreateAccuracyCounter(),
ScoreCounter = CreateScoreCounter(),
ComboCounter = CreateComboCounter(),
},
},
HealthDisplay = CreateHealthDisplay(), HealthDisplay = CreateHealthDisplay(),
Progress = CreateProgress(), Progress = CreateProgress(),
ModDisplay = CreateModsContainer(), ModDisplay = CreateModsContainer(),
@ -159,20 +167,27 @@ namespace osu.Game.Screens.Play
protected virtual RollingCounter<double> CreateAccuracyCounter() => new PercentageCounter protected virtual RollingCounter<double> CreateAccuracyCounter() => new PercentageCounter
{ {
Anchor = Anchor.TopCentre,
Origin = Anchor.TopRight,
Position = new Vector2(0, 35),
TextSize = 20, TextSize = 20,
Margin = new MarginPadding { Right = 140 }, BypassAutoSizeAxes = Axes.X,
Anchor = Anchor.TopLeft,
Origin = Anchor.TopRight,
Margin = new MarginPadding { Top = 5, Right = 20 },
};
protected virtual ScoreCounter CreateScoreCounter() => new ScoreCounter(6)
{
TextSize = 40,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
}; };
protected virtual RollingCounter<int> CreateComboCounter() => new SimpleComboCounter protected virtual RollingCounter<int> CreateComboCounter() => new SimpleComboCounter
{ {
Anchor = Anchor.TopCentre,
Origin = Anchor.TopLeft,
Position = new Vector2(0, 35),
Margin = new MarginPadding { Left = 140 },
TextSize = 20, TextSize = 20,
BypassAutoSizeAxes = Axes.X,
Anchor = Anchor.TopRight,
Origin = Anchor.TopLeft,
Margin = new MarginPadding { Top = 5, Left = 20 },
}; };
protected virtual HealthDisplay CreateHealthDisplay() => new StandardHealthDisplay protected virtual HealthDisplay CreateHealthDisplay() => new StandardHealthDisplay
@ -191,14 +206,6 @@ namespace osu.Game.Screens.Play
AudioClock = offsetClock AudioClock = offsetClock
}; };
protected virtual ScoreCounter CreateScoreCounter() => new ScoreCounter(6)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
TextSize = 40,
Position = new Vector2(0, 30),
};
protected virtual SongProgress CreateProgress() => new SongProgress protected virtual SongProgress CreateProgress() => new SongProgress
{ {
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,