mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 15:03:13 +08:00
Pause and fail overlays -> StopOverlay
This commit is contained in:
parent
c4500fa270
commit
9774f826ab
@ -12,17 +12,19 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
{
|
{
|
||||||
public override string Description => @"Tests the pause overlay";
|
public override string Description => @"Tests the pause overlay";
|
||||||
|
|
||||||
private PauseOverlay pauseOverlay;
|
private StopOverlay pauseOverlay;
|
||||||
private int retryCount;
|
private int retryCount;
|
||||||
|
|
||||||
public override void Reset()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
base.Reset();
|
base.Reset();
|
||||||
|
|
||||||
Add(pauseOverlay = new PauseOverlay
|
Add(pauseOverlay = new StopOverlay
|
||||||
{
|
{
|
||||||
Depth = -1,
|
Depth = -1,
|
||||||
OnResume = () => Logger.Log(@"Resume"),
|
OnEscPressed = () => Logger.Log(@"Resume"),
|
||||||
|
Title = @"paused",
|
||||||
|
Description = @"you're not going to do what i think you're going to do, are ya?",
|
||||||
});
|
});
|
||||||
|
|
||||||
pauseOverlay.AddButton(@"Continue", Color4.Green, delegate { Logger.Log(@"Resume"); });
|
pauseOverlay.AddButton(@"Continue", Color4.Green, delegate { Logger.Log(@"Resume"); });
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Input;
|
|
||||||
using OpenTK.Input;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
|
||||||
{
|
|
||||||
public class FailOverlay : PauseOverlay
|
|
||||||
{
|
|
||||||
public Action OnQuit;
|
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
|
||||||
{
|
|
||||||
if (args.Key == Key.Escape)
|
|
||||||
{
|
|
||||||
if (State == Visibility.Hidden) return false;
|
|
||||||
quit();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.OnKeyDown(state, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void quit()
|
|
||||||
{
|
|
||||||
OnQuit?.Invoke();
|
|
||||||
Hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
public FailOverlay()
|
|
||||||
{
|
|
||||||
Title.Text = @"failed";
|
|
||||||
Description.Text = @"you're dead, try again?";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -62,8 +62,8 @@ namespace osu.Game.Screens.Play
|
|||||||
private SkipButton skipButton;
|
private SkipButton skipButton;
|
||||||
|
|
||||||
private HudOverlay hudOverlay;
|
private HudOverlay hudOverlay;
|
||||||
private PauseOverlay pauseOverlay;
|
private StopOverlay pauseOverlay;
|
||||||
private FailOverlay failOverlay;
|
private StopOverlay failOverlay;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, OsuColour colours)
|
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, OsuColour colours)
|
||||||
@ -125,24 +125,28 @@ namespace osu.Game.Screens.Play
|
|||||||
hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys());
|
hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys());
|
||||||
hudOverlay.BindProcessor(scoreProcessor);
|
hudOverlay.BindProcessor(scoreProcessor);
|
||||||
|
|
||||||
pauseOverlay = new PauseOverlay
|
pauseOverlay = new StopOverlay
|
||||||
{
|
{
|
||||||
Depth = -1,
|
Depth = -1,
|
||||||
OnResume = delegate
|
OnEscPressed = delegate
|
||||||
{
|
{
|
||||||
Delay(400);
|
Delay(400);
|
||||||
Schedule(Resume);
|
Schedule(Resume);
|
||||||
},
|
},
|
||||||
|
Title = @"paused",
|
||||||
|
Description = @"you're not going to do what i think you're going to do, are ya?",
|
||||||
};
|
};
|
||||||
pauseOverlay.AddButton(@"Continue", colours.Green, delegate { Delay(400); Schedule(Resume); });
|
pauseOverlay.AddButton(@"Continue", colours.Green, delegate { Delay(400); Schedule(Resume); });
|
||||||
pauseOverlay.AddButton(@"Retry", colours.YellowDark, Restart);
|
pauseOverlay.AddButton(@"Retry", colours.YellowDark, Restart);
|
||||||
pauseOverlay.AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), Exit);
|
pauseOverlay.AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), Exit);
|
||||||
|
|
||||||
|
|
||||||
failOverlay = new FailOverlay
|
failOverlay = new StopOverlay
|
||||||
{
|
{
|
||||||
Depth = -1,
|
Depth = -1,
|
||||||
OnQuit = Exit,
|
OnEscPressed = Exit,
|
||||||
|
Title = @"failed",
|
||||||
|
Description = @"you're dead, try again?",
|
||||||
};
|
};
|
||||||
failOverlay.AddButton(@"Retry", colours.YellowDark, Restart);
|
failOverlay.AddButton(@"Retry", colours.YellowDark, Restart);
|
||||||
failOverlay.AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), Exit);
|
failOverlay.AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), Exit);
|
||||||
|
@ -16,7 +16,7 @@ using OpenTK.Input;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class PauseOverlay : OverlayContainer
|
public class StopOverlay : OverlayContainer
|
||||||
{
|
{
|
||||||
private const int transition_duration = 200;
|
private const int transition_duration = 200;
|
||||||
private const int button_height = 70;
|
private const int button_height = 70;
|
||||||
@ -24,10 +24,22 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
protected override bool HideOnEscape => false;
|
protected override bool HideOnEscape => false;
|
||||||
|
|
||||||
public Action OnResume;
|
public Action OnEscPressed;
|
||||||
|
|
||||||
protected OsuSpriteText Title;
|
private string title;
|
||||||
protected OsuSpriteText Description;
|
private string description;
|
||||||
|
|
||||||
|
public string Title
|
||||||
|
{
|
||||||
|
get { return title; }
|
||||||
|
set { title = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Description
|
||||||
|
{
|
||||||
|
get { return description; }
|
||||||
|
set { description = value; }
|
||||||
|
}
|
||||||
|
|
||||||
private readonly FillFlowContainer buttons;
|
private readonly FillFlowContainer buttons;
|
||||||
|
|
||||||
@ -86,16 +98,16 @@ namespace osu.Game.Screens.Play
|
|||||||
if (args.Key == Key.Escape)
|
if (args.Key == Key.Escape)
|
||||||
{
|
{
|
||||||
if (State == Visibility.Hidden) return false;
|
if (State == Visibility.Hidden) return false;
|
||||||
resume();
|
onEscPressed();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.OnKeyDown(state, args);
|
return base.OnKeyDown(state, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resume()
|
private void onEscPressed()
|
||||||
{
|
{
|
||||||
OnResume?.Invoke();
|
OnEscPressed?.Invoke();
|
||||||
Hide();
|
Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +127,7 @@ namespace osu.Game.Screens.Play
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public PauseOverlay()
|
public StopOverlay()
|
||||||
{
|
{
|
||||||
AlwaysReceiveInput = true;
|
AlwaysReceiveInput = true;
|
||||||
|
|
||||||
@ -148,9 +160,9 @@ namespace osu.Game.Screens.Play
|
|||||||
Spacing = new Vector2(0, 20),
|
Spacing = new Vector2(0, 20),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
Title = new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = @"paused",
|
Text = Title,
|
||||||
Font = @"Exo2.0-Medium",
|
Font = @"Exo2.0-Medium",
|
||||||
Spacing = new Vector2(5, 0),
|
Spacing = new Vector2(5, 0),
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
@ -160,9 +172,9 @@ namespace osu.Game.Screens.Play
|
|||||||
Shadow = true,
|
Shadow = true,
|
||||||
ShadowColour = new Color4(0, 0, 0, 0.25f)
|
ShadowColour = new Color4(0, 0, 0, 0.25f)
|
||||||
},
|
},
|
||||||
Description = new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = @"you're not going to do what i think you're going to do, are ya?",
|
Text = Description,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Shadow = true,
|
Shadow = true,
|
@ -194,14 +194,13 @@
|
|||||||
<Compile Include="Screens\Multiplayer\Lobby.cs" />
|
<Compile Include="Screens\Multiplayer\Lobby.cs" />
|
||||||
<Compile Include="Screens\Multiplayer\Match.cs" />
|
<Compile Include="Screens\Multiplayer\Match.cs" />
|
||||||
<Compile Include="Screens\Multiplayer\MatchCreate.cs" />
|
<Compile Include="Screens\Multiplayer\MatchCreate.cs" />
|
||||||
<Compile Include="Screens\Play\FailOverlay.cs" />
|
|
||||||
<Compile Include="Screens\Play\KeyConversionInputManager.cs" />
|
<Compile Include="Screens\Play\KeyConversionInputManager.cs" />
|
||||||
<Compile Include="Screens\Play\Pause\PauseButton.cs" />
|
<Compile Include="Screens\Play\Pause\PauseButton.cs" />
|
||||||
<Compile Include="Screens\Play\PauseOverlay.cs" />
|
|
||||||
<Compile Include="Screens\Play\PlayerInputManager.cs" />
|
<Compile Include="Screens\Play\PlayerInputManager.cs" />
|
||||||
<Compile Include="Screens\Play\PlayerLoader.cs" />
|
<Compile Include="Screens\Play\PlayerLoader.cs" />
|
||||||
<Compile Include="Screens\Play\SkipButton.cs" />
|
<Compile Include="Screens\Play\SkipButton.cs" />
|
||||||
<Compile Include="Modes\UI\StandardComboCounter.cs" />
|
<Compile Include="Modes\UI\StandardComboCounter.cs" />
|
||||||
|
<Compile Include="Screens\Play\StopOverlay.cs" />
|
||||||
<Compile Include="Screens\Select\BeatmapCarousel.cs" />
|
<Compile Include="Screens\Select\BeatmapCarousel.cs" />
|
||||||
<Compile Include="Screens\Select\FilterCriteria.cs" />
|
<Compile Include="Screens\Select\FilterCriteria.cs" />
|
||||||
<Compile Include="Screens\Select\Filter\GroupMode.cs" />
|
<Compile Include="Screens\Select\Filter\GroupMode.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user