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.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Screens.Ranking;
using osu.Game.Screens.Ranking.Expanded;
using osu.Game.Screens.Ranking.Expanded.Accuracy;
using osu.Game.Screens.Ranking.Expanded.Statistics;
@ -74,6 +75,8 @@ private WorkingBeatmap createTestBeatmap(User author)
{
var beatmap = new TestBeatmap(rulesetStore.GetRuleset(0));
beatmap.Metadata.Author = author;
beatmap.Metadata.Title = "Verrrrrrrrrrrrrrrrrrry looooooooooooooooooooooooong beatmap title";
beatmap.Metadata.Artist = "Verrrrrrrrrrrrrrrrrrry looooooooooooooooooooooooong beatmap artist";
return new TestWorkingBeatmap(beatmap);
}
@ -114,7 +117,7 @@ public ExpandedPanelMiddleContentContainer(WorkingBeatmap beatmap, ScoreInfo sco
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Size = new Vector2(500, 700);
Size = new Vector2(ScorePanel.EXPANDED_WIDTH, 700);
Children = new Drawable[]
{
new Box

View File

@ -35,6 +35,8 @@ public class ExpandedPanelMiddleContent : CompositeDrawable
private RollingCounter<long> scoreCounter;
private const float padding = 10;
/// <summary>
/// Creates a new <see cref="ExpandedPanelMiddleContent"/>.
/// </summary>
@ -46,7 +48,7 @@ public ExpandedPanelMiddleContent(ScoreInfo score)
RelativeSizeAxes = Axes.Both;
Masking = true;
Padding = new MarginPadding { Vertical = 10, Horizontal = 10 };
Padding = new MarginPadding(padding);
}
[BackgroundDependencyLoader]
@ -92,13 +94,17 @@ private void load(Bindable<WorkingBeatmap> working)
Origin = Anchor.TopCentre,
Text = new LocalisedString((metadata.TitleUnicode, metadata.Title)),
Font = OsuFont.Torus.With(size: 20, weight: FontWeight.SemiBold),
MaxWidth = ScorePanel.EXPANDED_WIDTH - padding * 2,
Truncate = true,
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
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
{

View File

@ -31,7 +31,7 @@ public class ScorePanel : CompositeDrawable, IStateful<PanelState>
/// <summary>
/// Width of the panel when expanded.
/// </summary>
private const float expanded_width = 360;
public const float EXPANDED_WIDTH = 360;
/// <summary>
/// Height of the panel when expanded.
@ -183,7 +183,7 @@ private void updateState()
switch (state)
{
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);
middleLayerBackground.FadeColour(expanded_middle_layer_colour, resize_duration, Easing.OutQuint);