Use a safer method of setting the clock

This commit is contained in:
Dean Herbert 2019-03-05 20:14:04 +09:00
parent d5943330b1
commit 558dbafb71

View File

@ -108,13 +108,7 @@ namespace osu.Game.Rulesets.UI
protected override void LoadComplete()
{
base.LoadComplete();
// in case a parent gameplay clock isn't available, just use the parent clock.
if (parentGameplayClock == null)
parentGameplayClock = Clock;
Clock = gameplayClock;
ProcessCustomClock = false;
setClock();
}
/// <summary>
@ -161,7 +155,7 @@ namespace osu.Game.Rulesets.UI
private void updateClock()
{
if (parentGameplayClock == null)
return;
setClock(); // LoadComplete may not be run yet, but we still want the clock.
validState = true;
@ -210,6 +204,16 @@ namespace osu.Game.Rulesets.UI
}
}
private void setClock()
{
// in case a parent gameplay clock isn't available, just use the parent clock.
if (parentGameplayClock == null)
parentGameplayClock = Clock;
Clock = gameplayClock;
ProcessCustomClock = false;
}
#endregion
#region Setting application (disables etc.)