mirror of
https://github.com/ppy/osu.git
synced 2025-03-23 01:37:31 +08:00
Refactor layout of display
This commit is contained in:
parent
a631fae6df
commit
552230af9d
@ -61,7 +61,6 @@ namespace osu.Game.Overlays.Mods
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
// values as ModSelectOverlay footer buttons
|
||||
const float shear = ShearedOverlayContainer.SHEAR;
|
||||
|
||||
AutoSizeAxes = Axes.Both;
|
||||
@ -103,36 +102,26 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
new FillFlowContainer // actual inner content
|
||||
new Container // actual inner content
|
||||
{
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.X,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Width = 140,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Margin = new MarginPadding { Horizontal = 15 },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container // wrap to reserve space for StarRatingDisplay
|
||||
{
|
||||
Width = 70, // can be up to 70px on extra high SR
|
||||
Child = starRatingDisplay = new StarRatingDisplay(default, animated: true)
|
||||
{
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Shear = new Vector2(-shear, 0),
|
||||
}
|
||||
},
|
||||
new Container // wrap to reserve space for BPM
|
||||
starRatingDisplay = new StarRatingDisplay(default, animated: true)
|
||||
{
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Width = 70,
|
||||
Child = bpmDisplay = new BPMDisplay
|
||||
{
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Shear = new Vector2(-shear, 0),
|
||||
}
|
||||
Shear = new Vector2(-shear, 0),
|
||||
},
|
||||
bpmDisplay = new BPMDisplay
|
||||
{
|
||||
Origin = Anchor.CentreRight,
|
||||
Anchor = Anchor.CentreRight,
|
||||
Shear = new Vector2(-shear, 0),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -147,10 +136,10 @@ namespace osu.Game.Overlays.Mods
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new[]
|
||||
{
|
||||
circleSizeDisplay = new VerticalAttributeDisplay("CS", "0.#"),
|
||||
drainRateDisplay = new VerticalAttributeDisplay("HP", "0.#"),
|
||||
approachRateDisplay = new VerticalAttributeDisplay("AR", "0.##"),
|
||||
overallDifficultyDisplay = new VerticalAttributeDisplay("OD", "0.##"),
|
||||
circleSizeDisplay = new VerticalAttributeDisplay("CS"),
|
||||
drainRateDisplay = new VerticalAttributeDisplay("HP"),
|
||||
approachRateDisplay = new VerticalAttributeDisplay("AR"),
|
||||
overallDifficultyDisplay = new VerticalAttributeDisplay("OD"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -221,7 +210,8 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
protected override OsuSpriteText CreateSpriteText() => new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.Default.With(size: 20, weight: FontWeight.SemiBold)
|
||||
Font = OsuFont.Default.With(size: 20, weight: FontWeight.SemiBold),
|
||||
UseFullGlyphHeight = false,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ namespace osu.Game.Overlays.Mods
|
||||
get => current.Current;
|
||||
set => current.Current = value;
|
||||
}
|
||||
|
||||
private readonly BindableWithCurrent<double> current = new BindableWithCurrent<double>();
|
||||
|
||||
/// <summary>
|
||||
@ -28,7 +29,7 @@ namespace osu.Game.Overlays.Mods
|
||||
/// </summary>
|
||||
public LocalisableString Label { get; protected set; }
|
||||
|
||||
public VerticalAttributeDisplay(LocalisableString label, string format = "0.#")
|
||||
public VerticalAttributeDisplay(LocalisableString label)
|
||||
{
|
||||
Label = label;
|
||||
AutoSizeAxes = Axes.X;
|
||||
@ -50,12 +51,11 @@ namespace osu.Game.Overlays.Mods
|
||||
Margin = new MarginPadding { Horizontal = 15 }, // to reserve space for 0.XX value
|
||||
Font = OsuFont.Default.With(size: 20, weight: FontWeight.Bold)
|
||||
},
|
||||
new EffectCounter()
|
||||
new EffectCounter
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Current = { BindTarget = Current },
|
||||
Format = format
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -65,9 +65,7 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
protected override double RollingDuration => 500;
|
||||
|
||||
public string Format = "0.#";
|
||||
|
||||
protected override LocalisableString FormatCount(double count) => count.ToLocalisableString(Format);
|
||||
protected override LocalisableString FormatCount(double count) => count.ToLocalisableString("0.0");
|
||||
|
||||
protected override OsuSpriteText CreateSpriteText() => new OsuSpriteText
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user