1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 17:27:48 +08:00

Fix star fountains sometimes resetting visually

Addresses https://github.com/ppy/osu/discussions/26622.
This commit is contained in:
Dean Herbert 2024-01-22 18:01:21 +09:00
parent 993e733fce
commit cd551b1abd
No known key found for this signature in database

View File

@ -3,6 +3,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Threading;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Skinning; using osu.Game.Skinning;
@ -43,8 +44,6 @@ namespace osu.Game.Screens.Menu
private const double shoot_duration = 800; private const double shoot_duration = 800;
protected override bool CanSpawnParticles => lastShootTime != null && Time.Current - lastShootTime < shoot_duration;
[Resolved] [Resolved]
private ISkinSource skin { get; set; } = null!; private ISkinSource skin { get; set; } = null!;
@ -57,7 +56,6 @@ namespace osu.Game.Screens.Menu
private void load(TextureStore textures) private void load(TextureStore textures)
{ {
Texture = skin.GetTexture("Menu/fountain-star") ?? textures.Get("Menu/fountain-star"); Texture = skin.GetTexture("Menu/fountain-star") ?? textures.Get("Menu/fountain-star");
Active.Value = true;
} }
protected override FallingParticle CreateParticle() protected override FallingParticle CreateParticle()
@ -81,8 +79,15 @@ namespace osu.Game.Screens.Menu
return lastShootDirection * x_velocity_from_direction * (float)(1 - 2 * (Clock.CurrentTime - lastShootTime!.Value) / shoot_duration) + getRandomVariance(x_velocity_random_variance); return lastShootDirection * x_velocity_from_direction * (float)(1 - 2 * (Clock.CurrentTime - lastShootTime!.Value) / shoot_duration) + getRandomVariance(x_velocity_random_variance);
} }
private ScheduledDelegate? deactivateDelegate;
public void Shoot(int direction) public void Shoot(int direction)
{ {
Active.Value = true;
deactivateDelegate?.Cancel();
deactivateDelegate = Scheduler.AddDelayed(() => Active.Value = false, shoot_duration);
lastShootTime = Clock.CurrentTime; lastShootTime = Clock.CurrentTime;
lastShootDirection = direction; lastShootDirection = direction;
} }