mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 14:53:21 +08:00
Set actions for retry/quit, moved setting paused to PopIn and PopOut, added null propogation for the sound samples for PauseButton(sometimes in the visual tests the audio doesn't load for whatever reason), added a gradient to the background of the PauseOverlay visual test(same as the one in the menu button system test), wired up the retry and quit actions in Player, made the quit action quit the map, retry still does nothing
This commit is contained in:
parent
dedd6a4bcf
commit
f35974021a
@ -1,12 +1,11 @@
|
||||
using System;
|
||||
using osu.Framework.GameModes.Testing;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK.Input;
|
||||
using osu.Game.Overlays.Pause;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.GameModes.Testing;
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
class TestCasePauseOverlay : TestCase
|
||||
@ -21,7 +20,13 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
Children = new[] { pauseOverlay = new PauseOverlay() };
|
||||
Add(new Box
|
||||
{
|
||||
ColourInfo = ColourInfo.GradientVertical(Color4.Gray, Color4.WhiteSmoke),
|
||||
RelativeSizeAxes = Framework.Graphics.Axes.Both,
|
||||
});
|
||||
Add(pauseOverlay = new PauseOverlay());
|
||||
|
||||
pauseOverlay.ToggleVisibility();
|
||||
}
|
||||
}
|
||||
|
@ -27,14 +27,14 @@ namespace osu.Game.Overlays.Pause
|
||||
|
||||
protected override bool OnMouseDown(Framework.Input.InputState state, Framework.Graphics.MouseDownEventArgs args)
|
||||
{
|
||||
sampleClick.Play();
|
||||
sampleClick?.Play();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnHover(Framework.Input.InputState state)
|
||||
{
|
||||
sampleHover.Play();
|
||||
sampleHover?.Play();
|
||||
ResizeTo(new Vector2(expandedWidth, height), 500, EasingTypes.OutElastic);
|
||||
|
||||
return true;
|
||||
|
@ -2,14 +2,12 @@
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Screens;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
|
||||
|
||||
@ -47,26 +45,30 @@ namespace osu.Game.Overlays.Pause
|
||||
{
|
||||
Text = @"Retry",
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre
|
||||
Anchor = Anchor.Centre,
|
||||
Action = Retry
|
||||
},
|
||||
new PauseButton
|
||||
{
|
||||
Text = @"Quit",
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Position = new Vector2(0, 200)
|
||||
Position = new Vector2(0, 200),
|
||||
Action = Quit
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
this.FadeTo(1, 100, EasingTypes.In);
|
||||
this.FadeTo(1, 100, EasingTypes.In);
|
||||
paused = true;
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
this.FadeTo(0, 100, EasingTypes.In);
|
||||
this.FadeTo(0, 100, EasingTypes.In);
|
||||
paused = false;
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
@ -83,25 +85,25 @@ namespace osu.Game.Overlays.Pause
|
||||
|
||||
private void Pause()
|
||||
{
|
||||
paused = true;
|
||||
Show();
|
||||
OnPause?.Invoke();
|
||||
}
|
||||
|
||||
private void Play()
|
||||
{
|
||||
paused = false;
|
||||
Hide();
|
||||
OnPlay?.Invoke();
|
||||
}
|
||||
|
||||
private void Retry()
|
||||
{
|
||||
{
|
||||
Hide();
|
||||
OnRetry?.Invoke();
|
||||
}
|
||||
|
||||
private void Quit()
|
||||
{
|
||||
{
|
||||
Hide();
|
||||
OnQuit?.Invoke();
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,8 @@ namespace osu.Game.Screens.Play
|
||||
pauseOverlay = new PauseOverlay();
|
||||
pauseOverlay.OnPause += onPause;
|
||||
pauseOverlay.OnPlay += onPlay;
|
||||
pauseOverlay.OnRetry += onRetry;
|
||||
pauseOverlay.OnQuit += onQuit;
|
||||
|
||||
hitRenderer = ruleset.CreateHitRendererWith(beatmap.HitObjects);
|
||||
|
||||
@ -185,6 +187,16 @@ namespace osu.Game.Screens.Play
|
||||
sourceClock.Start();
|
||||
}
|
||||
|
||||
private void onRetry()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void onQuit()
|
||||
{
|
||||
Exit();
|
||||
}
|
||||
|
||||
protected override void OnEntering(GameMode last)
|
||||
{
|
||||
base.OnEntering(last);
|
||||
|
Loading…
Reference in New Issue
Block a user