mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:33:20 +08:00
make drawables that update from path version update once per frame
This commit is contained in:
parent
882f490390
commit
5fa7f6ec53
@ -51,14 +51,26 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
base.LoadComplete();
|
||||
|
||||
hitObjectPosition = hitObject.PositionBindable.GetBoundCopy();
|
||||
hitObjectPosition.BindValueChanged(_ => updateConnectingPath());
|
||||
hitObjectPosition.BindValueChanged(_ => pathRequiresUpdate = true);
|
||||
|
||||
pathVersion = hitObject.Path.Version.GetBoundCopy();
|
||||
pathVersion.BindValueChanged(_ => updateConnectingPath());
|
||||
pathVersion.BindValueChanged(_ => pathRequiresUpdate = true);
|
||||
|
||||
updateConnectingPath();
|
||||
}
|
||||
|
||||
private bool pathRequiresUpdate;
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (!pathRequiresUpdate) return;
|
||||
|
||||
updateConnectingPath();
|
||||
pathRequiresUpdate = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the path connecting this control point to the next one.
|
||||
/// </summary>
|
||||
|
@ -18,8 +18,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
|
||||
protected IBindable<Color4> AccentColourBindable { get; private set; } = null!;
|
||||
|
||||
private IBindable<int> pathVersion = null!;
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private OsuRulesetConfigManager? config { get; set; }
|
||||
|
||||
@ -33,8 +31,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
ScaleBindable = drawableSlider.ScaleBindable.GetBoundCopy();
|
||||
ScaleBindable.BindValueChanged(scale => PathRadius = OsuHitObject.OBJECT_RADIUS * scale.NewValue, true);
|
||||
|
||||
pathVersion = drawableSlider.PathVersion.GetBoundCopy();
|
||||
pathVersion.BindValueChanged(_ => Refresh());
|
||||
drawableObject.DefaultsApplied += _ => Refresh();
|
||||
drawableObject.HitObjectApplied += _ => Refresh();
|
||||
|
||||
AccentColourBindable = drawableObject.AccentColour.GetBoundCopy();
|
||||
AccentColourBindable.BindValueChanged(accent => AccentColour = GetBodyAccentColour(skin, accent.NewValue), true);
|
||||
|
Loading…
Reference in New Issue
Block a user