mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 19:22:54 +08:00
Merge pull request #6250 from Joehuu/truncate-metadata-on-wedge
Truncate long metadata on beatmap info wedge
This commit is contained in:
commit
35ef5a0007
@ -75,7 +75,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
testBeatmapLabels(instance);
|
||||
|
||||
// TODO: adjust cases once more info is shown for other gamemodes
|
||||
switch (instance)
|
||||
{
|
||||
case OsuRuleset _:
|
||||
@ -99,8 +98,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
testNullBeatmap();
|
||||
}
|
||||
|
||||
private void testBeatmapLabels(Ruleset ruleset)
|
||||
@ -117,7 +114,8 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddAssert("check info labels count", () => infoWedge.Info.InfoLabelContainer.Children.Count == expectedCount);
|
||||
}
|
||||
|
||||
private void testNullBeatmap()
|
||||
[Test]
|
||||
public void TestNullBeatmap()
|
||||
{
|
||||
selectBeatmap(null);
|
||||
AddAssert("check empty version", () => string.IsNullOrEmpty(infoWedge.Info.VersionLabel.Text));
|
||||
@ -127,6 +125,12 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddAssert("check no info labels", () => !infoWedge.Info.InfoLabelContainer.Children.Any());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTruncation()
|
||||
{
|
||||
selectBeatmap(createLongMetadata());
|
||||
}
|
||||
|
||||
private void selectBeatmap([CanBeNull] IBeatmap b)
|
||||
{
|
||||
BeatmapInfoWedge.BufferedWedgeInfo infoBefore = null;
|
||||
@ -166,6 +170,25 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
};
|
||||
}
|
||||
|
||||
private IBeatmap createLongMetadata()
|
||||
{
|
||||
return new Beatmap
|
||||
{
|
||||
BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
AuthorString = "WWWWWWWWWWWWWWW",
|
||||
Artist = "Verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long Artist",
|
||||
Source = "Verrrrry long Source",
|
||||
Title = "Verrrrry long Title"
|
||||
},
|
||||
Version = "Verrrrrrrrrrrrrrrrrrrrrrrrrrrrry long Version",
|
||||
Status = BeatmapSetOnlineStatus.Graveyard,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
private class TestBeatmapInfoWedge : BeatmapInfoWedge
|
||||
{
|
||||
public new BufferedWedgeInfo Info => base.Info;
|
||||
|
@ -31,7 +31,9 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
public class BeatmapInfoWedge : OverlayContainer
|
||||
{
|
||||
private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0);
|
||||
private const float shear_width = 36.75f;
|
||||
|
||||
private static readonly Vector2 wedged_container_shear = new Vector2(shear_width / SongSelect.WEDGED_CONTAINER_SIZE.Y, 0);
|
||||
|
||||
private readonly IBindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||
|
||||
@ -200,14 +202,17 @@ namespace osu.Game.Screens.Select
|
||||
Anchor = Anchor.TopLeft,
|
||||
Origin = Anchor.TopLeft,
|
||||
Direction = FillDirection.Vertical,
|
||||
Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 },
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Top = 10, Left = 25, Right = shear_width * 2.5f },
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
VersionLabel = new OsuSpriteText
|
||||
{
|
||||
Text = beatmapInfo.Version,
|
||||
Font = OsuFont.GetFont(size: 24, italics: true),
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Truncate = true,
|
||||
},
|
||||
}
|
||||
},
|
||||
@ -217,7 +222,7 @@ namespace osu.Game.Screens.Select
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Direction = FillDirection.Vertical,
|
||||
Margin = new MarginPadding { Top = 14, Left = 10, Right = 18, Bottom = 20 },
|
||||
Padding = new MarginPadding { Top = 14, Right = shear_width / 2 },
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -234,19 +239,24 @@ namespace osu.Game.Screens.Select
|
||||
Name = "Centre-aligned metadata",
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.TopLeft,
|
||||
Y = -22,
|
||||
Y = -7,
|
||||
Direction = FillDirection.Vertical,
|
||||
Margin = new MarginPadding { Top = 15, Left = 25, Right = 10, Bottom = 20 },
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Left = 25, Right = shear_width },
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
TitleLabel = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 28, italics: true),
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Truncate = true,
|
||||
},
|
||||
ArtistLabel = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 17, italics: true),
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Truncate = true,
|
||||
},
|
||||
MapperContainer = new FillFlowContainer
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
public abstract class SongSelect : OsuScreen, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 245);
|
||||
public static readonly Vector2 WEDGED_CONTAINER_SIZE = new Vector2(0.5f, 245);
|
||||
|
||||
protected const float BACKGROUND_BLUR = 20;
|
||||
private const float left_area_padding = 20;
|
||||
@ -109,7 +109,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Right = -150 },
|
||||
Size = new Vector2(wedged_container_size.X, 1),
|
||||
Size = new Vector2(WEDGED_CONTAINER_SIZE.X, 1),
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -118,11 +118,11 @@ namespace osu.Game.Screens.Select
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(wedged_container_size.X, 1),
|
||||
Size = new Vector2(WEDGED_CONTAINER_SIZE.X, 1),
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Bottom = Footer.HEIGHT,
|
||||
Top = wedged_container_size.Y + left_area_padding,
|
||||
Top = WEDGED_CONTAINER_SIZE.Y + left_area_padding,
|
||||
Left = left_area_padding,
|
||||
Right = left_area_padding * 2,
|
||||
},
|
||||
@ -158,7 +158,7 @@ namespace osu.Game.Screens.Select
|
||||
Child = Carousel = new BeatmapCarousel
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(1 - wedged_container_size.X, 1),
|
||||
Size = new Vector2(1 - WEDGED_CONTAINER_SIZE.X, 1),
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
SelectionChanged = updateSelectedBeatmap,
|
||||
@ -177,7 +177,7 @@ namespace osu.Game.Screens.Select
|
||||
},
|
||||
beatmapInfoWedge = new BeatmapInfoWedge
|
||||
{
|
||||
Size = wedged_container_size,
|
||||
Size = WEDGED_CONTAINER_SIZE,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user