mirror of
https://github.com/ppy/osu
synced 2025-02-20 20:47:09 +00:00
Merge remote-tracking branch 'refs/remotes/ppy/master' into rankings-spotlights-filter
This commit is contained in:
commit
df9ea5cc2f
@ -573,7 +573,9 @@ namespace osu.Game
|
||||
Origin = Anchor.BottomLeft,
|
||||
Action = () =>
|
||||
{
|
||||
if ((ScreenStack.CurrentScreen as IOsuScreen)?.AllowBackButton == true)
|
||||
var currentScreen = ScreenStack.CurrentScreen as IOsuScreen;
|
||||
|
||||
if (currentScreen?.AllowBackButton == true && !currentScreen.OnBackButton())
|
||||
ScreenStack.Exit();
|
||||
}
|
||||
},
|
||||
|
@ -19,6 +19,7 @@ using osu.Game.Graphics.Backgrounds;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Overlays.Mods.Sections;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Screens;
|
||||
@ -403,6 +404,8 @@ namespace osu.Game.Overlays.Mods
|
||||
return base.OnKeyDown(e);
|
||||
}
|
||||
|
||||
public override bool OnPressed(GlobalAction action) => false; // handled by back button
|
||||
|
||||
private void availableModsChanged(ValueChangedEvent<Dictionary<ModType, IReadOnlyList<Mod>>> mods)
|
||||
{
|
||||
if (mods.NewValue == null) return;
|
||||
|
@ -56,5 +56,14 @@ namespace osu.Game.Screens
|
||||
/// Whether mod rate adjustments are allowed to be applied.
|
||||
/// </summary>
|
||||
bool AllowRateAdjustments { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when the back button has been pressed to close any overlays before exiting this <see cref="IOsuScreen"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Return <c>true</c> to block this <see cref="IOsuScreen"/> from being exited after closing an overlay.
|
||||
/// Return <c>false</c> if this <see cref="IOsuScreen"/> should continue exiting.
|
||||
/// </remarks>
|
||||
bool OnBackButton();
|
||||
}
|
||||
}
|
||||
|
@ -250,12 +250,6 @@ namespace osu.Game.Screens.Multi
|
||||
{
|
||||
roomManager.PartRoom();
|
||||
|
||||
if (screenStack.CurrentScreen != null && !(screenStack.CurrentScreen is LoungeSubScreen))
|
||||
{
|
||||
screenStack.Exit();
|
||||
return true;
|
||||
}
|
||||
|
||||
waves.Hide();
|
||||
|
||||
this.Delay(WaveContainer.DISAPPEAR_DURATION).FadeOut();
|
||||
@ -269,6 +263,20 @@ namespace osu.Game.Screens.Multi
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool OnBackButton()
|
||||
{
|
||||
if ((screenStack.CurrentScreen as IMultiplayerSubScreen)?.OnBackButton() == true)
|
||||
return true;
|
||||
|
||||
if (screenStack.CurrentScreen != null && !(screenStack.CurrentScreen is LoungeSubScreen))
|
||||
{
|
||||
screenStack.Exit();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override void LogoExiting(OsuLogo logo)
|
||||
{
|
||||
base.LogoExiting(logo);
|
||||
|
@ -258,5 +258,7 @@ namespace osu.Game.Screens
|
||||
/// Note that the instance created may not be the used instance if it matches the BackgroundMode equality clause.
|
||||
/// </summary>
|
||||
protected virtual BackgroundScreen CreateBackground() => null;
|
||||
|
||||
public virtual bool OnBackButton() => false;
|
||||
}
|
||||
}
|
||||
|
@ -194,6 +194,13 @@ namespace osu.Game.Screens.Ranking
|
||||
}
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
{
|
||||
Background.FadeTo(1, 250);
|
||||
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
|
||||
public override bool OnBackButton()
|
||||
{
|
||||
if (statisticsPanel.State.Value == Visibility.Visible)
|
||||
{
|
||||
@ -201,9 +208,7 @@ namespace osu.Game.Screens.Ranking
|
||||
return true;
|
||||
}
|
||||
|
||||
Background.FadeTo(1, 250);
|
||||
|
||||
return base.OnExiting(next);
|
||||
return false;
|
||||
}
|
||||
|
||||
private void addScore(ScoreInfo score)
|
||||
|
@ -599,12 +599,6 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
{
|
||||
if (ModSelect.State.Value == Visibility.Visible)
|
||||
{
|
||||
ModSelect.Hide();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (base.OnExiting(next))
|
||||
return true;
|
||||
|
||||
@ -620,6 +614,17 @@ namespace osu.Game.Screens.Select
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool OnBackButton()
|
||||
{
|
||||
if (ModSelect.State.Value == Visibility.Visible)
|
||||
{
|
||||
ModSelect.Hide();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
Loading…
Reference in New Issue
Block a user