1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 14:12:55 +08:00

Improve performance of refreshes

This commit is contained in:
smoogipoo 2019-11-01 19:21:39 +09:00
parent 712253ff50
commit a19e26f8aa

View File

@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
protected override void LoadComplete()
{
base.LoadComplete();
bindHitObject(Start);
bindEvents(Start);
}
private DrawableOsuHitObject end;
@ -48,20 +48,21 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
end = value;
if (end != null)
bindHitObject(end);
bindEvents(end);
refreshFollowPoints();
refresh();
}
}
private void bindHitObject(DrawableOsuHitObject drawableObject)
private void bindEvents(DrawableOsuHitObject drawableObject)
{
drawableObject.HitObject.StartTimeBindable.BindValueChanged(_ => refreshFollowPoints());
drawableObject.HitObject.PositionBindable.BindValueChanged(_ => refreshFollowPoints());
drawableObject.HitObject.DefaultsApplied += refreshFollowPoints;
drawableObject.HitObject.PositionBindable.BindValueChanged(_ => scheduleRefresh());
drawableObject.HitObject.DefaultsApplied += scheduleRefresh;
}
private void refreshFollowPoints()
private void scheduleRefresh() => Scheduler.AddOnce(refresh);
private void refresh()
{
ClearInternal();