Update state based on result during LoadComplete

This commit is contained in:
Derrick Timmermans 2022-11-27 20:57:00 +01:00
parent 61bfd2f6b2
commit cff3e06ad6
No known key found for this signature in database
GPG Key ID: B1771434E9B3282C

View File

@ -199,7 +199,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
comboColourBrightness.BindValueChanged(_ => UpdateComboColour());
// Apply transforms
updateState(State.Value, true);
updateStateBasedOnResults();
}
/// <summary>
@ -266,12 +266,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
// If not loaded, the state update happens in LoadComplete().
if (IsLoaded)
{
if (Result.IsHit)
updateState(ArmedState.Hit, true);
else if (Result.HasResult)
updateState(ArmedState.Miss, true);
else
updateState(ArmedState.Idle, true);
updateStateBasedOnResults();
// Combo colour may have been applied via a bindable flow while no object entry was attached.
// Update here to ensure we're in a good state.
@ -279,6 +274,16 @@ namespace osu.Game.Rulesets.Objects.Drawables
}
}
private void updateStateBasedOnResults()
{
if (Result.IsHit)
updateState(ArmedState.Hit, true);
else if (Result.HasResult)
updateState(ArmedState.Miss, true);
else
updateState(ArmedState.Idle, true);
}
protected sealed override void OnFree(HitObjectLifetimeEntry entry)
{
StartTimeBindable.UnbindFrom(HitObject.StartTimeBindable);