1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 00:33:21 +08:00

Merge remote-tracking branch 'GSculerlor/master' into fix-test-races

This commit is contained in:
Dean Herbert 2019-09-29 12:23:22 +08:00
commit 636aca8838
6 changed files with 53 additions and 7 deletions

View File

@ -0,0 +1,22 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Configuration;
namespace osu.Game.Configuration
{
public class InMemoryConfigManager<T> : ConfigManager<T>
where T : struct
{
public InMemoryConfigManager()
{
InitialiseDefaults();
}
protected override void PerformLoad()
{
}
protected override bool PerformSave() => true;
}
}

View File

@ -0,0 +1,21 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
namespace osu.Game.Configuration
{
/// <summary>
/// Stores global per-session statics. These will not be stored after exiting the game.
/// </summary>
public class SessionStatics : InMemoryConfigManager<Static>
{
protected override void InitialiseDefaults()
{
Set(Static.LoginOverlayDisplayed, false);
}
}
public enum Static
{
LoginOverlayDisplayed,
}
}

View File

@ -191,6 +191,7 @@ namespace osu.Game
dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore));
dependencies.Cache(SettingsStore = new SettingsStore(contextFactory));
dependencies.Cache(RulesetConfigCache = new RulesetConfigCache(SettingsStore));
dependencies.Cache(new SessionStatics());
dependencies.Cache(new OsuColour());
fileImporters.Add(BeatmapManager);

View File

@ -57,7 +57,7 @@ namespace osu.Game.Overlays
protected override void LoadComplete()
{
beatmap.BindValueChanged(beatmapChanged, true);
mods.BindValueChanged(_ => updateAudioAdjustments(), true);
mods.BindValueChanged(_ => ResetTrackAdjustments(), true);
base.LoadComplete();
}
@ -213,12 +213,12 @@ namespace osu.Game.Overlays
current = beatmap.NewValue;
TrackChanged?.Invoke(current, direction);
updateAudioAdjustments();
ResetTrackAdjustments();
queuedDirection = null;
}
private void updateAudioAdjustments()
public void ResetTrackAdjustments()
{
var track = current?.Track;
if (track == null)

View File

@ -63,13 +63,15 @@ namespace osu.Game.Screens.Menu
protected override BackgroundScreen CreateBackground() => background;
private Bindable<int> holdDelay;
private Bindable<bool> loginDisplayed;
private ExitConfirmOverlay exitConfirmOverlay;
[BackgroundDependencyLoader(true)]
private void load(DirectOverlay direct, SettingsOverlay settings, OsuConfigManager config)
private void load(DirectOverlay direct, SettingsOverlay settings, OsuConfigManager config, SessionStatics statics)
{
holdDelay = config.GetBindable<int>(OsuSetting.UIHoldActivationDelay);
loginDisplayed = statics.GetBindable<bool>(Static.LoginOverlayDisplayed);
if (host.CanExit)
{
@ -170,7 +172,6 @@ namespace osu.Game.Screens.Menu
Beatmap.ValueChanged += beatmap_ValueChanged;
}
private bool loginDisplayed;
private bool exitConfirmed;
protected override void LogoArriving(OsuLogo logo, bool resuming)
@ -198,10 +199,10 @@ namespace osu.Game.Screens.Menu
bool displayLogin()
{
if (!loginDisplayed)
if (!loginDisplayed.Value)
{
Scheduler.AddDelayed(() => login?.Show(), 500);
loginDisplayed = true;
loginDisplayed.Value = true;
}
return true;

View File

@ -490,6 +490,7 @@ namespace osu.Game.Screens.Select
BeatmapDetails.Leaderboard.RefreshScores();
Beatmap.Value.Track.Looping = true;
music?.ResetTrackAdjustments();
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
{