Example #1
0
        public void TestSessionStaticsReset()
        {
            sessionStatics = new SessionStatics();

            sessionStatics.SetValue(Static.LoginOverlayDisplayed, true);
            sessionStatics.SetValue(Static.MutedAudioNotificationShownOnce, true);
            sessionStatics.SetValue(Static.LowBatteryNotificationShownOnce, true);
            sessionStatics.SetValue(Static.LastHoverSoundPlaybackTime, (double?)1d);
            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.MutedAudioNotificationShownOnce).IsDefault);
            Assert.IsFalse(sessionStatics.GetBindable <bool>(Static.LowBatteryNotificationShownOnce).IsDefault);
            Assert.IsFalse(sessionStatics.GetBindable <double?>(Static.LastHoverSoundPlaybackTime).IsDefault);
            Assert.IsFalse(sessionStatics.GetBindable <APISeasonalBackgrounds>(Static.SeasonalBackgrounds).IsDefault);

            sessionStatics.ResetAfterInactivity();

            Assert.IsTrue(sessionStatics.GetBindable <bool>(Static.LoginOverlayDisplayed).IsDefault);
            Assert.IsTrue(sessionStatics.GetBindable <bool>(Static.MutedAudioNotificationShownOnce).IsDefault);
            Assert.IsTrue(sessionStatics.GetBindable <bool>(Static.LowBatteryNotificationShownOnce).IsDefault);
            // some statics should not reset despite inactivity.
            Assert.IsFalse(sessionStatics.GetBindable <double?>(Static.LastHoverSoundPlaybackTime).IsDefault);
            Assert.IsFalse(sessionStatics.GetBindable <APISeasonalBackgrounds>(Static.SeasonalBackgrounds).IsDefault);
        }
Example #2
0
 public void TestSessionStaticsReset()
 {
     sessionIdleTracker.IsIdle.BindValueChanged(e =>
     {
         Assert.IsTrue(sessionStatics.GetBindable <bool>(Static.LoginOverlayDisplayed).IsDefault);
         Assert.IsTrue(sessionStatics.GetBindable <bool>(Static.MutedAudioNotificationShownOnce).IsDefault);
         Assert.IsTrue(sessionStatics.GetBindable <bool>(Static.LowBatteryNotificationShownOnce).IsDefault);
         Assert.IsTrue(sessionStatics.GetBindable <double?>(Static.LastHoverSoundPlaybackTime).IsDefault);
     });
 }
Example #3
0
        private void load(SessionStatics sessionStatics, AudioManager audio)
        {
            muteWarningShownOnce    = sessionStatics.GetBindable <bool>(Static.MutedAudioNotificationShownOnce);
            batteryWarningShownOnce = sessionStatics.GetBindable <bool>(Static.LowBatteryNotificationShownOnce);

            InternalChildren = new Drawable[]
            {
                (content = new LogoTrackingContainer
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                }).WithChildren(new Drawable[]
                {
                    MetadataInfo = new BeatmapMetadataDisplay(Beatmap.Value, Mods, content.LogoFacade)
                    {
                        Alpha  = 0,
                        Anchor = Anchor.Centre,
                        Origin = Anchor.Centre,
                    },
                    PlayerSettings = new FillFlowContainer <PlayerSettingsGroup>
                    {
                        Anchor       = Anchor.TopRight,
                        Origin       = Anchor.TopRight,
                        AutoSizeAxes = Axes.Both,
                        Direction    = FillDirection.Vertical,
                        Spacing      = new Vector2(0, 20),
                        Margin       = new MarginPadding(25),
                        Children     = new PlayerSettingsGroup[]
                        {
                            VisualSettings = new VisualSettings(),
                            new InputSettings()
                        }
                    },
                    idleTracker = new IdleTracker(750),
                }),
                lowPassFilter  = new AudioFilter(audio.TrackMixer),
                highPassFilter = new AudioFilter(audio.TrackMixer, BQFType.HighPass)
            };

            if (Beatmap.Value.BeatmapInfo.EpilepsyWarning)
            {
                AddInternal(epilepsyWarning = new EpilepsyWarning
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                });
            }
        }
Example #4
0
        private void load(SessionStatics sessionStatics)
        {
            muteWarningShownOnce = sessionStatics.GetBindable <bool>(Static.MutedAudioNotificationShownOnce);

            InternalChild = (content = new LogoTrackingContainer
            {
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                RelativeSizeAxes = Axes.Both,
            }).WithChildren(new Drawable[]
            {
                MetadataInfo = new BeatmapMetadataDisplay(Beatmap.Value, Mods, content.LogoFacade)
                {
                    Alpha  = 0,
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                },
                new FillFlowContainer <PlayerSettingsGroup>
                {
                    Anchor       = Anchor.TopRight,
                    Origin       = Anchor.TopRight,
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Vertical,
                    Spacing      = new Vector2(0, 20),
                    Margin       = new MarginPadding(25),
                    Children     = new PlayerSettingsGroup[]
                    {
                        VisualSettings = new VisualSettings(),
                        new InputSettings()
                    }
                },
                idleTracker = new IdleTracker(750)
            });
        }
Example #5
0
        private void load(OsuConfigManager config, SessionStatics sessionStatics)
        {
            seasonalBackgroundMode = config.GetBindable <SeasonalBackgroundMode>(OsuSetting.SeasonalBackgroundMode);
            seasonalBackgroundMode.BindValueChanged(_ => SeasonalBackgroundChanged?.Invoke());

            seasonalBackgrounds = sessionStatics.GetBindable <APISeasonalBackgrounds>(Static.SeasonalBackgrounds);
            seasonalBackgrounds.BindValueChanged(_ => SeasonalBackgroundChanged?.Invoke());

            apiState.BindTo(api.State);
            apiState.BindValueChanged(fetchSeasonalBackgrounds, true);
        }
 private void load(AudioManager audio, SessionStatics statics)
 {
     lastPlaybackTime = statics.GetBindable <double?>(Static.LastHoverSoundPlaybackTime);
 }
Example #7
0
        private void load(BeatmapListingOverlay beatmapListing, SettingsOverlay settings, RankingsOverlay rankings, OsuConfigManager config, SessionStatics statics)
        {
            holdDelay      = config.GetBindable <float>(OsuSetting.UIHoldActivationDelay);
            loginDisplayed = statics.GetBindable <bool>(Static.LoginOverlayDisplayed);

            if (host.CanExit)
            {
                AddInternal(exitConfirmOverlay = new ExitConfirmOverlay
                {
                    Action = () =>
                    {
                        if (holdDelay.Value > 0)
                        {
                            confirmAndExit();
                        }
                        else
                        {
                            this.Exit();
                        }
                    }
                });
            }

            AddRangeInternal(new[]
            {
                buttonsContainer = new ParallaxContainer
                {
                    ParallaxAmount = 0.01f,
                    Children       = new Drawable[]
                    {
                        buttons = new ButtonSystem
                        {
                            OnEdit  = delegate { this.Push(new Editor()); },
                            OnSolo  = onSolo,
                            OnMulti = delegate { this.Push(new Multiplayer()); },
                            OnExit  = confirmAndExit,
                        }
                    }
                },
                sideFlashes = new MenuSideFlashes(),
                songTicker  = new SongTicker
                {
                    Anchor = Anchor.TopRight,
                    Origin = Anchor.TopRight,
                    Margin = new MarginPadding {
                        Right = 15, Top = 5
                    }
                },
                exitConfirmOverlay?.CreateProxy() ?? Drawable.Empty()
            });

            buttons.StateChanged += state =>
            {
                switch (state)
                {
                case ButtonSystemState.Initial:
                case ButtonSystemState.Exit:
                    Background.FadeColour(Color4.White, 500, Easing.OutSine);
                    break;

                default:
                    Background.FadeColour(OsuColour.Gray(0.8f), 500, Easing.OutSine);
                    break;
                }
            };

            buttons.OnSettings       = () => settings?.ToggleVisibility();
            buttons.OnBeatmapListing = () => beatmapListing?.ToggleVisibility();
            buttons.OnChart          = () => rankings?.ShowSpotlights();

            LoadComponentAsync(background = new BackgroundScreenDefault());
            preloadSongSelect();
        }
Example #8
0
        private void load(DirectOverlay direct, SettingsOverlay settings, OsuConfigManager config, SessionStatics statics)
        {
            holdDelay      = config.GetBindable <float>(OsuSetting.UIHoldActivationDelay);
            loginDisplayed = statics.GetBindable <bool>(Static.LoginOverlayDisplayed);

            if (host.CanExit)
            {
                AddInternal(exitConfirmOverlay = new ExitConfirmOverlay
                {
                    Action = () =>
                    {
                        if (holdDelay.Value > 0)
                        {
                            confirmAndExit();
                        }
                        else
                        {
                            this.Exit();
                        }
                    }
                });
            }

            AddRangeInternal(new Drawable[]
            {
                new ParallaxContainer
                {
                    ParallaxAmount = 0.01f,
                    Children       = new Drawable[]
                    {
                        buttons = new ButtonSystem
                        {
                            OnChart = delegate { this.Push(new ChartListing()); },
                            OnEdit  = delegate { this.Push(new Editor()); },
                            OnSolo  = onSolo,
                            OnMulti = delegate { this.Push(new Multiplayer()); },
                            OnExit  = confirmAndExit,
                        }
                    }
                },
                sideFlashes = new MenuSideFlashes(),
            });

            buttons.StateChanged += state =>
            {
                switch (state)
                {
                case ButtonSystemState.Initial:
                case ButtonSystemState.Exit:
                    Background.FadeColour(Color4.White, 500, Easing.OutSine);
                    break;

                default:
                    Background.FadeColour(OsuColour.Gray(0.8f), 500, Easing.OutSine);
                    break;
                }
            };

            buttons.OnSettings = () => settings?.ToggleVisibility();
            buttons.OnDirect   = () => direct?.ToggleVisibility();

            LoadComponentAsync(background = new BackgroundScreenDefault());
            preloadSongSelect();
        }
Example #9
0
        private void load(AudioManager audio, SessionStatics statics)
        {
            lastPlaybackTime = statics.GetBindable <double?>(Static.LastHoverSoundPlaybackTime);

            sampleHover = audio.Samples.Get($@"UI/generic-hover{SampleSet.GetDescription()}");
        }