Merge branch 'master' into disallow-beatmap-change

This commit is contained in:
Dan Balasescu
2018-06-06 20:26:17 +09:00
committed by GitHub
13 changed files with 140 additions and 105 deletions

View File

@ -8,7 +8,6 @@ using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -17,6 +16,7 @@ using osu.Framework.Input.Bindings;
using osu.Framework.Threading;
using osu.Game.Graphics;
using osu.Game.Input.Bindings;
using osu.Game.Overlays;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Input;
@ -27,9 +27,6 @@ namespace osu.Game.Screens.Menu
{
public event Action<MenuState> StateChanged;
private readonly BindableBool hideOverlaysOnEnter = new BindableBool();
private readonly BindableBool allowOpeningOverlays = new BindableBool();
public Action OnEdit;
public Action OnExit;
public Action OnDirect;
@ -133,15 +130,12 @@ namespace osu.Game.Screens.Menu
buttonFlow.AddRange(buttonsTopLevel);
}
private OsuGame game;
[BackgroundDependencyLoader(true)]
private void load(AudioManager audio, OsuGame game)
{
if (game != null)
{
hideOverlaysOnEnter.BindTo(game.HideOverlaysOnEnter);
allowOpeningOverlays.BindTo(game.AllowOpeningOverlays);
}
this.game = game;
sampleBack = audio.Sample.Get(@"Menu/button-back-select");
}
@ -328,18 +322,18 @@ namespace osu.Game.Screens.Menu
case MenuState.Initial:
logoDelayedAction?.Cancel();
logoDelayedAction = Scheduler.AddDelayed(() =>
{
logoTracking = false;
{
logoTracking = false;
hideOverlaysOnEnter.Value = true;
allowOpeningOverlays.Value = false;
if (game != null)
game.OverlayActivationMode.Value = state == MenuState.Exit ? OverlayActivation.Disabled : OverlayActivation.UserTriggered;
logo.ClearTransforms(targetMember: nameof(Position));
logo.RelativePositionAxes = Axes.Both;
logo.ClearTransforms(targetMember: nameof(Position));
logo.RelativePositionAxes = Axes.Both;
logo.MoveTo(new Vector2(0.5f), 800, Easing.OutExpo);
logo.ScaleTo(1, 800, Easing.OutExpo);
}, buttonArea.Alpha * 150);
logo.MoveTo(new Vector2(0.5f), 800, Easing.OutExpo);
logo.ScaleTo(1, 800, Easing.OutExpo);
}, buttonArea.Alpha * 150);
break;
case MenuState.TopLevel:
case MenuState.Play:
@ -366,8 +360,11 @@ namespace osu.Game.Screens.Menu
if (impact)
logo.Impact();
hideOverlaysOnEnter.Value = false;
allowOpeningOverlays.Value = true;
if (game != null)
{
game.OverlayActivationMode.Value = OverlayActivation.All;
game.Toolbar.State = Visibility.Visible;
}
}, 200);
break;
default:

View File

@ -9,6 +9,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
using osu.Game.Overlays;
namespace osu.Game.Screens.Menu
{
@ -19,7 +20,7 @@ namespace osu.Game.Screens.Menu
private Color4 iconColour;
protected override bool HideOverlaysOnEnter => true;
protected override bool AllowOpeningOverlays => false;
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
public override bool CursorVisible => false;

View File

@ -15,6 +15,7 @@ using osu.Game.IO.Archives;
using osu.Game.Screens.Backgrounds;
using OpenTK;
using OpenTK.Graphics;
using osu.Game.Overlays;
namespace osu.Game.Screens.Menu
{
@ -34,7 +35,7 @@ namespace osu.Game.Screens.Menu
private SampleChannel seeya;
protected override bool HideOverlaysOnEnter => true;
protected override bool AllowOpeningOverlays => false;
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
public override bool CursorVisible => false;

View File

@ -25,7 +25,6 @@ namespace osu.Game.Screens.Menu
private readonly ButtonSystem buttons;
protected override bool HideOverlaysOnEnter => buttons.State == MenuState.Initial;
protected override bool AllowOpeningOverlays => buttons.State != MenuState.Initial;
protected override bool AllowBackButton => buttons.State != MenuState.Initial;

View File

@ -17,6 +17,8 @@ using osu.Game.Rulesets;
using osu.Game.Screens.Menu;
using OpenTK;
using OpenTK.Input;
using osu.Game.Overlays;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Screens
{
@ -39,19 +41,19 @@ namespace osu.Game.Screens
/// </summary>
protected virtual BackgroundScreen CreateBackground() => null;
private readonly BindableBool hideOverlaysOnEnter = new BindableBool();
private Action updateOverlayStates;
/// <summary>
/// Whether overlays should be hidden when this screen is entered or resumed.
/// Whether all overlays should be hidden when this screen is entered or resumed.
/// </summary>
protected virtual bool HideOverlaysOnEnter => false;
private readonly BindableBool allowOpeningOverlays = new BindableBool();
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
/// <summary>
/// Whether overlays should be able to be opened while this screen is active.
/// Whether overlays should be able to be opened once this screen is entered or resumed.
/// </summary>
protected virtual bool AllowOpeningOverlays => true;
protected virtual OverlayActivation InitialOverlayActivationMode => OverlayActivation.All;
/// <summary>
/// Whether this <see cref="OsuScreen"/> allows the cursor to be displayed.
@ -87,8 +89,15 @@ namespace osu.Game.Screens
if (osuGame != null)
{
Ruleset.BindTo(osuGame.Ruleset);
hideOverlaysOnEnter.BindTo(osuGame.HideOverlaysOnEnter);
allowOpeningOverlays.BindTo(osuGame.AllowOpeningOverlays);
OverlayActivationMode.BindTo(osuGame.OverlayActivationMode);
updateOverlayStates = () =>
{
if (HideOverlaysOnEnter)
osuGame.CloseAllOverlays();
else
osuGame.Toolbar.State = Visibility.Visible;
};
}
sampleExit = audio.Sample.Get(@"UI/screen-back");
@ -224,8 +233,9 @@ namespace osu.Game.Screens
if (backgroundParallaxContainer != null)
backgroundParallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * BackgroundParallaxAmount;
hideOverlaysOnEnter.Value = HideOverlaysOnEnter;
allowOpeningOverlays.Value = AllowOpeningOverlays;
OverlayActivationMode.Value = InitialOverlayActivationMode;
updateOverlayStates?.Invoke();
}
private void onExitingLogo()

View File

@ -21,6 +21,7 @@ using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Cursor;
using osu.Game.Online.API;
using osu.Game.Overlays;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
@ -37,6 +38,8 @@ namespace osu.Game.Screens.Play
protected override bool HideOverlaysOnEnter => true;
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.UserTriggered;
public Action RestartRequested;
public bool HasFailed { get; private set; }