mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Rename method and simplify SetDefault
calling code
This commit is contained in:
@ -27,7 +27,7 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
sessionIdleTracker.IsIdle.BindValueChanged(e =>
|
sessionIdleTracker.IsIdle.BindValueChanged(e =>
|
||||||
{
|
{
|
||||||
if (e.NewValue)
|
if (e.NewValue)
|
||||||
sessionStatics.ResetValues();
|
sessionStatics.ResetAfterInactivity();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,23 +15,25 @@ namespace osu.Game.Configuration
|
|||||||
{
|
{
|
||||||
protected override void InitialiseDefaults()
|
protected override void InitialiseDefaults()
|
||||||
{
|
{
|
||||||
ensureDefault(SetDefault(Static.LoginOverlayDisplayed, false));
|
SetDefault(Static.LoginOverlayDisplayed, false);
|
||||||
ensureDefault(SetDefault(Static.MutedAudioNotificationShownOnce, false));
|
SetDefault(Static.MutedAudioNotificationShownOnce, false);
|
||||||
ensureDefault(SetDefault(Static.LowBatteryNotificationShownOnce, false));
|
SetDefault(Static.LowBatteryNotificationShownOnce, false);
|
||||||
ensureDefault(SetDefault(Static.LastHoverSoundPlaybackTime, (double?)null));
|
SetDefault(Static.LastHoverSoundPlaybackTime, (double?)null);
|
||||||
ensureDefault(SetDefault<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null));
|
SetDefault<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to revert statics to their defaults after being idle for appropiate amount of time.
|
/// Revert statics to their defaults after being idle for appropriate amount of time.
|
||||||
/// Does not affect loaded seasonal backgrounds.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ResetValues()
|
/// <remarks>
|
||||||
|
/// This only affects a subset of statics which the user would expect to have reset after a break.
|
||||||
|
/// </remarks>
|
||||||
|
public void ResetAfterInactivity()
|
||||||
{
|
{
|
||||||
ensureDefault(GetBindable<bool>(Static.LoginOverlayDisplayed));
|
GetBindable<bool>(Static.LoginOverlayDisplayed).SetDefault();
|
||||||
ensureDefault(GetBindable<bool>(Static.MutedAudioNotificationShownOnce));
|
GetBindable<bool>(Static.MutedAudioNotificationShownOnce).SetDefault();
|
||||||
ensureDefault(GetBindable<bool>(Static.LowBatteryNotificationShownOnce));
|
GetBindable<bool>(Static.LowBatteryNotificationShownOnce).SetDefault();
|
||||||
ensureDefault(GetBindable<double?>(Static.LastHoverSoundPlaybackTime));
|
GetBindable<double?>(Static.LastHoverSoundPlaybackTime).SetDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensureDefault<T>(Bindable<T> bindable) => bindable.SetDefault();
|
private void ensureDefault<T>(Bindable<T> bindable) => bindable.SetDefault();
|
||||||
|
@ -680,7 +680,7 @@ namespace osu.Game
|
|||||||
sessionIdleTracker.IsIdle.BindValueChanged(idle =>
|
sessionIdleTracker.IsIdle.BindValueChanged(idle =>
|
||||||
{
|
{
|
||||||
if (idle.NewValue)
|
if (idle.NewValue)
|
||||||
SessionStatics.ResetValues();
|
SessionStatics.ResetAfterInactivity();
|
||||||
});
|
});
|
||||||
|
|
||||||
Add(sessionIdleTracker);
|
Add(sessionIdleTracker);
|
||||||
|
Reference in New Issue
Block a user