// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using osu.Framework; using osu.Game.Graphics.UserInterface; using osu.Game.Input; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Overlays.Mods; using osu.Game.Scoring; namespace osu.Game.Configuration { /// /// Stores global per-session statics. These will not be stored after exiting the game. /// public class SessionStatics : InMemoryConfigManager { protected override void InitialiseDefaults() { SetDefault(Static.LoginOverlayDisplayed, false); SetDefault(Static.MutedAudioNotificationShownOnce, false); SetDefault(Static.LowBatteryNotificationShownOnce, false); SetDefault(Static.FeaturedArtistDisclaimerShownOnce, false); SetDefault(Static.LastHoverSoundPlaybackTime, (double?)null); SetDefault(Static.LastModSelectPanelSamplePlaybackTime, (double?)null); SetDefault(Static.SeasonalBackgrounds, null); SetDefault(Static.TouchInputActive, RuntimeInfo.IsMobile); SetDefault(Static.LastLocalUserScore, null); } /// /// Revert statics to their defaults after being idle for appropriate amount of time. /// /// /// This only affects a subset of statics which the user would expect to have reset after a break. /// public void ResetAfterInactivity() { GetBindable(Static.LoginOverlayDisplayed).SetDefault(); GetBindable(Static.MutedAudioNotificationShownOnce).SetDefault(); GetBindable(Static.LowBatteryNotificationShownOnce).SetDefault(); } } public enum Static { LoginOverlayDisplayed, MutedAudioNotificationShownOnce, LowBatteryNotificationShownOnce, FeaturedArtistDisclaimerShownOnce, /// /// Info about seasonal backgrounds available fetched from API - see . /// Value under this lookup can be null if there are no backgrounds available (or API is not reachable). /// SeasonalBackgrounds, /// /// The last playback time in milliseconds of a hover sample (from ). /// Used to debounce hover sounds game-wide to avoid volume saturation, especially in scrolling views with many UI controls like . /// LastHoverSoundPlaybackTime, /// /// The last playback time in milliseconds of an on/off sample (from ). /// Used to debounce on/off sounds game-wide to avoid volume saturation, especially in activating mod presets with many mods. /// LastModSelectPanelSamplePlaybackTime, /// /// Whether the last positional input received was a touch input. /// Used in touchscreen detection scenarios (). /// TouchInputActive, /// /// Stores the local user's last score (can be completed or aborted). /// LastLocalUserScore, } }