mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 13:33:03 +08:00
Merge remote-tracking branch 'upstream/master' into nuget-consumption
This commit is contained in:
commit
ea1336d243
@ -264,7 +264,8 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
|
|
||||||
private string createTemporaryBeatmap()
|
private string createTemporaryBeatmap()
|
||||||
{
|
{
|
||||||
var temp = new FileInfo(osz_path).CopyTo(Path.GetTempFileName(), true).FullName;
|
var temp = Path.GetTempFileName() + ".osz";
|
||||||
|
File.Copy(osz_path, temp, true);
|
||||||
Assert.IsTrue(File.Exists(temp));
|
Assert.IsTrue(File.Exists(temp));
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
@ -344,12 +345,12 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
|
|
||||||
private void waitForOrAssert(Func<bool> result, string failureMessage, int timeout = 60000)
|
private void waitForOrAssert(Func<bool> result, string failureMessage, int timeout = 60000)
|
||||||
{
|
{
|
||||||
Action waitAction = () =>
|
Task task = Task.Run(() =>
|
||||||
{
|
{
|
||||||
while (!result()) Thread.Sleep(200);
|
while (!result()) Thread.Sleep(200);
|
||||||
};
|
});
|
||||||
|
|
||||||
Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout), failureMessage);
|
Assert.IsTrue(task.Wait(timeout), failureMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Containers
|
namespace osu.Game.Graphics.Containers
|
||||||
{
|
{
|
||||||
@ -16,13 +17,13 @@ namespace osu.Game.Graphics.Containers
|
|||||||
private SampleChannel samplePopIn;
|
private SampleChannel samplePopIn;
|
||||||
private SampleChannel samplePopOut;
|
private SampleChannel samplePopOut;
|
||||||
|
|
||||||
private readonly BindableBool allowOpeningOverlays = new BindableBool(true);
|
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(OsuGame osuGame, AudioManager audio)
|
private void load(OsuGame osuGame, AudioManager audio)
|
||||||
{
|
{
|
||||||
if (osuGame != null)
|
if (osuGame != null)
|
||||||
allowOpeningOverlays.BindTo(osuGame.AllowOpeningOverlays);
|
OverlayActivationMode.BindTo(osuGame.OverlayActivationMode);
|
||||||
|
|
||||||
samplePopIn = audio.Sample.Get(@"UI/overlay-pop-in");
|
samplePopIn = audio.Sample.Get(@"UI/overlay-pop-in");
|
||||||
samplePopOut = audio.Sample.Get(@"UI/overlay-pop-out");
|
samplePopOut = audio.Sample.Get(@"UI/overlay-pop-out");
|
||||||
@ -52,20 +53,18 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
private void onStateChanged(Visibility visibility)
|
private void onStateChanged(Visibility visibility)
|
||||||
{
|
{
|
||||||
if (allowOpeningOverlays)
|
switch (visibility)
|
||||||
{
|
{
|
||||||
switch (visibility)
|
case Visibility.Visible:
|
||||||
{
|
if (OverlayActivationMode != OverlayActivation.Disabled)
|
||||||
case Visibility.Visible:
|
|
||||||
samplePopIn?.Play();
|
samplePopIn?.Play();
|
||||||
break;
|
else
|
||||||
case Visibility.Hidden:
|
State = Visibility.Hidden;
|
||||||
samplePopOut?.Play();
|
break;
|
||||||
break;
|
case Visibility.Hidden:
|
||||||
}
|
samplePopOut?.Play();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
State = Visibility.Hidden;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,8 +77,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
public float ToolbarOffset => Toolbar.Position.Y + Toolbar.DrawHeight;
|
public float ToolbarOffset => Toolbar.Position.Y + Toolbar.DrawHeight;
|
||||||
|
|
||||||
public readonly BindableBool HideOverlaysOnEnter = new BindableBool();
|
public readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
|
||||||
public readonly BindableBool AllowOpeningOverlays = new BindableBool(true);
|
|
||||||
|
|
||||||
private OsuScreen screenStack;
|
private OsuScreen screenStack;
|
||||||
|
|
||||||
@ -94,6 +93,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
private SettingsOverlay settings;
|
private SettingsOverlay settings;
|
||||||
|
|
||||||
|
private readonly List<OverlayContainer> overlays = new List<OverlayContainer>();
|
||||||
|
|
||||||
// todo: move this to SongSelect once Screen has the ability to unsuspend.
|
// todo: move this to SongSelect once Screen has the ability to unsuspend.
|
||||||
public readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>(new List<Mod>());
|
public readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>(new List<Mod>());
|
||||||
|
|
||||||
@ -106,6 +107,17 @@ namespace osu.Game
|
|||||||
|
|
||||||
public void ToggleDirect() => direct.ToggleVisibility();
|
public void ToggleDirect() => direct.ToggleVisibility();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Close all game-wide overlays.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="toolbar">Whether the toolbar should also be hidden.</param>
|
||||||
|
public void CloseAllOverlays(bool toolbar = true)
|
||||||
|
{
|
||||||
|
foreach (var o in overlays)
|
||||||
|
o.State = Visibility.Hidden;
|
||||||
|
if (toolbar) Toolbar.State = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
|
||||||
private DependencyContainer dependencies;
|
private DependencyContainer dependencies;
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) =>
|
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) =>
|
||||||
@ -251,7 +263,7 @@ namespace osu.Game
|
|||||||
Depth = -5,
|
Depth = -5,
|
||||||
OnHome = delegate
|
OnHome = delegate
|
||||||
{
|
{
|
||||||
hideAllOverlays();
|
CloseAllOverlays(false);
|
||||||
intro?.ChildScreen?.MakeCurrent();
|
intro?.ChildScreen?.MakeCurrent();
|
||||||
},
|
},
|
||||||
}, overlayContent.Add);
|
}, overlayContent.Add);
|
||||||
@ -308,6 +320,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
// ensure only one of these overlays are open at once.
|
// ensure only one of these overlays are open at once.
|
||||||
var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct };
|
var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct };
|
||||||
|
overlays.AddRange(singleDisplayOverlays);
|
||||||
|
|
||||||
foreach (var overlay in singleDisplayOverlays)
|
foreach (var overlay in singleDisplayOverlays)
|
||||||
{
|
{
|
||||||
overlay.StateChanged += state =>
|
overlay.StateChanged += state =>
|
||||||
@ -323,6 +337,8 @@ namespace osu.Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
var singleDisplaySideOverlays = new OverlayContainer[] { settings, notifications };
|
var singleDisplaySideOverlays = new OverlayContainer[] { settings, notifications };
|
||||||
|
overlays.AddRange(singleDisplaySideOverlays);
|
||||||
|
|
||||||
foreach (var overlay in singleDisplaySideOverlays)
|
foreach (var overlay in singleDisplaySideOverlays)
|
||||||
{
|
{
|
||||||
overlay.StateChanged += state =>
|
overlay.StateChanged += state =>
|
||||||
@ -339,6 +355,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
// eventually informational overlays should be displayed in a stack, but for now let's only allow one to stay open at a time.
|
// eventually informational overlays should be displayed in a stack, but for now let's only allow one to stay open at a time.
|
||||||
var informationalOverlays = new OverlayContainer[] { beatmapSetOverlay, userProfile };
|
var informationalOverlays = new OverlayContainer[] { beatmapSetOverlay, userProfile };
|
||||||
|
overlays.AddRange(informationalOverlays);
|
||||||
|
|
||||||
foreach (var overlay in informationalOverlays)
|
foreach (var overlay in informationalOverlays)
|
||||||
{
|
{
|
||||||
overlay.StateChanged += state =>
|
overlay.StateChanged += state =>
|
||||||
@ -353,6 +371,11 @@ namespace osu.Game
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OverlayActivationMode.ValueChanged += v =>
|
||||||
|
{
|
||||||
|
if (v != OverlayActivation.All) CloseAllOverlays();
|
||||||
|
};
|
||||||
|
|
||||||
void updateScreenOffset()
|
void updateScreenOffset()
|
||||||
{
|
{
|
||||||
float offset = 0;
|
float offset = 0;
|
||||||
@ -367,21 +390,6 @@ namespace osu.Game
|
|||||||
|
|
||||||
settings.StateChanged += _ => updateScreenOffset();
|
settings.StateChanged += _ => updateScreenOffset();
|
||||||
notifications.StateChanged += _ => updateScreenOffset();
|
notifications.StateChanged += _ => updateScreenOffset();
|
||||||
|
|
||||||
notifications.Enabled.BindTo(AllowOpeningOverlays);
|
|
||||||
|
|
||||||
HideOverlaysOnEnter.ValueChanged += hide =>
|
|
||||||
{
|
|
||||||
//central game screen change logic.
|
|
||||||
if (hide)
|
|
||||||
{
|
|
||||||
hideAllOverlays();
|
|
||||||
musicController.State = Visibility.Hidden;
|
|
||||||
Toolbar.State = Visibility.Hidden;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Toolbar.State = Visibility.Visible;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void forwardLoggedErrorsToNotifications()
|
private void forwardLoggedErrorsToNotifications()
|
||||||
@ -498,16 +506,6 @@ namespace osu.Game
|
|||||||
private OsuScreen currentScreen;
|
private OsuScreen currentScreen;
|
||||||
private FrameworkConfigManager frameworkConfig;
|
private FrameworkConfigManager frameworkConfig;
|
||||||
|
|
||||||
private void hideAllOverlays()
|
|
||||||
{
|
|
||||||
settings.State = Visibility.Hidden;
|
|
||||||
chat.State = Visibility.Hidden;
|
|
||||||
direct.State = Visibility.Hidden;
|
|
||||||
social.State = Visibility.Hidden;
|
|
||||||
userProfile.State = Visibility.Hidden;
|
|
||||||
notifications.State = Visibility.Hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnExiting()
|
protected override bool OnExiting()
|
||||||
{
|
{
|
||||||
if (screenStack.ChildScreen == null) return false;
|
if (screenStack.ChildScreen == null) return false;
|
||||||
|
@ -22,11 +22,6 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
public const float TRANSITION_LENGTH = 600;
|
public const float TRANSITION_LENGTH = 600;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether posted notifications should be processed.
|
|
||||||
/// </summary>
|
|
||||||
public readonly BindableBool Enabled = new BindableBool(true);
|
|
||||||
|
|
||||||
private FlowContainer<NotificationSection> sections;
|
private FlowContainer<NotificationSection> sections;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -34,27 +29,6 @@ namespace osu.Game.Overlays
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Func<float> GetToolbarHeight;
|
public Func<float> GetToolbarHeight;
|
||||||
|
|
||||||
public NotificationOverlay()
|
|
||||||
{
|
|
||||||
ScheduledDelegate notificationsEnabler = null;
|
|
||||||
Enabled.ValueChanged += v =>
|
|
||||||
{
|
|
||||||
if (!IsLoaded)
|
|
||||||
{
|
|
||||||
processingPosts = v;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
notificationsEnabler?.Cancel();
|
|
||||||
|
|
||||||
if (v)
|
|
||||||
// we want a slight delay before toggling notifications on to avoid the user becoming overwhelmed.
|
|
||||||
notificationsEnabler = Scheduler.AddDelayed(() => processingPosts = true, 1000);
|
|
||||||
else
|
|
||||||
processingPosts = false;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
@ -103,6 +77,29 @@ namespace osu.Game.Overlays
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ScheduledDelegate notificationsEnabler;
|
||||||
|
private void updateProcessingMode()
|
||||||
|
{
|
||||||
|
bool enabled = OverlayActivationMode == OverlayActivation.All || State == Visibility.Visible;
|
||||||
|
|
||||||
|
notificationsEnabler?.Cancel();
|
||||||
|
|
||||||
|
if (enabled)
|
||||||
|
// we want a slight delay before toggling notifications on to avoid the user becoming overwhelmed.
|
||||||
|
notificationsEnabler = Scheduler.AddDelayed(() => processingPosts = true, State == Visibility.Visible ? 0 : 1000);
|
||||||
|
else
|
||||||
|
processingPosts = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
StateChanged += _ => updateProcessingMode();
|
||||||
|
OverlayActivationMode.ValueChanged += _ => updateProcessingMode();
|
||||||
|
OverlayActivationMode.TriggerChange();
|
||||||
|
}
|
||||||
|
|
||||||
private int totalCount => sections.Select(c => c.DisplayedCount).Sum();
|
private int totalCount => sections.Select(c => c.DisplayedCount).Sum();
|
||||||
private int unreadCount => sections.Select(c => c.UnreadCount).Sum();
|
private int unreadCount => sections.Select(c => c.UnreadCount).Sum();
|
||||||
|
|
||||||
|
12
osu.Game/Overlays/OverlayActivation.cs
Normal file
12
osu.Game/Overlays/OverlayActivation.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays
|
||||||
|
{
|
||||||
|
public enum OverlayActivation
|
||||||
|
{
|
||||||
|
Disabled,
|
||||||
|
UserTriggered,
|
||||||
|
All
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,8 @@ using osu.Framework.Input;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
namespace osu.Game.Overlays.Toolbar
|
||||||
{
|
{
|
||||||
@ -29,6 +31,8 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
private const float alpha_hovering = 0.8f;
|
private const float alpha_hovering = 0.8f;
|
||||||
private const float alpha_normal = 0.6f;
|
private const float alpha_normal = 0.6f;
|
||||||
|
|
||||||
|
private readonly Bindable<OverlayActivation> overlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
|
||||||
|
|
||||||
public Toolbar()
|
public Toolbar()
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -76,6 +80,19 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
Size = new Vector2(1, HEIGHT);
|
Size = new Vector2(1, HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader(true)]
|
||||||
|
private void load(OsuGame osuGame)
|
||||||
|
{
|
||||||
|
if (osuGame != null)
|
||||||
|
overlayActivationMode.BindTo(osuGame.OverlayActivationMode);
|
||||||
|
|
||||||
|
StateChanged += visibility =>
|
||||||
|
{
|
||||||
|
if (overlayActivationMode == OverlayActivation.Disabled)
|
||||||
|
State = Visibility.Hidden;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public class ToolbarBackground : Container
|
public class ToolbarBackground : Container
|
||||||
{
|
{
|
||||||
private readonly Box solidBackground;
|
private readonly Box solidBackground;
|
||||||
|
@ -8,7 +8,6 @@ using osu.Framework;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
@ -17,6 +16,7 @@ using osu.Framework.Input.Bindings;
|
|||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
|
using osu.Game.Overlays;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
@ -27,9 +27,6 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
public event Action<MenuState> StateChanged;
|
public event Action<MenuState> StateChanged;
|
||||||
|
|
||||||
private readonly BindableBool hideOverlaysOnEnter = new BindableBool();
|
|
||||||
private readonly BindableBool allowOpeningOverlays = new BindableBool();
|
|
||||||
|
|
||||||
public Action OnEdit;
|
public Action OnEdit;
|
||||||
public Action OnExit;
|
public Action OnExit;
|
||||||
public Action OnDirect;
|
public Action OnDirect;
|
||||||
@ -133,15 +130,12 @@ namespace osu.Game.Screens.Menu
|
|||||||
buttonFlow.AddRange(buttonsTopLevel);
|
buttonFlow.AddRange(buttonsTopLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private OsuGame game;
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(AudioManager audio, OsuGame game)
|
private void load(AudioManager audio, OsuGame game)
|
||||||
{
|
{
|
||||||
if (game != null)
|
this.game = game;
|
||||||
{
|
|
||||||
hideOverlaysOnEnter.BindTo(game.HideOverlaysOnEnter);
|
|
||||||
allowOpeningOverlays.BindTo(game.AllowOpeningOverlays);
|
|
||||||
}
|
|
||||||
|
|
||||||
sampleBack = audio.Sample.Get(@"Menu/button-back-select");
|
sampleBack = audio.Sample.Get(@"Menu/button-back-select");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,18 +322,18 @@ namespace osu.Game.Screens.Menu
|
|||||||
case MenuState.Initial:
|
case MenuState.Initial:
|
||||||
logoDelayedAction?.Cancel();
|
logoDelayedAction?.Cancel();
|
||||||
logoDelayedAction = Scheduler.AddDelayed(() =>
|
logoDelayedAction = Scheduler.AddDelayed(() =>
|
||||||
{
|
{
|
||||||
logoTracking = false;
|
logoTracking = false;
|
||||||
|
|
||||||
hideOverlaysOnEnter.Value = true;
|
if (game != null)
|
||||||
allowOpeningOverlays.Value = false;
|
game.OverlayActivationMode.Value = state == MenuState.Exit ? OverlayActivation.Disabled : OverlayActivation.UserTriggered;
|
||||||
|
|
||||||
logo.ClearTransforms(targetMember: nameof(Position));
|
logo.ClearTransforms(targetMember: nameof(Position));
|
||||||
logo.RelativePositionAxes = Axes.Both;
|
logo.RelativePositionAxes = Axes.Both;
|
||||||
|
|
||||||
logo.MoveTo(new Vector2(0.5f), 800, Easing.OutExpo);
|
logo.MoveTo(new Vector2(0.5f), 800, Easing.OutExpo);
|
||||||
logo.ScaleTo(1, 800, Easing.OutExpo);
|
logo.ScaleTo(1, 800, Easing.OutExpo);
|
||||||
}, buttonArea.Alpha * 150);
|
}, buttonArea.Alpha * 150);
|
||||||
break;
|
break;
|
||||||
case MenuState.TopLevel:
|
case MenuState.TopLevel:
|
||||||
case MenuState.Play:
|
case MenuState.Play:
|
||||||
@ -366,8 +360,11 @@ namespace osu.Game.Screens.Menu
|
|||||||
if (impact)
|
if (impact)
|
||||||
logo.Impact();
|
logo.Impact();
|
||||||
|
|
||||||
hideOverlaysOnEnter.Value = false;
|
if (game != null)
|
||||||
allowOpeningOverlays.Value = true;
|
{
|
||||||
|
game.OverlayActivationMode.Value = OverlayActivation.All;
|
||||||
|
game.Toolbar.State = Visibility.Visible;
|
||||||
|
}
|
||||||
}, 200);
|
}, 200);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -9,6 +9,7 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Menu
|
namespace osu.Game.Screens.Menu
|
||||||
{
|
{
|
||||||
@ -19,7 +20,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
private Color4 iconColour;
|
private Color4 iconColour;
|
||||||
|
|
||||||
protected override bool HideOverlaysOnEnter => true;
|
protected override bool HideOverlaysOnEnter => true;
|
||||||
protected override bool AllowOpeningOverlays => false;
|
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
||||||
|
|
||||||
public override bool CursorVisible => false;
|
public override bool CursorVisible => false;
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ using osu.Game.IO.Archives;
|
|||||||
using osu.Game.Screens.Backgrounds;
|
using osu.Game.Screens.Backgrounds;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Menu
|
namespace osu.Game.Screens.Menu
|
||||||
{
|
{
|
||||||
@ -32,7 +33,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
private SampleChannel seeya;
|
private SampleChannel seeya;
|
||||||
|
|
||||||
protected override bool HideOverlaysOnEnter => true;
|
protected override bool HideOverlaysOnEnter => true;
|
||||||
protected override bool AllowOpeningOverlays => false;
|
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
||||||
|
|
||||||
public override bool CursorVisible => false;
|
public override bool CursorVisible => false;
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ namespace osu.Game.Screens.Menu
|
|||||||
private readonly ButtonSystem buttons;
|
private readonly ButtonSystem buttons;
|
||||||
|
|
||||||
protected override bool HideOverlaysOnEnter => 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;
|
protected override bool AllowBackButton => buttons.State != MenuState.Initial;
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ using osu.Game.Rulesets;
|
|||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
|
||||||
namespace osu.Game.Screens
|
namespace osu.Game.Screens
|
||||||
{
|
{
|
||||||
@ -40,19 +42,19 @@ namespace osu.Game.Screens
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual BackgroundScreen CreateBackground() => null;
|
protected virtual BackgroundScreen CreateBackground() => null;
|
||||||
|
|
||||||
private readonly BindableBool hideOverlaysOnEnter = new BindableBool();
|
private Action updateOverlayStates;
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
protected virtual bool HideOverlaysOnEnter => false;
|
protected virtual bool HideOverlaysOnEnter => false;
|
||||||
|
|
||||||
private readonly BindableBool allowOpeningOverlays = new BindableBool();
|
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
protected virtual bool AllowOpeningOverlays => true;
|
protected virtual OverlayActivation InitialOverlayActivationMode => OverlayActivation.All;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this <see cref="OsuScreen"/> allows the cursor to be displayed.
|
/// Whether this <see cref="OsuScreen"/> allows the cursor to be displayed.
|
||||||
@ -103,8 +105,15 @@ namespace osu.Game.Screens
|
|||||||
if (osuGame != null)
|
if (osuGame != null)
|
||||||
{
|
{
|
||||||
Ruleset.BindTo(osuGame.Ruleset);
|
Ruleset.BindTo(osuGame.Ruleset);
|
||||||
hideOverlaysOnEnter.BindTo(osuGame.HideOverlaysOnEnter);
|
OverlayActivationMode.BindTo(osuGame.OverlayActivationMode);
|
||||||
allowOpeningOverlays.BindTo(osuGame.AllowOpeningOverlays);
|
|
||||||
|
updateOverlayStates = () =>
|
||||||
|
{
|
||||||
|
if (HideOverlaysOnEnter)
|
||||||
|
osuGame.CloseAllOverlays();
|
||||||
|
else
|
||||||
|
osuGame.Toolbar.State = Visibility.Visible;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
sampleExit = audio.Sample.Get(@"UI/screen-back");
|
sampleExit = audio.Sample.Get(@"UI/screen-back");
|
||||||
@ -240,8 +249,9 @@ namespace osu.Game.Screens
|
|||||||
if (backgroundParallaxContainer != null)
|
if (backgroundParallaxContainer != null)
|
||||||
backgroundParallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * BackgroundParallaxAmount;
|
backgroundParallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * BackgroundParallaxAmount;
|
||||||
|
|
||||||
hideOverlaysOnEnter.Value = HideOverlaysOnEnter;
|
OverlayActivationMode.Value = InitialOverlayActivationMode;
|
||||||
allowOpeningOverlays.Value = AllowOpeningOverlays;
|
|
||||||
|
updateOverlayStates?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onExitingLogo()
|
private void onExitingLogo()
|
||||||
|
@ -21,6 +21,7 @@ using osu.Game.Configuration;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
@ -37,6 +38,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
protected override bool HideOverlaysOnEnter => true;
|
protected override bool HideOverlaysOnEnter => true;
|
||||||
|
|
||||||
|
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.UserTriggered;
|
||||||
|
|
||||||
public Action RestartRequested;
|
public Action RestartRequested;
|
||||||
|
|
||||||
public bool HasFailed { get; private set; }
|
public bool HasFailed { get; private set; }
|
||||||
|
Loading…
Reference in New Issue
Block a user