Merge branch 'master' into confine-during-gameplay

# Conflicts:
#	osu.Game/Configuration/OsuConfigManager.cs
#	osu.Game/OsuGame.cs
#	osu.Game/Screens/Play/Player.cs
This commit is contained in:
Shane Woolcock
2020-10-05 10:23:37 +10:30
682 changed files with 14204 additions and 4174 deletions

View File

@ -31,6 +31,7 @@ using osu.Framework.Input.Events;
using osu.Framework.Platform;
using osu.Framework.Threading;
using osu.Game.Beatmaps;
using osu.Game.Collections;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
@ -38,6 +39,7 @@ using osu.Game.Input;
using osu.Game.Overlays.Notifications;
using osu.Game.Input.Bindings;
using osu.Game.Online.Chat;
using osu.Game.Overlays.Music;
using osu.Game.Skinning;
using osuTK.Graphics;
using osu.Game.Overlays.Volume;
@ -90,7 +92,10 @@ namespace osu.Game
private ConfineMouseTracker confineMouseTracker;
public readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
/// <summary>
/// Whether overlays should be able to be opened game-wide. Value is sourced from the current active screen.
/// </summary>
public readonly IBindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
protected OsuScreenStack ScreenStack;
@ -427,23 +432,7 @@ namespace osu.Game
updateModDefaults();
var newBeatmap = beatmap.NewValue;
if (newBeatmap != null)
{
newBeatmap.Track.Completed += () => Scheduler.AddOnce(() => trackCompleted(newBeatmap));
newBeatmap.BeginAsyncLoad();
}
void trackCompleted(WorkingBeatmap b)
{
// the source of track completion is the audio thread, so the beatmap may have changed before firing.
if (Beatmap.Value != b)
return;
if (!Beatmap.Value.Track.Looping && !Beatmap.Disabled)
MusicController.NextTrack();
}
beatmap.NewValue?.BeginAsyncLoad();
}
private void modsChanged(ValueChangedEvent<IReadOnlyList<Mod>> mods)
@ -619,8 +608,6 @@ namespace osu.Game
loadComponentSingleFile(new OnScreenDisplay(), Add, true);
loadComponentSingleFile(MusicController = new MusicController(), Add, true);
loadComponentSingleFile(notifications.With(d =>
{
d.GetToolbarHeight = () => ToolbarOffset;
@ -628,12 +615,19 @@ namespace osu.Game
d.Origin = Anchor.TopRight;
}), rightFloatingOverlayContent.Add, true);
loadComponentSingleFile(new CollectionManager(Storage)
{
PostNotification = n => notifications.Post(n),
GetStableStorage = GetStorageForStableInstall
}, Add, true);
loadComponentSingleFile(screenshotManager, Add);
// dependency on notification overlay, dependent by settings overlay
loadComponentSingleFile(CreateUpdateManager(), Add, true);
// overlay elements
loadComponentSingleFile(new ManageCollectionsDialog(), overlayContent.Add, true);
loadComponentSingleFile(beatmapListing = new BeatmapListingOverlay(), overlayContent.Add, true);
loadComponentSingleFile(dashboard = new DashboardOverlay(), overlayContent.Add, true);
loadComponentSingleFile(news = new NewsOverlay(), overlayContent.Add, true);
@ -666,6 +660,7 @@ namespace osu.Game
chatOverlay.State.ValueChanged += state => channelManager.HighPollRate.Value = state.NewValue == Visibility.Visible;
Add(externalLinkOpener = new ExternalLinkOpener());
Add(new MusicKeyBindingHandler());
// side overlays which cancel each other.
var singleDisplaySideOverlays = new OverlayContainer[] { Settings, notifications };
@ -717,9 +712,9 @@ namespace osu.Game
float offset = 0;
if (Settings.State.Value == Visibility.Visible)
offset += ToolbarButton.WIDTH / 2;
offset += Toolbar.HEIGHT / 2;
if (notifications.State.Value == Visibility.Visible)
offset -= ToolbarButton.WIDTH / 2;
offset -= Toolbar.HEIGHT / 2;
screenContainer.MoveToX(offset, SettingsPanel.TRANSITION_LENGTH, Easing.OutQuint);
}
@ -737,24 +732,6 @@ namespace osu.Game
overlayContent.ChangeChildDepth(overlay, (float)-Clock.CurrentTime);
}
public class GameIdleTracker : IdleTracker
{
private InputManager inputManager;
public GameIdleTracker(int time)
: base(time)
{
}
protected override void LoadComplete()
{
base.LoadComplete();
inputManager = GetContainingInputManager();
}
protected override bool AllowIdle => inputManager.FocusedDrawable == null;
}
private void forwardLoggedErrorsToNotifications()
{
int recentLogCount = 0;
@ -925,8 +902,6 @@ namespace osu.Game
private ScalingContainer screenContainer;
protected MusicController MusicController { get; private set; }
protected override bool OnExiting()
{
if (ScreenStack.CurrentScreen is Loader)
@ -976,9 +951,12 @@ namespace osu.Game
break;
}
if (current is IOsuScreen currentOsuScreen)
OverlayActivationMode.UnbindFrom(currentOsuScreen.OverlayActivationMode);
if (newScreen is IOsuScreen newOsuScreen)
{
OverlayActivationMode.Value = newOsuScreen.InitialOverlayActivationMode;
OverlayActivationMode.BindTo(newOsuScreen.OverlayActivationMode);
MusicController.AllowRateAdjustments = newOsuScreen.AllowRateAdjustments;
@ -1009,10 +987,4 @@ namespace osu.Game
Exit();
}
}
public enum ScorePresentType
{
Results,
Gameplay
}
}