1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 15:57:24 +08:00

Truncate beatmap title and artist on score panel

This commit is contained in:
Joehu 2020-04-30 22:13:38 -07:00
parent 078e633459
commit 700214d249
3 changed files with 14 additions and 5 deletions

View File

@ -20,6 +20,7 @@ using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring; using osu.Game.Scoring;
using osu.Game.Screens.Ranking;
using osu.Game.Screens.Ranking.Expanded; using osu.Game.Screens.Ranking.Expanded;
using osu.Game.Screens.Ranking.Expanded.Accuracy; using osu.Game.Screens.Ranking.Expanded.Accuracy;
using osu.Game.Screens.Ranking.Expanded.Statistics; using osu.Game.Screens.Ranking.Expanded.Statistics;
@ -74,6 +75,8 @@ namespace osu.Game.Tests.Visual.Ranking
{ {
var beatmap = new TestBeatmap(rulesetStore.GetRuleset(0)); var beatmap = new TestBeatmap(rulesetStore.GetRuleset(0));
beatmap.Metadata.Author = author; beatmap.Metadata.Author = author;
beatmap.Metadata.Title = "Verrrrrrrrrrrrrrrrrrry looooooooooooooooooooooooong beatmap title";
beatmap.Metadata.Artist = "Verrrrrrrrrrrrrrrrrrry looooooooooooooooooooooooong beatmap artist";
return new TestWorkingBeatmap(beatmap); return new TestWorkingBeatmap(beatmap);
} }
@ -114,7 +117,7 @@ namespace osu.Game.Tests.Visual.Ranking
Anchor = Anchor.Centre; Anchor = Anchor.Centre;
Origin = Anchor.Centre; Origin = Anchor.Centre;
Size = new Vector2(500, 700); Size = new Vector2(ScorePanel.EXPANDED_WIDTH, 700);
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box

View File

@ -35,6 +35,8 @@ namespace osu.Game.Screens.Ranking.Expanded
private RollingCounter<long> scoreCounter; private RollingCounter<long> scoreCounter;
private const float padding = 10;
/// <summary> /// <summary>
/// Creates a new <see cref="ExpandedPanelMiddleContent"/>. /// Creates a new <see cref="ExpandedPanelMiddleContent"/>.
/// </summary> /// </summary>
@ -46,7 +48,7 @@ namespace osu.Game.Screens.Ranking.Expanded
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
Masking = true; Masking = true;
Padding = new MarginPadding { Vertical = 10, Horizontal = 10 }; Padding = new MarginPadding(padding);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -92,13 +94,17 @@ namespace osu.Game.Screens.Ranking.Expanded
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Text = new LocalisedString((metadata.TitleUnicode, metadata.Title)), Text = new LocalisedString((metadata.TitleUnicode, metadata.Title)),
Font = OsuFont.Torus.With(size: 20, weight: FontWeight.SemiBold), Font = OsuFont.Torus.With(size: 20, weight: FontWeight.SemiBold),
MaxWidth = ScorePanel.EXPANDED_WIDTH - padding * 2,
Truncate = true,
}, },
new OsuSpriteText new OsuSpriteText
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Text = new LocalisedString((metadata.ArtistUnicode, metadata.Artist)), Text = new LocalisedString((metadata.ArtistUnicode, metadata.Artist)),
Font = OsuFont.Torus.With(size: 14, weight: FontWeight.SemiBold) Font = OsuFont.Torus.With(size: 14, weight: FontWeight.SemiBold),
MaxWidth = ScorePanel.EXPANDED_WIDTH - padding * 2,
Truncate = true,
}, },
new Container new Container
{ {

View File

@ -31,7 +31,7 @@ namespace osu.Game.Screens.Ranking
/// <summary> /// <summary>
/// Width of the panel when expanded. /// Width of the panel when expanded.
/// </summary> /// </summary>
private const float expanded_width = 360; public const float EXPANDED_WIDTH = 360;
/// <summary> /// <summary>
/// Height of the panel when expanded. /// Height of the panel when expanded.
@ -183,7 +183,7 @@ namespace osu.Game.Screens.Ranking
switch (state) switch (state)
{ {
case PanelState.Expanded: case PanelState.Expanded:
this.ResizeTo(new Vector2(expanded_width, expanded_height), resize_duration, Easing.OutQuint); this.ResizeTo(new Vector2(EXPANDED_WIDTH, expanded_height), resize_duration, Easing.OutQuint);
topLayerBackground.FadeColour(expanded_top_layer_colour, resize_duration, Easing.OutQuint); topLayerBackground.FadeColour(expanded_top_layer_colour, resize_duration, Easing.OutQuint);
middleLayerBackground.FadeColour(expanded_middle_layer_colour, resize_duration, Easing.OutQuint); middleLayerBackground.FadeColour(expanded_middle_layer_colour, resize_duration, Easing.OutQuint);