Fix handling of bindable changes in accent colour

This commit is contained in:
Dean Herbert
2020-02-19 11:23:45 +09:00
parent f245fe5934
commit 0f85e81240
5 changed files with 47 additions and 48 deletions

View File

@ -18,6 +18,7 @@ namespace osu.Game.Rulesets.Catch.Skinning
private readonly string lookupName;
private readonly IBindable<Color4> accentColour = new Bindable<Color4>();
private Sprite colouredSprite;
public LegacyFruitPiece(string lookupName)
{
@ -34,7 +35,7 @@ namespace osu.Game.Rulesets.Catch.Skinning
InternalChildren = new Drawable[]
{
new Sprite
colouredSprite = new Sprite
{
Texture = skin.GetTexture(lookupName),
Colour = drawableObject.AccentColour.Value,
@ -49,5 +50,12 @@ namespace osu.Game.Rulesets.Catch.Skinning
},
};
}
protected override void LoadComplete()
{
base.LoadComplete();
accentColour.BindValueChanged(colour => colouredSprite.Colour = colour.NewValue, true);
}
}
}