1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 03:22:55 +08:00

Merge pull request #11698 from Joehuu/centre-player-loader-metadata

Fix player loader metadata not being centred
This commit is contained in:
Dan Balasescu 2021-02-08 10:42:00 +09:00 committed by GitHub
commit be0678c031
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,32 +23,6 @@ namespace osu.Game.Screens.Play
/// </summary>
public class BeatmapMetadataDisplay : Container
{
private class MetadataLine : Container
{
public MetadataLine(string left, string right)
{
AutoSizeAxes = Axes.Both;
Children = new Drawable[]
{
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopRight,
Margin = new MarginPadding { Right = 5 },
Colour = OsuColour.Gray(0.8f),
Text = left,
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopLeft,
Margin = new MarginPadding { Left = 5 },
Text = string.IsNullOrEmpty(right) ? @"-" : right,
}
};
}
}
private readonly WorkingBeatmap beatmap;
private readonly Bindable<IReadOnlyList<Mod>> mods;
private readonly Drawable facade;
@ -144,15 +118,34 @@ namespace osu.Game.Screens.Play
Bottom = 40
},
},
new MetadataLine("Source", metadata.Source)
new GridContainer
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
},
new MetadataLine("Mapper", metadata.AuthorString)
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
AutoSizeAxes = Axes.Both,
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
},
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
{
new Drawable[]
{
new MetadataLineLabel("Source"),
new MetadataLineInfo(metadata.Source)
},
new Drawable[]
{
new MetadataLineLabel("Mapper"),
new MetadataLineInfo(metadata.AuthorString)
}
}
},
new ModDisplay
{
@ -168,5 +161,26 @@ namespace osu.Game.Screens.Play
Loading = true;
}
private class MetadataLineLabel : OsuSpriteText
{
public MetadataLineLabel(string text)
{
Anchor = Anchor.TopRight;
Origin = Anchor.TopRight;
Margin = new MarginPadding { Right = 5 };
Colour = OsuColour.Gray(0.8f);
Text = text;
}
}
private class MetadataLineInfo : OsuSpriteText
{
public MetadataLineInfo(string text)
{
Margin = new MarginPadding { Left = 5 };
Text = string.IsNullOrEmpty(text) ? @"-" : text;
}
}
}
}