mirror of
https://github.com/ppy/osu
synced 2025-03-19 09:34:49 +00:00
Fix DrawableHitObject state not synchronizing with hitobject edits
This commit is contained in:
parent
896cbb0ba0
commit
d2f5e696e7
@ -260,7 +260,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
}
|
}
|
||||||
|
|
||||||
StartTimeBindable.BindTo(HitObject.StartTimeBindable);
|
StartTimeBindable.BindTo(HitObject.StartTimeBindable);
|
||||||
StartTimeBindable.BindValueChanged(onStartTimeChanged);
|
|
||||||
|
|
||||||
if (HitObject is IHasComboInformation combo)
|
if (HitObject is IHasComboInformation combo)
|
||||||
{
|
{
|
||||||
@ -311,9 +310,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
|
|
||||||
samplesBindable.UnbindFrom(HitObject.SamplesBindable);
|
samplesBindable.UnbindFrom(HitObject.SamplesBindable);
|
||||||
|
|
||||||
// Changes in start time trigger state updates. When a new hitobject is applied, OnApply() automatically performs a state update anyway.
|
|
||||||
StartTimeBindable.ValueChanged -= onStartTimeChanged;
|
|
||||||
|
|
||||||
// When a new hitobject is applied, the samples will be cleared before re-populating.
|
// When a new hitobject is applied, the samples will be cleared before re-populating.
|
||||||
// In order to stop this needless update, the event is unbound and re-bound as late as possible in Apply().
|
// In order to stop this needless update, the event is unbound and re-bound as late as possible in Apply().
|
||||||
samplesBindable.CollectionChanged -= onSamplesChanged;
|
samplesBindable.CollectionChanged -= onSamplesChanged;
|
||||||
@ -333,6 +329,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
Entry.NestedEntries.RemoveAll(nestedEntry => nestedEntry is SyntheticHitObjectEntry);
|
Entry.NestedEntries.RemoveAll(nestedEntry => nestedEntry is SyntheticHitObjectEntry);
|
||||||
ClearNestedHitObjects();
|
ClearNestedHitObjects();
|
||||||
|
|
||||||
|
// Changes in state trigger defaults applied trigger state updates.
|
||||||
|
// When a new hitobject is applied, OnApply() automatically performs a state update anyway.
|
||||||
HitObject.DefaultsApplied -= onDefaultsApplied;
|
HitObject.DefaultsApplied -= onDefaultsApplied;
|
||||||
|
|
||||||
entry.RevertResult -= onRevertResult;
|
entry.RevertResult -= onRevertResult;
|
||||||
@ -375,8 +373,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
|
|
||||||
private void onSamplesChanged(object sender, NotifyCollectionChangedEventArgs e) => LoadSamples();
|
private void onSamplesChanged(object sender, NotifyCollectionChangedEventArgs e) => LoadSamples();
|
||||||
|
|
||||||
private void onStartTimeChanged(ValueChangedEvent<double> startTime) => updateState(State.Value, true);
|
|
||||||
|
|
||||||
private void onNewResult(DrawableHitObject drawableHitObject, JudgementResult result) => OnNewResult?.Invoke(drawableHitObject, result);
|
private void onNewResult(DrawableHitObject drawableHitObject, JudgementResult result) => OnNewResult?.Invoke(drawableHitObject, result);
|
||||||
|
|
||||||
private void onRevertResult()
|
private void onRevertResult()
|
||||||
@ -394,6 +390,13 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
Debug.Assert(Entry != null);
|
Debug.Assert(Entry != null);
|
||||||
Apply(Entry);
|
Apply(Entry);
|
||||||
|
|
||||||
|
// Applied defaults indicate a change in hit object state.
|
||||||
|
if (Result is not null)
|
||||||
|
{
|
||||||
|
Result.TimeOffset = 0;
|
||||||
|
updateState(State.Value, true);
|
||||||
|
}
|
||||||
|
|
||||||
DefaultsApplied?.Invoke(this);
|
DefaultsApplied?.Invoke(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user