mirror of
https://github.com/ppy/osu.git
synced 2025-02-14 00:13:10 +08:00
Fix SliderBody's accent colour and thread-safety.
This commit is contained in:
parent
2c76a2350c
commit
4644f6afdb
@ -39,6 +39,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
{
|
||||
body = new SliderBody(s)
|
||||
{
|
||||
AccentColour = AccentColour,
|
||||
Position = s.StackedPosition,
|
||||
PathWidth = s.Scale * 64,
|
||||
},
|
||||
|
@ -44,7 +44,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
return;
|
||||
accentColour = value;
|
||||
|
||||
reloadTexture();
|
||||
if (LoadState == LoadState.Loaded)
|
||||
Schedule(reloadTexture);
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,15 +100,12 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
snakingIn = config.GetBindable<bool>(OsuConfig.SnakingInSliders);
|
||||
snakingOut = config.GetBindable<bool>(OsuConfig.SnakingOutSliders);
|
||||
|
||||
path.Texture = new Texture(textureWidth, 1);
|
||||
|
||||
reloadTexture();
|
||||
}
|
||||
|
||||
private void reloadTexture()
|
||||
{
|
||||
if (path.Texture == null)
|
||||
return;
|
||||
var texture = new Texture(textureWidth, 1);
|
||||
|
||||
//initialise background
|
||||
var upload = new TextureUpload(textureWidth * 4);
|
||||
@ -142,8 +140,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
}
|
||||
}
|
||||
|
||||
path.Texture.SetData(upload);
|
||||
path.Invalidate(Invalidation.DrawNode, this);
|
||||
texture.SetData(upload);
|
||||
path.Texture = texture;
|
||||
}
|
||||
|
||||
private readonly List<Vector2> currentCurve = new List<Vector2>();
|
||||
|
Loading…
Reference in New Issue
Block a user