1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 15:27:26 +08:00

Fix SliderBody's accent colour and thread-safety.

This commit is contained in:
Dean Herbert 2017-03-23 17:11:51 +09:00
parent 2c76a2350c
commit 4644f6afdb
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
2 changed files with 6 additions and 7 deletions

View File

@ -39,6 +39,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{
body = new SliderBody(s)
{
AccentColour = AccentColour,
Position = s.StackedPosition,
PathWidth = s.Scale * 64,
},

View File

@ -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>();