mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 13:37:25 +08:00
Fix colour not updated when index changes
This commit is contained in:
parent
dbf67f82c0
commit
e36bb7631d
@ -12,8 +12,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
{
|
||||
public class DrawableFruit : DrawablePalpableCatchHitObject
|
||||
{
|
||||
public readonly Bindable<int> IndexInBeatmap = new Bindable<int>();
|
||||
|
||||
public readonly Bindable<FruitVisualRepresentation> VisualRepresentation = new Bindable<FruitVisualRepresentation>();
|
||||
|
||||
protected virtual FruitVisualRepresentation GetVisualRepresentation(int indexInBeatmap) => (FruitVisualRepresentation)(indexInBeatmap % 4);
|
||||
@ -23,7 +21,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
public DrawableFruit(CatchHitObject h)
|
||||
: base(h)
|
||||
{
|
||||
IndexInBeatmap.Value = h.IndexInBeatmap;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -51,20 +48,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
});
|
||||
}
|
||||
|
||||
protected override void OnApply()
|
||||
{
|
||||
base.OnApply();
|
||||
|
||||
IndexInBeatmap.BindTo(HitObject.IndexInBeatmapBindable);
|
||||
}
|
||||
|
||||
protected override void OnFree()
|
||||
{
|
||||
IndexInBeatmap.UnbindFrom(HitObject.IndexInBeatmapBindable);
|
||||
|
||||
base.OnFree();
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
@ -17,6 +17,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
|
||||
public Bindable<float> ScaleBindable { get; } = new Bindable<float>(1);
|
||||
|
||||
public readonly Bindable<int> IndexInBeatmap = new Bindable<int>();
|
||||
|
||||
/// <summary>
|
||||
/// The multiplicative factor applied to <see cref="ScaleContainer"/> scale relative to <see cref="HitObject"/> scale.
|
||||
/// </summary>
|
||||
@ -41,6 +43,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
});
|
||||
|
||||
IndexInBeatmap.Value = h.IndexInBeatmap;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -55,6 +59,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
{
|
||||
ScaleContainer.Scale = new Vector2(scale.NewValue * ScaleFactor);
|
||||
}, true);
|
||||
|
||||
IndexInBeatmap.BindValueChanged(_ => UpdateComboColour());
|
||||
}
|
||||
|
||||
protected override void OnApply()
|
||||
@ -63,12 +69,14 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
|
||||
HyperDash.BindTo(HitObject.HyperDashBindable);
|
||||
ScaleBindable.BindTo(HitObject.ScaleBindable);
|
||||
IndexInBeatmap.BindTo(HitObject.IndexInBeatmapBindable);
|
||||
}
|
||||
|
||||
protected override void OnFree()
|
||||
{
|
||||
HyperDash.UnbindFrom(HitObject.HyperDashBindable);
|
||||
ScaleBindable.UnbindFrom(HitObject.ScaleBindable);
|
||||
IndexInBeatmap.UnbindFrom(HitObject.IndexInBeatmapBindable);
|
||||
|
||||
base.OnFree();
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
comboIndexBindable.BindValueChanged(_ => updateComboColour(), true);
|
||||
comboIndexBindable.BindValueChanged(_ => UpdateComboColour(), true);
|
||||
|
||||
updateState(ArmedState.Idle, true);
|
||||
}
|
||||
@ -533,7 +533,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
{
|
||||
base.SkinChanged(skin, allowFallback);
|
||||
|
||||
updateComboColour();
|
||||
UpdateComboColour();
|
||||
|
||||
ApplySkin(skin, allowFallback);
|
||||
|
||||
@ -541,7 +541,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
updateState(State.Value, true);
|
||||
}
|
||||
|
||||
private void updateComboColour()
|
||||
protected void UpdateComboColour()
|
||||
{
|
||||
if (!(HitObject is IHasComboInformation combo)) return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user