1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 20:07:29 +08:00

Pause and fail overlays -> StopOverlay

This commit is contained in:
Andrey Zavadskiy 2017-03-28 06:08:31 +03:00
parent c4500fa270
commit 9774f826ab
5 changed files with 40 additions and 62 deletions

View File

@ -12,17 +12,19 @@ namespace osu.Desktop.VisualTests.Tests
{
public override string Description => @"Tests the pause overlay";
private PauseOverlay pauseOverlay;
private StopOverlay pauseOverlay;
private int retryCount;
public override void Reset()
{
base.Reset();
Add(pauseOverlay = new PauseOverlay
Add(pauseOverlay = new StopOverlay
{
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"); });

View File

@ -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?";
}
}
}

View File

@ -62,8 +62,8 @@ namespace osu.Game.Screens.Play
private SkipButton skipButton;
private HudOverlay hudOverlay;
private PauseOverlay pauseOverlay;
private FailOverlay failOverlay;
private StopOverlay pauseOverlay;
private StopOverlay failOverlay;
[BackgroundDependencyLoader]
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.BindProcessor(scoreProcessor);
pauseOverlay = new PauseOverlay
pauseOverlay = new StopOverlay
{
Depth = -1,
OnResume = delegate
OnEscPressed = delegate
{
Delay(400);
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(@"Retry", colours.YellowDark, Restart);
pauseOverlay.AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), Exit);
failOverlay = new FailOverlay
failOverlay = new StopOverlay
{
Depth = -1,
OnQuit = Exit,
OnEscPressed = Exit,
Title = @"failed",
Description = @"you're dead, try again?",
};
failOverlay.AddButton(@"Retry", colours.YellowDark, Restart);
failOverlay.AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), Exit);

View File

@ -16,7 +16,7 @@ using OpenTK.Input;
namespace osu.Game.Screens.Play
{
public class PauseOverlay : OverlayContainer
public class StopOverlay : OverlayContainer
{
private const int transition_duration = 200;
private const int button_height = 70;
@ -24,10 +24,22 @@ namespace osu.Game.Screens.Play
protected override bool HideOnEscape => false;
public Action OnResume;
public Action OnEscPressed;
protected OsuSpriteText Title;
protected OsuSpriteText Description;
private string title;
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;
@ -86,16 +98,16 @@ namespace osu.Game.Screens.Play
if (args.Key == Key.Escape)
{
if (State == Visibility.Hidden) return false;
resume();
onEscPressed();
return true;
}
return base.OnKeyDown(state, args);
}
private void resume()
private void onEscPressed()
{
OnResume?.Invoke();
OnEscPressed?.Invoke();
Hide();
}
@ -115,7 +127,7 @@ namespace osu.Game.Screens.Play
});
}
public PauseOverlay()
public StopOverlay()
{
AlwaysReceiveInput = true;
@ -148,9 +160,9 @@ namespace osu.Game.Screens.Play
Spacing = new Vector2(0, 20),
Children = new Drawable[]
{
Title = new OsuSpriteText
new OsuSpriteText
{
Text = @"paused",
Text = Title,
Font = @"Exo2.0-Medium",
Spacing = new Vector2(5, 0),
Origin = Anchor.TopCentre,
@ -160,9 +172,9 @@ namespace osu.Game.Screens.Play
Shadow = true,
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,
Anchor = Anchor.TopCentre,
Shadow = true,

View File

@ -194,14 +194,13 @@
<Compile Include="Screens\Multiplayer\Lobby.cs" />
<Compile Include="Screens\Multiplayer\Match.cs" />
<Compile Include="Screens\Multiplayer\MatchCreate.cs" />
<Compile Include="Screens\Play\FailOverlay.cs" />
<Compile Include="Screens\Play\KeyConversionInputManager.cs" />
<Compile Include="Screens\Play\Pause\PauseButton.cs" />
<Compile Include="Screens\Play\PauseOverlay.cs" />
<Compile Include="Screens\Play\PlayerInputManager.cs" />
<Compile Include="Screens\Play\PlayerLoader.cs" />
<Compile Include="Screens\Play\SkipButton.cs" />
<Compile Include="Modes\UI\StandardComboCounter.cs" />
<Compile Include="Screens\Play\StopOverlay.cs" />
<Compile Include="Screens\Select\BeatmapCarousel.cs" />
<Compile Include="Screens\Select\FilterCriteria.cs" />
<Compile Include="Screens\Select\Filter\GroupMode.cs" />