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

Use IsLoaded instead of Schedule

This commit is contained in:
Joseph Madamba 2024-05-02 22:46:42 -07:00
parent c15a685071
commit c21b7c7df9

View File

@ -476,29 +476,35 @@ namespace osu.Game.Overlays
private const float initial_move_delay = 1000; private const float initial_move_delay = 1000;
private const float pixels_per_second = 50; private const float pixels_per_second = 50;
private LocalisableString text;
private OsuSpriteText mainSpriteText = null!; private OsuSpriteText mainSpriteText = null!;
private OsuSpriteText fillerSpriteText = null!; private OsuSpriteText fillerSpriteText = null!;
private LocalisableString text;
public LocalisableString Text public LocalisableString Text
{ {
get => text; get => text;
set set
{ {
text = value; text = value;
Schedule(updateText);
if (IsLoaded)
updateText();
} }
} }
private FontUsage font = OsuFont.Default;
public FontUsage Font public FontUsage Font
{ {
set => Schedule(() => get => font;
set
{ {
mainSpriteText.Font = value; font = value;
fillerSpriteText.Font = value;
updateText(); if (IsLoaded)
}); updateFontAndText();
}
} }
public ScrollingTextContainer() public ScrollingTextContainer()
@ -521,6 +527,21 @@ namespace osu.Game.Overlays
}; };
} }
protected override void LoadComplete()
{
base.LoadComplete();
updateFontAndText();
}
private void updateFontAndText()
{
mainSpriteText.Font = font;
fillerSpriteText.Font = font;
updateText();
}
private void updateText() private void updateText()
{ {
mainSpriteText.Text = text; mainSpriteText.Text = text;