mirror of
https://github.com/osukey/osukey.git
synced 2025-06-08 12:58:01 +09:00
Don't schedule event, it's unreliable and doesn't match the fade.
This commit is contained in:
parent
7366640b95
commit
15c1013f5b
@ -11,7 +11,6 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Threading;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
@ -20,12 +19,13 @@ namespace osu.Game.Screens.Play
|
|||||||
public Action Action;
|
public Action Action;
|
||||||
|
|
||||||
private SampleChannel retrySample;
|
private SampleChannel retrySample;
|
||||||
private ScheduledDelegate task;
|
|
||||||
private Box overlay;
|
private Box overlay;
|
||||||
|
|
||||||
private const int activate_delay = 500;
|
private const int activate_delay = 500;
|
||||||
private const int fadeout_delay = 200;
|
private const int fadeout_delay = 200;
|
||||||
|
|
||||||
|
private bool fired;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
@ -52,13 +52,6 @@ namespace osu.Game.Screens.Play
|
|||||||
if (args.Key == Key.Tilde)
|
if (args.Key == Key.Tilde)
|
||||||
{
|
{
|
||||||
overlay.FadeIn(activate_delay);
|
overlay.FadeIn(activate_delay);
|
||||||
|
|
||||||
task = Scheduler.AddDelayed(() =>
|
|
||||||
{
|
|
||||||
retrySample.Play();
|
|
||||||
Action();
|
|
||||||
}, activate_delay);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,14 +60,24 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
protected override bool OnKeyUp(InputState state, KeyUpEventArgs args)
|
protected override bool OnKeyUp(InputState state, KeyUpEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.Key == Key.Tilde)
|
if (args.Key == Key.Tilde && !fired)
|
||||||
{
|
{
|
||||||
task?.Cancel();
|
|
||||||
overlay.FadeOut(fadeout_delay);
|
overlay.FadeOut(fadeout_delay);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.OnKeyUp(state, args);
|
return base.OnKeyUp(state, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
if (!fired && overlay.Alpha == 1)
|
||||||
|
{
|
||||||
|
fired = true;
|
||||||
|
retrySample.Play();
|
||||||
|
Action?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user