mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
Add fail dialog and flow.
This commit is contained in:
@ -24,6 +24,7 @@ using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Framework.Configuration;
|
||||
using System;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
@ -31,12 +32,10 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
public bool Autoplay;
|
||||
|
||||
protected override BackgroundMode CreateBackground() => null;
|
||||
protected override BackgroundMode CreateBackground() => new BackgroundModeBeatmap(Beatmap);
|
||||
|
||||
internal override bool ShowOverlays => false;
|
||||
|
||||
protected bool CanFail => true;
|
||||
|
||||
public BeatmapInfo BeatmapInfo;
|
||||
|
||||
public PlayMode PreferredPlayMode;
|
||||
@ -98,8 +97,12 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
hitRenderer = ruleset.CreateHitRendererWith(beatmap.HitObjects);
|
||||
|
||||
//bind HitRenderer to ScoreProcessor and ourselves (for a pass situation)
|
||||
hitRenderer.OnJudgement += scoreProcessor.AddJudgement;
|
||||
hitRenderer.OnAllJudged += hitRenderer_OnAllJudged;
|
||||
hitRenderer.OnAllJudged += onPass;
|
||||
|
||||
//bind ScoreProcessor to ourselves (for a fail situation)
|
||||
scoreProcessor.Failed += onFail;
|
||||
|
||||
if (Autoplay)
|
||||
hitRenderer.Schedule(() => hitRenderer.DrawableObjects.ForEach(h => h.State = ArmedState.Hit));
|
||||
@ -134,7 +137,7 @@ namespace osu.Game.Screens.Play
|
||||
});
|
||||
}
|
||||
|
||||
private void hitRenderer_OnAllJudged()
|
||||
private void onPass()
|
||||
{
|
||||
Delay(1000);
|
||||
Schedule(delegate
|
||||
@ -147,6 +150,19 @@ namespace osu.Game.Screens.Play
|
||||
});
|
||||
}
|
||||
|
||||
private void onFail()
|
||||
{
|
||||
Content.FadeColour(Color4.Red, 500);
|
||||
sourceClock.Stop();
|
||||
|
||||
Delay(500);
|
||||
Schedule(delegate
|
||||
{
|
||||
ValidForResume = false;
|
||||
Push(new FailDialog());
|
||||
});
|
||||
}
|
||||
|
||||
protected override void OnEntering(GameMode last)
|
||||
{
|
||||
base.OnEntering(last);
|
||||
|
Reference in New Issue
Block a user