1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 23:22:55 +08:00

Changed MetadataSection so that the Text setter loads the new text in async before displaying it.

This commit is contained in:
FreezyLemon 2017-11-27 08:18:09 +01:00
parent 00830c190c
commit b34e724b8d

View File

@ -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; }