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