2019-09-23 05:15:27 +00:00
// 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.
2021-04-19 02:25:43 +00:00
using osu.Framework.Bindables ;
2021-01-07 09:47:20 +00:00
using osu.Game.Graphics.UserInterface ;
2020-10-29 16:31:42 +00:00
using osu.Game.Online.API.Requests.Responses ;
2021-01-07 09:47:20 +00:00
using osu.Game.Overlays ;
2020-10-29 16:31:42 +00:00
2019-09-23 05:15:27 +00:00
namespace osu.Game.Configuration
{
2019-09-28 12:21:51 +00:00
/// <summary>
/// Stores global per-session statics. These will not be stored after exiting the game.
/// </summary>
public class SessionStatics : InMemoryConfigManager < Static >
2019-09-23 05:15:27 +00:00
{
2021-04-19 02:25:43 +00:00
protected override void InitialiseDefaults ( ) = > ResetValues ( ) ;
2021-04-16 09:01:58 +00:00
public void ResetValues ( )
{
2021-04-19 02:25:43 +00:00
ensureDefault ( SetDefault ( Static . LoginOverlayDisplayed , false ) ) ;
ensureDefault ( SetDefault ( Static . MutedAudioNotificationShownOnce , false ) ) ;
ensureDefault ( SetDefault ( Static . LowBatteryNotificationShownOnce , false ) ) ;
ensureDefault ( SetDefault ( Static . LastHoverSoundPlaybackTime , ( double? ) null ) ) ;
ensureDefault ( SetDefault < APISeasonalBackgrounds > ( Static . SeasonalBackgrounds , null ) ) ;
2021-04-16 09:01:58 +00:00
}
2021-04-19 02:25:43 +00:00
private void ensureDefault < T > ( Bindable < T > bindable ) = > bindable . SetDefault ( ) ;
2019-09-23 05:15:27 +00:00
}
2019-09-28 12:21:51 +00:00
public enum Static
2019-09-23 05:15:27 +00:00
{
2019-09-24 02:45:47 +00:00
LoginOverlayDisplayed ,
2020-10-29 16:31:42 +00:00
MutedAudioNotificationShownOnce ,
2021-04-09 21:55:41 +00:00
LowBatteryNotificationShownOnce ,
2020-10-30 18:59:52 +00:00
/// <summary>
/// Info about seasonal backgrounds available fetched from API - see <see cref="APISeasonalBackgrounds"/>.
/// Value under this lookup can be <c>null</c> if there are no backgrounds available (or API is not reachable).
/// </summary>
2020-10-30 18:55:17 +00:00
SeasonalBackgrounds ,
2021-01-07 09:47:20 +00:00
/// <summary>
/// The last playback time in milliseconds of a hover sample (from <see cref="HoverSounds"/>).
/// 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
2019-09-23 05:15:27 +00:00
}
}