From b34e724b8d17a1fda502683659e2d5b3e4c44d7b Mon Sep 17 00:00:00 2001 From: FreezyLemon Date: Mon, 27 Nov 2017 08:18:09 +0100 Subject: [PATCH] Changed MetadataSection so that the Text setter loads the new text in async before displaying it. --- osu.Game/Screens/Select/BeatmapDetails.cs | 24 ++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 6eaed67534..1b2108a6c8 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -316,7 +316,7 @@ namespace osu.Game.Screens.Select private class MetadataSection : Container { - private readonly TextFlowContainer textFlow; + private TextFlowContainer textFlow; public string Text { @@ -329,11 +329,29 @@ namespace osu.Game.Screens.Select } this.FadeIn(transition_duration); - textFlow.Clear(); - textFlow.AddText(value, s => s.TextSize = 14); + addTextAsync(value); } } + private void addTextAsync(string text) + { + var newTextFlow = new TextFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Colour = textFlow.Colour, + }; + + newTextFlow.AddText(text, s => s.TextSize = 14); + + LoadComponentAsync(newTextFlow, d => + { + var textContainer = (InternalChild as FillFlowContainer); + textContainer.Remove(textFlow); + textContainer.Add(textFlow = d); + }); + } + public Color4 TextColour { get { return textFlow.Colour; }