mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 09:22:54 +08:00
Changed MetadataSection so that the Text setter loads the new text in async before displaying it.
This commit is contained in:
parent
00830c190c
commit
b34e724b8d
@ -316,7 +316,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private class MetadataSection : Container
|
private class MetadataSection : Container
|
||||||
{
|
{
|
||||||
private readonly TextFlowContainer textFlow;
|
private TextFlowContainer textFlow;
|
||||||
|
|
||||||
public string Text
|
public string Text
|
||||||
{
|
{
|
||||||
@ -329,11 +329,29 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.FadeIn(transition_duration);
|
this.FadeIn(transition_duration);
|
||||||
textFlow.Clear();
|
addTextAsync(value);
|
||||||
textFlow.AddText(value, s => s.TextSize = 14);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
public Color4 TextColour
|
||||||
{
|
{
|
||||||
get { return textFlow.Colour; }
|
get { return textFlow.Colour; }
|
||||||
|
Loading…
Reference in New Issue
Block a user