mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:47:26 +08:00
Merge branch 'master' into fix-main-menu-escape
This commit is contained in:
commit
99163ca8ba
@ -1 +1 @@
|
||||
Subproject commit fac688633b8fcf34ae5d0514c26b03e217161eb4
|
||||
Subproject commit eb076a3301231eb73917073499051e49a9b12978
|
57
osu.Game.Tests/Visual/TestCaseQuitButton.cs
Normal file
57
osu.Game.Tests/Visual/TestCaseQuitButton.cs
Normal file
@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
[Description("'Hold to Quit' UI element")]
|
||||
public class TestCaseQuitButton : ManualInputManagerTestCase
|
||||
{
|
||||
private bool exitAction;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
QuitButton quitButton;
|
||||
|
||||
Add(quitButton = new QuitButton
|
||||
{
|
||||
Origin = Anchor.BottomRight,
|
||||
Anchor = Anchor.BottomRight,
|
||||
Action = () => exitAction = true
|
||||
});
|
||||
|
||||
var text = quitButton.Children.OfType<SpriteText>().First();
|
||||
|
||||
// initial display
|
||||
AddUntilStep(() => text.IsPresent && !exitAction, "Text visible");
|
||||
AddUntilStep(() => !text.IsPresent && !exitAction, "Text is not visible");
|
||||
|
||||
AddStep("Trigger text fade in", () => InputManager.MoveMouseTo(quitButton));
|
||||
AddUntilStep(() => text.IsPresent && !exitAction, "Text visible");
|
||||
AddStep("Trigger text fade out", () => InputManager.MoveMouseTo(Vector2.One));
|
||||
AddUntilStep(() => !text.IsPresent && !exitAction, "Text is not visible");
|
||||
|
||||
AddStep("Trigger exit action", () =>
|
||||
{
|
||||
exitAction = false;
|
||||
InputManager.MoveMouseTo(quitButton);
|
||||
InputManager.ButtonDown(MouseButton.Left);
|
||||
});
|
||||
|
||||
AddStep("Early release", () => InputManager.ButtonUp(MouseButton.Left));
|
||||
AddAssert("action not triggered", () => !exitAction);
|
||||
|
||||
AddStep("Trigger exit action", () => InputManager.ButtonDown(MouseButton.Left));
|
||||
AddUntilStep(() => exitAction, $"{nameof(quitButton.Action)} was triggered");
|
||||
}
|
||||
}
|
||||
}
|
52
osu.Game/Graphics/Containers/HoldToConfirmContainer.cs
Normal file
52
osu.Game/Graphics/Containers/HoldToConfirmContainer.cs
Normal file
@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
public abstract class HoldToConfirmContainer : Container
|
||||
{
|
||||
public Action Action;
|
||||
|
||||
private const int activate_delay = 400;
|
||||
private const int fadeout_delay = 200;
|
||||
|
||||
private bool fired;
|
||||
private bool confirming;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the overlay should be allowed to return from a fired state.
|
||||
/// </summary>
|
||||
protected virtual bool AllowMultipleFires => false;
|
||||
|
||||
public Bindable<double> Progress = new BindableDouble();
|
||||
|
||||
protected void BeginConfirm()
|
||||
{
|
||||
if (confirming || !AllowMultipleFires && fired) return;
|
||||
|
||||
confirming = true;
|
||||
|
||||
this.TransformBindableTo(Progress, 1, activate_delay * (1 - Progress.Value), Easing.Out).OnComplete(_ => Confirm());
|
||||
}
|
||||
|
||||
protected virtual void Confirm()
|
||||
{
|
||||
Action?.Invoke();
|
||||
fired = true;
|
||||
}
|
||||
|
||||
protected void AbortConfirm()
|
||||
{
|
||||
if (!AllowMultipleFires && fired) return;
|
||||
|
||||
confirming = false;
|
||||
|
||||
this.TransformBindableTo(Progress, 0, fadeout_delay, Easing.Out);
|
||||
}
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input;
|
||||
using OpenTK;
|
||||
using osu.Framework.Configuration;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
@ -15,9 +16,14 @@ namespace osu.Game.Graphics.Containers
|
||||
private SampleChannel samplePopIn;
|
||||
private SampleChannel samplePopOut;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
private readonly BindableBool allowOpeningOverlays = new BindableBool(true);
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuGame osuGame, AudioManager audio)
|
||||
{
|
||||
if (osuGame != null)
|
||||
allowOpeningOverlays.BindTo(osuGame.AllowOpeningOverlays);
|
||||
|
||||
samplePopIn = audio.Sample.Get(@"UI/overlay-pop-in");
|
||||
samplePopOut = audio.Sample.Get(@"UI/overlay-pop-out");
|
||||
|
||||
@ -46,15 +52,20 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
private void onStateChanged(Visibility visibility)
|
||||
{
|
||||
switch (visibility)
|
||||
if (allowOpeningOverlays)
|
||||
{
|
||||
case Visibility.Visible:
|
||||
samplePopIn?.Play();
|
||||
break;
|
||||
case Visibility.Hidden:
|
||||
samplePopOut?.Play();
|
||||
break;
|
||||
switch (visibility)
|
||||
{
|
||||
case Visibility.Visible:
|
||||
samplePopIn?.Play();
|
||||
break;
|
||||
case Visibility.Hidden:
|
||||
samplePopOut?.Play();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
State = Visibility.Hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,8 @@ namespace osu.Game
|
||||
|
||||
public float ToolbarOffset => Toolbar.Position.Y + Toolbar.DrawHeight;
|
||||
|
||||
public readonly BindableBool ShowOverlays = new BindableBool();
|
||||
public readonly BindableBool HideOverlaysOnEnter = new BindableBool();
|
||||
public readonly BindableBool AllowOpeningOverlays = new BindableBool(true);
|
||||
|
||||
private OsuScreen screenStack;
|
||||
|
||||
@ -367,12 +368,12 @@ namespace osu.Game
|
||||
settings.StateChanged += _ => updateScreenOffset();
|
||||
notifications.StateChanged += _ => updateScreenOffset();
|
||||
|
||||
notifications.Enabled.BindTo(ShowOverlays);
|
||||
notifications.Enabled.BindTo(AllowOpeningOverlays);
|
||||
|
||||
ShowOverlays.ValueChanged += show =>
|
||||
HideOverlaysOnEnter.ValueChanged += hide =>
|
||||
{
|
||||
//central game screen change logic.
|
||||
if (!show)
|
||||
if (hide)
|
||||
{
|
||||
hideAllOverlays();
|
||||
musicController.State = Visibility.Hidden;
|
||||
|
@ -1,11 +1,10 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
@ -14,22 +13,10 @@ namespace osu.Game.Overlays
|
||||
/// An overlay which will display a black screen that dims over a period before confirming an exit action.
|
||||
/// Action is BYO (derived class will need to call <see cref="BeginConfirm"/> and <see cref="AbortConfirm"/> from a user event).
|
||||
/// </summary>
|
||||
public abstract class HoldToConfirmOverlay : Container
|
||||
public abstract class HoldToConfirmOverlay : HoldToConfirmContainer
|
||||
{
|
||||
public Action Action;
|
||||
|
||||
private Box overlay;
|
||||
|
||||
private const int activate_delay = 400;
|
||||
private const int fadeout_delay = 200;
|
||||
|
||||
private bool fired;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the overlay should be allowed to return from a fired state.
|
||||
/// </summary>
|
||||
protected virtual bool AllowMultipleFires => false;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
@ -45,22 +32,8 @@ namespace osu.Game.Overlays
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected void BeginConfirm()
|
||||
{
|
||||
if (!AllowMultipleFires && fired) return;
|
||||
overlay.FadeIn(activate_delay * (1 - overlay.Alpha), Easing.Out).OnComplete(_ =>
|
||||
{
|
||||
Action?.Invoke();
|
||||
fired = true;
|
||||
});
|
||||
}
|
||||
|
||||
protected void AbortConfirm()
|
||||
{
|
||||
if (!AllowMultipleFires && fired) return;
|
||||
overlay.FadeOut(fadeout_delay, Easing.Out);
|
||||
Progress.ValueChanged += v => overlay.Alpha = (float)v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
|
||||
|
||||
public override bool ShowOverlaysOnEnter => false;
|
||||
protected override bool HideOverlaysOnEnter => true;
|
||||
public override bool AllowBeatmapRulesetChange => false;
|
||||
|
||||
private Box bottomBackground;
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Screens
|
||||
{
|
||||
private bool showDisclaimer;
|
||||
|
||||
public override bool ShowOverlaysOnEnter => false;
|
||||
protected override bool HideOverlaysOnEnter => true;
|
||||
|
||||
protected override bool AllowBackButton => false;
|
||||
|
||||
|
@ -27,7 +27,8 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
public event Action<MenuState> StateChanged;
|
||||
|
||||
private readonly BindableBool showOverlays = new BindableBool();
|
||||
private readonly BindableBool hideOverlaysOnEnter = new BindableBool();
|
||||
private readonly BindableBool allowOpeningOverlays = new BindableBool();
|
||||
|
||||
public Action OnEdit;
|
||||
public Action OnExit;
|
||||
@ -135,7 +136,12 @@ namespace osu.Game.Screens.Menu
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(AudioManager audio, OsuGame game)
|
||||
{
|
||||
if (game != null) showOverlays.BindTo(game.ShowOverlays);
|
||||
if (game != null)
|
||||
{
|
||||
hideOverlaysOnEnter.BindTo(game.HideOverlaysOnEnter);
|
||||
allowOpeningOverlays.BindTo(game.AllowOpeningOverlays);
|
||||
}
|
||||
|
||||
sampleBack = audio.Sample.Get(@"Menu/button-back-select");
|
||||
}
|
||||
|
||||
@ -329,8 +335,6 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
logoDelayedAction = Scheduler.AddDelayed(() =>
|
||||
{
|
||||
showOverlays.Value = false;
|
||||
|
||||
logo.ClearTransforms(targetMember: nameof(Position));
|
||||
logo.RelativePositionAxes = Axes.Both;
|
||||
|
||||
@ -358,7 +362,8 @@ namespace osu.Game.Screens.Menu
|
||||
logoTracking = true;
|
||||
|
||||
logo.Impact();
|
||||
showOverlays.Value = true;
|
||||
hideOverlaysOnEnter.Value = false;
|
||||
allowOpeningOverlays.Value = true;
|
||||
}, 200);
|
||||
break;
|
||||
default:
|
||||
|
@ -18,7 +18,8 @@ namespace osu.Game.Screens.Menu
|
||||
private readonly SpriteIcon icon;
|
||||
private Color4 iconColour;
|
||||
|
||||
public override bool ShowOverlaysOnEnter => false;
|
||||
protected override bool HideOverlaysOnEnter => true;
|
||||
|
||||
public override bool CursorVisible => false;
|
||||
|
||||
public Disclaimer()
|
||||
|
@ -31,7 +31,9 @@ namespace osu.Game.Screens.Menu
|
||||
private SampleChannel welcome;
|
||||
private SampleChannel seeya;
|
||||
|
||||
public override bool ShowOverlaysOnEnter => false;
|
||||
protected override bool HideOverlaysOnEnter => true;
|
||||
protected override bool AllowOpeningOverlays => false;
|
||||
|
||||
public override bool CursorVisible => false;
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenEmpty();
|
||||
|
@ -24,7 +24,8 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
private readonly ButtonSystem buttons;
|
||||
|
||||
public override bool ShowOverlaysOnEnter => buttons.State != MenuState.Initial;
|
||||
protected override bool HideOverlaysOnEnter => buttons.State == MenuState.Initial;
|
||||
protected override bool AllowOpeningOverlays => buttons.State != MenuState.Initial;
|
||||
|
||||
protected override bool AllowBackButton => buttons.State != MenuState.Initial;
|
||||
|
||||
|
@ -32,12 +32,19 @@ namespace osu.Game.Screens
|
||||
/// </summary>
|
||||
protected virtual BackgroundScreen CreateBackground() => null;
|
||||
|
||||
protected BindableBool ShowOverlays = new BindableBool();
|
||||
private readonly BindableBool hideOverlaysOnEnter = new BindableBool();
|
||||
|
||||
/// <summary>
|
||||
/// Whether overlays should be shown when this screen is entered or resumed.
|
||||
/// Whether overlays should be hidden when this screen is entered or resumed.
|
||||
/// </summary>
|
||||
public virtual bool ShowOverlaysOnEnter => true;
|
||||
protected virtual bool HideOverlaysOnEnter => hideOverlaysOnEnter;
|
||||
|
||||
private readonly BindableBool allowOpeningOverlays = new BindableBool();
|
||||
|
||||
/// <summary>
|
||||
/// Whether overlays should be able to be opened while this screen is active.
|
||||
/// </summary>
|
||||
protected virtual bool AllowOpeningOverlays => allowOpeningOverlays;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this <see cref="OsuScreen"/> allows the cursor to be displayed.
|
||||
@ -88,7 +95,8 @@ namespace osu.Game.Screens
|
||||
if (osuGame != null)
|
||||
{
|
||||
Ruleset.BindTo(osuGame.Ruleset);
|
||||
ShowOverlays.BindTo(osuGame.ShowOverlays);
|
||||
hideOverlaysOnEnter.BindTo(osuGame.HideOverlaysOnEnter);
|
||||
allowOpeningOverlays.BindTo(osuGame.AllowOpeningOverlays);
|
||||
}
|
||||
|
||||
sampleExit = audio.Sample.Get(@"UI/screen-back");
|
||||
@ -220,7 +228,8 @@ namespace osu.Game.Screens
|
||||
if (backgroundParallaxContainer != null)
|
||||
backgroundParallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * BackgroundParallaxAmount;
|
||||
|
||||
ShowOverlays.Value = ShowOverlaysOnEnter;
|
||||
hideOverlaysOnEnter.Value = HideOverlaysOnEnter;
|
||||
allowOpeningOverlays.Value = AllowOpeningOverlays;
|
||||
}
|
||||
|
||||
private void onExitingLogo()
|
||||
|
198
osu.Game/Screens/Play/HUD/QuitButton.cs
Normal file
198
osu.Game/Screens/Play/HUD/QuitButton.cs
Normal file
@ -0,0 +1,198 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public class QuitButton : FillFlowContainer
|
||||
{
|
||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
|
||||
|
||||
private readonly Button button;
|
||||
|
||||
public Action Action
|
||||
{
|
||||
set => button.Action = value;
|
||||
}
|
||||
|
||||
private readonly OsuSpriteText text;
|
||||
|
||||
public QuitButton()
|
||||
{
|
||||
Direction = FillDirection.Horizontal;
|
||||
Spacing = new Vector2(20, 0);
|
||||
Margin = new MarginPadding(10);
|
||||
Children = new Drawable[]
|
||||
{
|
||||
text = new OsuSpriteText
|
||||
{
|
||||
Text = "hold for menu",
|
||||
Font = @"Exo2.0-Bold",
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft
|
||||
},
|
||||
button = new Button
|
||||
{
|
||||
HoverGained = () => text.FadeIn(500, Easing.OutQuint),
|
||||
HoverLost = () => text.FadeOut(500, Easing.OutQuint)
|
||||
}
|
||||
};
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
text.FadeInFromZero(500, Easing.OutQuint).Delay(1500).FadeOut(500, Easing.OutQuint);
|
||||
base.LoadComplete();
|
||||
}
|
||||
|
||||
private float positionalAdjust;
|
||||
|
||||
protected override bool OnMouseMove(InputState state)
|
||||
{
|
||||
positionalAdjust = Vector2.Distance(state.Mouse.NativeState.Position, button.ScreenSpaceDrawQuad.Centre) / 200;
|
||||
return base.OnMouseMove(state);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (text.Alpha > 0 || button.Progress.Value > 0 || button.IsHovered)
|
||||
Alpha = 1;
|
||||
else
|
||||
Alpha = Interpolation.ValueAt(
|
||||
MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 1000),
|
||||
Alpha, MathHelper.Clamp(1 - positionalAdjust, 0.04f, 1), 0, 200, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private class Button : HoldToConfirmContainer
|
||||
{
|
||||
private SpriteIcon icon;
|
||||
private CircularProgress circularProgress;
|
||||
private Circle overlayCircle;
|
||||
|
||||
protected override bool AllowMultipleFires => true;
|
||||
|
||||
public Action HoverGained;
|
||||
public Action HoverLost;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Size = new Vector2(60);
|
||||
|
||||
Child = new CircularContainer
|
||||
{
|
||||
Masking = true,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colours.Gray1,
|
||||
Alpha = 0.5f,
|
||||
},
|
||||
circularProgress = new CircularProgress
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
InnerRadius = 1
|
||||
},
|
||||
overlayCircle = new Circle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colours.Gray1,
|
||||
Size = new Vector2(0.9f),
|
||||
},
|
||||
icon = new SpriteIcon
|
||||
{
|
||||
Shadow = false,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(15),
|
||||
Icon = FontAwesome.fa_close
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
bind();
|
||||
}
|
||||
|
||||
private void bind()
|
||||
{
|
||||
circularProgress.Current.BindTo(Progress);
|
||||
Progress.ValueChanged += v => icon.Scale = new Vector2(1 + (float)v * 0.2f);
|
||||
}
|
||||
|
||||
private bool pendingAnimation;
|
||||
|
||||
protected override void Confirm()
|
||||
{
|
||||
base.Confirm();
|
||||
|
||||
// temporarily unbind as to not look weird if releasing during confirm animation (can see the unwind of progress).
|
||||
Progress.UnbindAll();
|
||||
|
||||
// avoid starting a new confirm call until we finish animating.
|
||||
pendingAnimation = true;
|
||||
|
||||
Progress.Value = 0;
|
||||
|
||||
overlayCircle.ScaleTo(0, 100)
|
||||
.Then().FadeOut().ScaleTo(1).FadeIn(500)
|
||||
.OnComplete(a =>
|
||||
{
|
||||
icon.ScaleTo(1, 100);
|
||||
circularProgress.FadeOut(100).OnComplete(_ =>
|
||||
{
|
||||
bind();
|
||||
|
||||
circularProgress.FadeIn();
|
||||
pendingAnimation = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
{
|
||||
HoverGained?.Invoke();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
{
|
||||
HoverLost?.Invoke();
|
||||
base.OnHoverLost(state);
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
{
|
||||
if (!pendingAnimation && state.Mouse.Buttons.Count == 1)
|
||||
BeginConfirm();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
|
||||
{
|
||||
if (state.Mouse.Buttons.Count == 0)
|
||||
AbortConfirm();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -34,6 +34,7 @@ namespace osu.Game.Screens.Play
|
||||
public readonly HealthDisplay HealthDisplay;
|
||||
public readonly SongProgress Progress;
|
||||
public readonly ModDisplay ModDisplay;
|
||||
public readonly QuitButton HoldToQuit;
|
||||
public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
|
||||
|
||||
private Bindable<bool> showHud;
|
||||
@ -51,14 +52,26 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
KeyCounter = CreateKeyCounter(),
|
||||
ComboCounter = CreateComboCounter(),
|
||||
ScoreCounter = CreateScoreCounter(),
|
||||
AccuracyCounter = CreateAccuracyCounter(),
|
||||
HealthDisplay = CreateHealthDisplay(),
|
||||
Progress = CreateProgress(),
|
||||
ModDisplay = CreateModsContainer(),
|
||||
PlayerSettingsOverlay = CreatePlayerSettingsOverlay()
|
||||
PlayerSettingsOverlay = CreatePlayerSettingsOverlay(),
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
Position = -new Vector2(5, TwoLayerButton.SIZE_RETRACTED.Y),
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
KeyCounter = CreateKeyCounter(),
|
||||
HoldToQuit = CreateQuitButton(),
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -187,7 +200,6 @@ namespace osu.Game.Screens.Play
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
Margin = new MarginPadding(10),
|
||||
Y = -TwoLayerButton.SIZE_RETRACTED.Y,
|
||||
};
|
||||
|
||||
protected virtual ScoreCounter CreateScoreCounter() => new ScoreCounter(6)
|
||||
@ -205,6 +217,12 @@ namespace osu.Game.Screens.Play
|
||||
RelativeSizeAxes = Axes.X,
|
||||
};
|
||||
|
||||
protected virtual QuitButton CreateQuitButton() => new QuitButton
|
||||
{
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
};
|
||||
|
||||
protected virtual ModDisplay CreateModsContainer() => new ModDisplay
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
protected override float BackgroundParallaxAmount => 0.1f;
|
||||
|
||||
public override bool ShowOverlaysOnEnter => false;
|
||||
protected override bool HideOverlaysOnEnter => true;
|
||||
|
||||
public Action RestartRequested;
|
||||
|
||||
@ -183,6 +183,7 @@ namespace osu.Game.Screens.Play
|
||||
ProcessCustomClock = false,
|
||||
Breaks = beatmap.Breaks
|
||||
},
|
||||
RulesetContainer.Cursor?.CreateProxy() ?? new Container(),
|
||||
hudOverlay = new HUDOverlay(scoreProcessor, RulesetContainer, working, offsetClock, adjustableClock)
|
||||
{
|
||||
Clock = Clock, // hud overlay doesn't want to use the audio clock directly
|
||||
@ -190,7 +191,6 @@ namespace osu.Game.Screens.Play
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
},
|
||||
RulesetContainer.Cursor?.CreateProxy() ?? new Container(),
|
||||
new SkipOverlay(firstObjectTime)
|
||||
{
|
||||
Clock = Clock, // skip button doesn't want to use the audio clock directly
|
||||
@ -219,6 +219,8 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
};
|
||||
|
||||
hudOverlay.HoldToQuit.Action = Exit;
|
||||
|
||||
if (ShowStoryboard)
|
||||
initializeStoryboard(false);
|
||||
|
||||
|
@ -25,8 +25,8 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private BeatmapMetadataDisplay info;
|
||||
|
||||
private bool showOverlays = true;
|
||||
public override bool ShowOverlaysOnEnter => showOverlays;
|
||||
private bool hideOverlays;
|
||||
protected override bool HideOverlaysOnEnter => hideOverlays;
|
||||
|
||||
private Task loadTask;
|
||||
|
||||
@ -36,7 +36,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
player.RestartRequested = () =>
|
||||
{
|
||||
showOverlays = false;
|
||||
hideOverlays = true;
|
||||
ValidForResume = true;
|
||||
};
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Screens.Tournament
|
||||
{
|
||||
private const string results_filename = "drawings_results.txt";
|
||||
|
||||
public override bool ShowOverlaysOnEnter => false;
|
||||
protected override bool HideOverlaysOnEnter => true;
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user