1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-28 01:47:33 +08:00

Truncate beatmap text

This commit is contained in:
Henry Lin 2021-07-22 12:18:37 +08:00
parent edce3e0efe
commit aab7678a69

View File

@ -108,7 +108,11 @@ namespace osu.Game.Screens.OnlinePlay
difficultyIconContainer.Child = new DifficultyIcon(beatmap.Value, ruleset.Value, requiredMods) { Size = new Vector2(32) }; difficultyIconContainer.Child = new DifficultyIcon(beatmap.Value, ruleset.Value, requiredMods) { Size = new Vector2(32) };
beatmapText.Clear(); beatmapText.Clear();
beatmapText.AddLink(Item.Beatmap.Value.ToRomanisableString(), LinkAction.OpenBeatmap, Item.Beatmap.Value.OnlineBeatmapID.ToString()); beatmapText.AddLink(Item.Beatmap.Value.ToRomanisableString(), LinkAction.OpenBeatmap, Item.Beatmap.Value.OnlineBeatmapID.ToString(), null, text =>
{
text.Truncate = true;
text.RelativeSizeAxes = Axes.X;
});
authorText.Clear(); authorText.Clear();
@ -147,84 +151,96 @@ namespace osu.Game.Screens.OnlinePlay
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Beatmap = { BindTarget = beatmap } Beatmap = { BindTarget = beatmap }
}, },
new FillFlowContainer new GridContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = 8 }, ColumnDimensions = new[]
Spacing = new Vector2(8, 0),
Direction = FillDirection.Horizontal,
Children = new Drawable[]
{ {
difficultyIconContainer = new Container new Dimension(GridSizeMode.AutoSize),
new Dimension(),
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
{
new Drawable[]
{ {
Anchor = Anchor.CentreLeft, difficultyIconContainer = new Container
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
},
new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{ {
beatmapText = new LinkFlowContainer(fontParameters) { AutoSizeAxes = Axes.Both }, Anchor = Anchor.CentreLeft,
new FillFlowContainer Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
Margin = new MarginPadding { Left = 8, Right = 8, },
},
new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{ {
AutoSizeAxes = Axes.Both, beatmapText = new LinkFlowContainer(fontParameters)
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10f, 0),
Children = new Drawable[]
{ {
new FillFlowContainer AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
},
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10f, 0),
Children = new Drawable[]
{ {
AutoSizeAxes = Axes.Both, new FillFlowContainer
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10f, 0),
Children = new Drawable[]
{ {
authorText = new LinkFlowContainer(fontParameters) { AutoSizeAxes = Axes.Both }, AutoSizeAxes = Axes.Both,
explicitContentPill = new ExplicitContentBeatmapPill Direction = FillDirection.Horizontal,
Spacing = new Vector2(10f, 0),
Children = new Drawable[]
{ {
Alpha = 0f, authorText = new LinkFlowContainer(fontParameters) { AutoSizeAxes = Axes.Both },
Anchor = Anchor.CentreLeft, explicitContentPill = new ExplicitContentBeatmapPill
Origin = Anchor.CentreLeft, {
Margin = new MarginPadding { Top = 3f }, Alpha = 0f,
} Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Margin = new MarginPadding { Top = 3f },
}
},
}, },
}, new Container
new Container
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
Child = modDisplay = new ModDisplay
{ {
Scale = new Vector2(0.4f), Anchor = Anchor.CentreLeft,
ExpansionMode = ExpansionMode.AlwaysExpanded Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
Child = modDisplay = new ModDisplay
{
Scale = new Vector2(0.4f),
ExpansionMode = ExpansionMode.AlwaysExpanded
}
} }
} }
} }
} }
},
new FillFlowContainer
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Direction = FillDirection.Horizontal,
Margin = new MarginPadding { Left = 8, Right = 10, },
AutoSizeAxes = Axes.Both,
Spacing = new Vector2(5),
ChildrenEnumerable = CreateButtons().Select(button => button.With(b =>
{
b.Anchor = Anchor.Centre;
b.Origin = Anchor.Centre;
}))
} }
} }
} }
}, },
new FillFlowContainer
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Direction = FillDirection.Horizontal,
AutoSizeAxes = Axes.Both,
Spacing = new Vector2(5),
X = -10,
ChildrenEnumerable = CreateButtons().Select(button => button.With(b =>
{
b.Anchor = Anchor.Centre;
b.Origin = Anchor.Centre;
}))
}
} }
}; };
} }