mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:18:22 +08:00
Move back/quit button from bottom left to fail overlay when spectating
This commit is contained in:
parent
b1d07cf933
commit
351160f94e
@ -6,10 +6,8 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
@ -26,22 +24,9 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public override LocalisableString Header => GameplayMenuOverlayStrings.FailedHeader;
|
||||
|
||||
private readonly bool showButtons;
|
||||
|
||||
public FailOverlay(bool showButtons = true)
|
||||
{
|
||||
this.showButtons = showButtons;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load()
|
||||
{
|
||||
if (showButtons)
|
||||
{
|
||||
AddButton(GameplayMenuOverlayStrings.Retry, colours.YellowDark, () => OnRetry?.Invoke());
|
||||
AddButton(GameplayMenuOverlayStrings.Quit, new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());
|
||||
}
|
||||
|
||||
// from #10339 maybe this is a better visual effect
|
||||
Add(new Container
|
||||
{
|
||||
|
@ -38,6 +38,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
||||
|
||||
public Action? OnResume;
|
||||
public Action? OnRetry;
|
||||
public Action? OnQuit;
|
||||
|
||||
@ -129,6 +130,15 @@ namespace osu.Game.Screens.Play
|
||||
},
|
||||
};
|
||||
|
||||
if (OnResume != null)
|
||||
AddButton(GameplayMenuOverlayStrings.Continue, colours.Green, () => OnResume.Invoke());
|
||||
|
||||
if (OnRetry != null)
|
||||
AddButton(GameplayMenuOverlayStrings.Retry, colours.YellowDark, () => OnRetry.Invoke());
|
||||
|
||||
if (OnQuit != null)
|
||||
AddButton(GameplayMenuOverlayStrings.Quit, new Color4(170, 27, 39, 255), () => OnQuit.Invoke());
|
||||
|
||||
State.ValueChanged += _ => InternalButtons.Deselect();
|
||||
|
||||
updateInfoText();
|
||||
|
@ -11,18 +11,14 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public partial class PauseOverlay : GameplayMenuOverlay
|
||||
{
|
||||
public Action OnResume;
|
||||
|
||||
public override bool IsPresent => base.IsPresent || pauseLoop.IsPlaying;
|
||||
|
||||
public override LocalisableString Header => GameplayMenuOverlayStrings.PausedHeader;
|
||||
@ -38,12 +34,8 @@ namespace osu.Game.Screens.Play
|
||||
};
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load()
|
||||
{
|
||||
AddButton(GameplayMenuOverlayStrings.Continue, colours.Green, () => OnResume?.Invoke());
|
||||
AddButton(GameplayMenuOverlayStrings.Retry, colours.YellowDark, () => OnRetry?.Invoke());
|
||||
AddButton(GameplayMenuOverlayStrings.Quit, new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());
|
||||
|
||||
AddInternal(pauseLoop = new SkinnableSound(new SampleInfo("Gameplay/pause-loop"))
|
||||
{
|
||||
Looping = true,
|
||||
|
@ -278,10 +278,10 @@ namespace osu.Game.Screens.Play
|
||||
createGameplayComponents(Beatmap.Value)
|
||||
}
|
||||
},
|
||||
FailOverlay = new FailOverlay(Configuration.AllowUserInteraction)
|
||||
FailOverlay = new FailOverlay
|
||||
{
|
||||
SaveReplay = async () => await prepareAndImportScoreAsync(true).ConfigureAwait(false),
|
||||
OnRetry = () => Restart(),
|
||||
OnRetry = Configuration.AllowUserInteraction ? () => Restart() : null,
|
||||
OnQuit = () => PerformExit(true),
|
||||
},
|
||||
new HotkeyExitOverlay
|
||||
|
@ -25,8 +25,6 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private readonly Score score;
|
||||
|
||||
public override bool AllowBackButton => true;
|
||||
|
||||
protected override bool CheckModsAllowFailure()
|
||||
{
|
||||
if (!allowFail)
|
||||
|
Loading…
Reference in New Issue
Block a user