mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 22:33:05 +08:00
Move mod overlay statics to SessionStatics
This commit is contained in:
parent
274736b9c7
commit
4819a28791
@ -27,9 +27,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
[Cached]
|
||||
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
|
||||
|
||||
[Cached]
|
||||
private ModSelectOverlayStatics modOverlayStatics = new ModSelectOverlayStatics();
|
||||
|
||||
[Resolved]
|
||||
private OsuConfigManager configManager { get; set; } = null!;
|
||||
|
||||
|
@ -23,9 +23,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
[Cached]
|
||||
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
|
||||
|
||||
[Cached]
|
||||
private ModSelectOverlayStatics modOverlayStatics = new ModSelectOverlayStatics();
|
||||
|
||||
[Test]
|
||||
public void TestVariousPanels()
|
||||
{
|
||||
|
@ -37,9 +37,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
[Cached]
|
||||
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
|
||||
|
||||
[Cached]
|
||||
private ModSelectOverlayStatics modOverlayStatics = new ModSelectOverlayStatics();
|
||||
|
||||
[Cached(typeof(IDialogOverlay))]
|
||||
private readonly DialogOverlay dialogOverlay = new DialogOverlay();
|
||||
|
||||
|
@ -26,9 +26,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
[Cached]
|
||||
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
|
||||
|
||||
[Cached]
|
||||
private ModSelectOverlayStatics modOverlayStatics = new ModSelectOverlayStatics();
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
{
|
||||
|
@ -6,6 +6,7 @@
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Mods;
|
||||
|
||||
namespace osu.Game.Configuration
|
||||
{
|
||||
@ -21,6 +22,7 @@ namespace osu.Game.Configuration
|
||||
SetDefault(Static.LowBatteryNotificationShownOnce, false);
|
||||
SetDefault(Static.FeaturedArtistDisclaimerShownOnce, false);
|
||||
SetDefault(Static.LastHoverSoundPlaybackTime, (double?)null);
|
||||
SetDefault(Static.LastModSelectPanelSamplePlaybackTime, (double?)null);
|
||||
SetDefault<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null);
|
||||
}
|
||||
|
||||
@ -56,5 +58,11 @@ namespace osu.Game.Configuration
|
||||
/// Used to debounce hover sounds game-wide to avoid volume saturation, especially in scrolling views with many UI controls like <see cref="SettingsOverlay"/>.
|
||||
/// </summary>
|
||||
LastHoverSoundPlaybackTime,
|
||||
|
||||
/// <summary>
|
||||
/// The last playback time in milliseconds of an on/off sample (from <see cref="ModSelectPanel"/>).
|
||||
/// Used to debounce <see cref="ModSelectPanel"/> on/off sounds game-wide to avoid volume saturation, especially in activating mod presets with many mods.
|
||||
/// </summary>
|
||||
LastModSelectPanelSamplePlaybackTime
|
||||
}
|
||||
}
|
||||
|
@ -103,9 +103,6 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
private readonly BindableBool customisationVisible = new BindableBool();
|
||||
|
||||
[Cached]
|
||||
protected readonly ModSelectOverlayStatics Statics = new ModSelectOverlayStatics();
|
||||
|
||||
private ModSettingsArea modSettingsArea = null!;
|
||||
private ColumnScrollContainer columnScroll = null!;
|
||||
private ColumnFlowContainer columnFlow = null!;
|
||||
|
@ -1,27 +0,0 @@
|
||||
// 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.Game.Configuration;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores global mod overlay statics. These will not be stored after disposal of <see cref="ModSelectOverlay"/>
|
||||
/// </summary>
|
||||
public class ModSelectOverlayStatics : InMemoryConfigManager<Static>
|
||||
{
|
||||
protected override void InitialiseDefaults()
|
||||
{
|
||||
SetDefault(Static.LastModSelectPanelSamplePlaybackTime, (double?)null);
|
||||
}
|
||||
}
|
||||
|
||||
public enum Static
|
||||
{
|
||||
/// <summary>
|
||||
/// The last playback time in milliseconds of an on/off sample (from <see cref="ModSelectPanel"/>).
|
||||
/// Used to debounce <see cref="ModSelectPanel"/> on/off sounds game-wide to avoid volume saturation, especially in activating mod presets with many mods.
|
||||
/// </summary>
|
||||
LastModSelectPanelSamplePlaybackTime
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ using osu.Framework.Input.Events;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
@ -64,7 +65,7 @@ namespace osu.Game.Overlays.Mods
|
||||
protected OverlayColourProvider ColourProvider { get; private set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
protected ModSelectOverlayStatics ModOverlayStatics { get; private set; } = null!;
|
||||
protected SessionStatics Statics { get; private set; } = null!;
|
||||
|
||||
private readonly OsuSpriteText titleText;
|
||||
private readonly OsuSpriteText descriptionText;
|
||||
@ -196,7 +197,7 @@ namespace osu.Game.Overlays.Mods
|
||||
if (samplePlaybackDisabled.Value)
|
||||
return;
|
||||
|
||||
double? lastPlaybackTime = ModOverlayStatics.Get<double?>(Static.LastModSelectPanelSamplePlaybackTime);
|
||||
double? lastPlaybackTime = Statics.Get<double?>(Static.LastModSelectPanelSamplePlaybackTime);
|
||||
|
||||
if (lastPlaybackTime is not null && Time.Current - lastPlaybackTime < SAMPLE_PLAYBACK_DELAY)
|
||||
return;
|
||||
@ -206,7 +207,7 @@ namespace osu.Game.Overlays.Mods
|
||||
else
|
||||
sampleOff?.Play();
|
||||
|
||||
ModOverlayStatics.SetValue<double?>(Static.LastModSelectPanelSamplePlaybackTime, Time.Current);
|
||||
Statics.SetValue<double?>(Static.LastModSelectPanelSamplePlaybackTime, Time.Current);
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
|
Loading…
Reference in New Issue
Block a user