mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 09:32:55 +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();
|
base.LoadComplete();
|
||||||
|
|
||||||
hitObjectPosition = hitObject.PositionBindable.GetBoundCopy();
|
hitObjectPosition = hitObject.PositionBindable.GetBoundCopy();
|
||||||
hitObjectPosition.BindValueChanged(_ => updateConnectingPath());
|
hitObjectPosition.BindValueChanged(_ => pathRequiresUpdate = true);
|
||||||
|
|
||||||
pathVersion = hitObject.Path.Version.GetBoundCopy();
|
pathVersion = hitObject.Path.Version.GetBoundCopy();
|
||||||
pathVersion.BindValueChanged(_ => updateConnectingPath());
|
pathVersion.BindValueChanged(_ => pathRequiresUpdate = true);
|
||||||
|
|
||||||
updateConnectingPath();
|
updateConnectingPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool pathRequiresUpdate;
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
if (!pathRequiresUpdate) return;
|
||||||
|
|
||||||
|
updateConnectingPath();
|
||||||
|
pathRequiresUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the path connecting this control point to the next one.
|
/// Updates the path connecting this control point to the next one.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -18,8 +18,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
|
|
||||||
protected IBindable<Color4> AccentColourBindable { get; private set; } = null!;
|
protected IBindable<Color4> AccentColourBindable { get; private set; } = null!;
|
||||||
|
|
||||||
private IBindable<int> pathVersion = null!;
|
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private OsuRulesetConfigManager? config { get; set; }
|
private OsuRulesetConfigManager? config { get; set; }
|
||||||
|
|
||||||
@ -33,8 +31,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
ScaleBindable = drawableSlider.ScaleBindable.GetBoundCopy();
|
ScaleBindable = drawableSlider.ScaleBindable.GetBoundCopy();
|
||||||
ScaleBindable.BindValueChanged(scale => PathRadius = OsuHitObject.OBJECT_RADIUS * scale.NewValue, true);
|
ScaleBindable.BindValueChanged(scale => PathRadius = OsuHitObject.OBJECT_RADIUS * scale.NewValue, true);
|
||||||
|
|
||||||
pathVersion = drawableSlider.PathVersion.GetBoundCopy();
|
drawableObject.DefaultsApplied += _ => Refresh();
|
||||||
pathVersion.BindValueChanged(_ => Refresh());
|
drawableObject.HitObjectApplied += _ => Refresh();
|
||||||
|
|
||||||
AccentColourBindable = drawableObject.AccentColour.GetBoundCopy();
|
AccentColourBindable = drawableObject.AccentColour.GetBoundCopy();
|
||||||
AccentColourBindable.BindValueChanged(accent => AccentColour = GetBodyAccentColour(skin, accent.NewValue), true);
|
AccentColourBindable.BindValueChanged(accent => AccentColour = GetBodyAccentColour(skin, accent.NewValue), true);
|
||||||
|
Loading…
Reference in New Issue
Block a user