mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
replay menus remembers expanded state
no messing with readonly fields
This commit is contained in:
parent
e99be3b4f5
commit
a0690e7ffb
@ -24,12 +24,16 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
sessionStatics.SetValue(Static.MutedAudioNotificationShownOnce, true);
|
sessionStatics.SetValue(Static.MutedAudioNotificationShownOnce, true);
|
||||||
sessionStatics.SetValue(Static.LowBatteryNotificationShownOnce, true);
|
sessionStatics.SetValue(Static.LowBatteryNotificationShownOnce, true);
|
||||||
sessionStatics.SetValue(Static.LastHoverSoundPlaybackTime, (double?)1d);
|
sessionStatics.SetValue(Static.LastHoverSoundPlaybackTime, (double?)1d);
|
||||||
|
sessionStatics.SetValue(Static.ReplayPlaybackSettingExpanded, false);
|
||||||
|
sessionStatics.SetValue(Static.ReplayVisualSettingsExpanded, true);
|
||||||
sessionStatics.SetValue(Static.SeasonalBackgrounds, new APISeasonalBackgrounds { EndDate = new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero) });
|
sessionStatics.SetValue(Static.SeasonalBackgrounds, new APISeasonalBackgrounds { EndDate = new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero) });
|
||||||
|
|
||||||
Assert.IsFalse(sessionStatics.GetBindable<bool>(Static.LoginOverlayDisplayed).IsDefault);
|
Assert.IsFalse(sessionStatics.GetBindable<bool>(Static.LoginOverlayDisplayed).IsDefault);
|
||||||
Assert.IsFalse(sessionStatics.GetBindable<bool>(Static.MutedAudioNotificationShownOnce).IsDefault);
|
Assert.IsFalse(sessionStatics.GetBindable<bool>(Static.MutedAudioNotificationShownOnce).IsDefault);
|
||||||
Assert.IsFalse(sessionStatics.GetBindable<bool>(Static.LowBatteryNotificationShownOnce).IsDefault);
|
Assert.IsFalse(sessionStatics.GetBindable<bool>(Static.LowBatteryNotificationShownOnce).IsDefault);
|
||||||
Assert.IsFalse(sessionStatics.GetBindable<double?>(Static.LastHoverSoundPlaybackTime).IsDefault);
|
Assert.IsFalse(sessionStatics.GetBindable<double?>(Static.LastHoverSoundPlaybackTime).IsDefault);
|
||||||
|
Assert.IsFalse(sessionStatics.GetBindable<bool>(Static.ReplayPlaybackSettingExpanded).IsDefault);
|
||||||
|
Assert.IsFalse(sessionStatics.GetBindable<bool>(Static.ReplayVisualSettingsExpanded).IsDefault);
|
||||||
Assert.IsFalse(sessionStatics.GetBindable<APISeasonalBackgrounds>(Static.SeasonalBackgrounds).IsDefault);
|
Assert.IsFalse(sessionStatics.GetBindable<APISeasonalBackgrounds>(Static.SeasonalBackgrounds).IsDefault);
|
||||||
|
|
||||||
sessionStatics.ResetAfterInactivity();
|
sessionStatics.ResetAfterInactivity();
|
||||||
@ -39,6 +43,8 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
Assert.IsTrue(sessionStatics.GetBindable<bool>(Static.LowBatteryNotificationShownOnce).IsDefault);
|
Assert.IsTrue(sessionStatics.GetBindable<bool>(Static.LowBatteryNotificationShownOnce).IsDefault);
|
||||||
// some statics should not reset despite inactivity.
|
// some statics should not reset despite inactivity.
|
||||||
Assert.IsFalse(sessionStatics.GetBindable<double?>(Static.LastHoverSoundPlaybackTime).IsDefault);
|
Assert.IsFalse(sessionStatics.GetBindable<double?>(Static.LastHoverSoundPlaybackTime).IsDefault);
|
||||||
|
Assert.IsFalse(sessionStatics.GetBindable<bool>(Static.ReplayPlaybackSettingExpanded).IsDefault);
|
||||||
|
Assert.IsFalse(sessionStatics.GetBindable<bool>(Static.ReplayVisualSettingsExpanded).IsDefault);
|
||||||
Assert.IsFalse(sessionStatics.GetBindable<APISeasonalBackgrounds>(Static.SeasonalBackgrounds).IsDefault);
|
Assert.IsFalse(sessionStatics.GetBindable<APISeasonalBackgrounds>(Static.SeasonalBackgrounds).IsDefault);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@ namespace osu.Game.Configuration
|
|||||||
SetDefault(Static.MutedAudioNotificationShownOnce, false);
|
SetDefault(Static.MutedAudioNotificationShownOnce, false);
|
||||||
SetDefault(Static.LowBatteryNotificationShownOnce, false);
|
SetDefault(Static.LowBatteryNotificationShownOnce, false);
|
||||||
SetDefault(Static.LastHoverSoundPlaybackTime, (double?)null);
|
SetDefault(Static.LastHoverSoundPlaybackTime, (double?)null);
|
||||||
|
SetDefault(Static.ReplayPlaybackSettingExpanded, true);
|
||||||
|
SetDefault(Static.ReplayVisualSettingsExpanded, false);
|
||||||
SetDefault<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null);
|
SetDefault<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,6 +44,8 @@ namespace osu.Game.Configuration
|
|||||||
LoginOverlayDisplayed,
|
LoginOverlayDisplayed,
|
||||||
MutedAudioNotificationShownOnce,
|
MutedAudioNotificationShownOnce,
|
||||||
LowBatteryNotificationShownOnce,
|
LowBatteryNotificationShownOnce,
|
||||||
|
ReplayPlaybackSettingExpanded,
|
||||||
|
ReplayVisualSettingsExpanded,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Info about seasonal backgrounds available fetched from API - see <see cref="APISeasonalBackgrounds"/>.
|
/// Info about seasonal backgrounds available fetched from API - see <see cref="APISeasonalBackgrounds"/>.
|
||||||
|
@ -3,12 +3,15 @@
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Game.Screens.Play.PlayerSettings;
|
using osu.Game.Screens.Play.PlayerSettings;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play.HUD
|
namespace osu.Game.Screens.Play.HUD
|
||||||
{
|
{
|
||||||
@ -16,6 +19,10 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
{
|
{
|
||||||
private const int fade_duration = 200;
|
private const int fade_duration = 200;
|
||||||
|
|
||||||
|
private Bindable<bool> playbackMenuExpanded;
|
||||||
|
|
||||||
|
private Bindable<bool> visualMenuExpanded;
|
||||||
|
|
||||||
public bool ReplayLoaded;
|
public bool ReplayLoaded;
|
||||||
|
|
||||||
public readonly PlaybackSettings PlaybackSettings;
|
public readonly PlaybackSettings PlaybackSettings;
|
||||||
@ -42,11 +49,21 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
//CollectionSettings = new CollectionSettings(),
|
//CollectionSettings = new CollectionSettings(),
|
||||||
//DiscussionSettings = new DiscussionSettings(),
|
//DiscussionSettings = new DiscussionSettings(),
|
||||||
PlaybackSettings = new PlaybackSettings(),
|
PlaybackSettings = new PlaybackSettings(),
|
||||||
VisualSettings = new VisualSettings { Expanded = { Value = false } }
|
VisualSettings = new VisualSettings()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(SessionStatics statics)
|
||||||
|
{
|
||||||
|
playbackMenuExpanded = statics.GetBindable<bool>(Static.ReplayPlaybackSettingExpanded);
|
||||||
|
visualMenuExpanded = statics.GetBindable<bool>(Static.ReplayVisualSettingsExpanded);
|
||||||
|
|
||||||
|
PlaybackSettings.Expanded.BindTo(playbackMenuExpanded);
|
||||||
|
VisualSettings.Expanded.BindTo(visualMenuExpanded);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void PopIn() => this.FadeIn(fade_duration);
|
protected override void PopIn() => this.FadeIn(fade_duration);
|
||||||
protected override void PopOut() => this.FadeOut(fade_duration);
|
protected override void PopOut() => this.FadeOut(fade_duration);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user