Exemple #1
0
        public override void Reset()
        {
            base.Reset();

            Children = new[] { settings = new SettingsOverlay() };
            settings.ToggleVisibility();
        }
Exemple #2
0
        public bool OnPressed(GlobalAction action)
        {
            switch (action)
            {
            case GlobalAction.ToggleOptions:
                if (SettingsOverlay.IsShown)
                {
                    SettingsOverlay.Hide();
                }
                else
                {
                    SettingsOverlay.Show();
                }
                break;

            case GlobalAction.ExitOverlay:
                if (SettingsOverlay.IsShown)
                {
                    SettingsOverlay.Hide();
                }
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(action), action, null);
            }

            return(true);
        }
        public TestSceneSettings()
        {
            SettingsOverlay settings;

            Add(settings = new SettingsOverlay());

            AddStep("toggle", () => settings.ToggleVisibility());
        }
Exemple #4
0
        protected override bool OnClick(ClickEvent e)
        {
            if (SettingsOverlay.IsShown && !SettingsOverlay.IsHovered)
            {
                SettingsOverlay.Hide();
            }

            return(base.OnClick(e));
        }
Exemple #5
0
 public TestCaseSettings()
 {
     settings = new MainSettings
     {
         State = Visibility.Visible
     };
     Add(dialogOverlay = new DialogOverlay
     {
         Depth = -1
     });
 }
Exemple #6
0
        private void load(DirectOverlay direct, SettingsOverlay settings)
        {
            if (host.CanExit)
            {
                AddInternal(new ExitConfirmOverlay {
                    Action = this.Exit
                });
            }

            AddRangeInternal(new Drawable[]
            {
                new ParallaxContainer
                {
                    ParallaxAmount = 0.01f,
                    Children       = new Drawable[]
                    {
                        buttons = new ButtonSystem
                        {
                            OnChart  = delegate { this.Push(new ChartListing()); },
                            OnDirect = delegate { this.Push(new OnlineListing()); },
                            OnEdit   = delegate { this.Push(new Editor()); },
                            OnSolo   = onSolo,
                            OnMulti  = delegate { this.Push(new Multiplayer()); },
                            OnExit   = this.Exit,
                        }
                    }
                },
                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();
        }
        private void Load(TextureStore ts)
        {
            var bg = new BackgroundImageContainer();

            Add(bg);
            bg.SetTexture(ts.Get("https://3.bp.blogspot.com/-906HDJiF4Nk/UbAN4_DrK_I/AAAAAAAAAvE/pZQwo-u2RbQ/s1600/Background+images.jpg"));

            SettingsOverlay settingsOverlay;

            Add(settingsOverlay = new SettingsOverlay());

            AddStep("Show Overlay", settingsOverlay.Show);
            AddStep("Hide Overlay", settingsOverlay.Hide);
        }
Exemple #8
0
        private void load(SettingsOverlay settings)
        {
            textFlow.AddIcon(FontAwesome.Solid.DoorOpen, t =>
            {
                t.Font = t.Font.With(size: 50);
            });

            textFlow.NewLine();

            textFlow.AddParagraph("gamebosu! moved to the settings overlay", t =>
            {
                t.Font   = t.Font.With(size: 24);
                t.Colour = Color4.Yellow;
            });
            textFlow.AddParagraph("Open the settings to access the rom listing", t => t.Font = t.Font.With(size: 16));
            textFlow.AddParagraph("Search for \"open rom listing\" ", t => t.Font            = t.Font.With(size: 12));
        }
Exemple #9
0
        private void Load(Storage storage)
        {
            _dependencies.Cache(BeatmapManager = new BeatmapManager());
            _dependencies.Cache(UserManager    = new UserManager());

            _dependencies.Cache(BeatmapMirrorAccess = new BeatmapMirrorAccess());

            _dependencies.Cache(QsorDbContextFactory = new QsorDbContextFactory(storage));
            _dependencies.Cache(ConfigManager        = new QsorConfigManager(storage));

            _dependencies.Cache(NotificationOverlay = new NotificationOverlay());

            _dependencies.Cache(SentryLogger = new SentryLogger(this));

            _dependencies.Cache(DiscordManager = new DiscordManager());

            _dependencies.CacheAs(this);
            _dependencies.CacheAs(Host);

            AddInternal(DiscordManager);

            Resources.AddStore(new NamespacedResourceStore <byte[]>(new DllResourceStore(typeof(QsorGame).Assembly), @"Resources"));

            QsorDbContextFactory.Get().Migrate();

            AddInternal(BeatmapManager);
            AddInternal(NotificationOverlay);

            Updater ??= new DummyUpdater();

            UpdaterOverlay = new UpdaterOverlay();

            _dependencies.Cache(UpdaterOverlay);
            _dependencies.CacheAs(Updater);

            LoadComponent(Updater);

            ConfigManager.Save();

            AddInternal(SettingsOverlay = new SettingsOverlay());
        }
Exemple #10
0
        protected override void LoadComplete()
        {
            base.LoadComplete();
            AddRange(new Drawable[]
            {
                new StreamGameTooltipContainer()
                {
                    RelativeSizeAxes = Axes.Both,
                    Children         = new Drawable[]
                    {
                        new GlobalActionContainer()
                        {
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                stack = new StreamGameScreenStack {
                                    RelativeSizeAxes = Axes.Both
                                },
                                leftFloatingOverlayContent = new Container {
                                    RelativeSizeAxes = Axes.Both
                                },
                            }
                        }
                    }
                }
            });

            stack.ScreenPushed += screenPushed;
            stack.ScreenExited += screenExited;

            stack.Push(new MainScreen());

            if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows)
            {
                Add(new SquirrelUpdateManager());
            }

            loadComponentSingleFile(settings = new MainSettings(), leftFloatingOverlayContent.Add);
        }
Exemple #11
0
 private void load(SettingsOverlay settings)
 {
     StateContainer = settings;
 }
Exemple #12
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            // hook up notifications to components.
            BeatmapManager.PostNotification = n => notificationOverlay?.Post(n);
            BeatmapManager.GetStableStorage = GetStorageForStableInstall;

            AddRange(new Drawable[] {
                new VolumeControlReceptor
                {
                    RelativeSizeAxes = Axes.Both,
                    ActionRequested  = action => volume.Adjust(action)
                },
                mainContent = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                },
                volume         = new VolumeControl(),
                overlayContent = new Container {
                    RelativeSizeAxes = Axes.Both
                },
                new OnScreenDisplay(),
            });

            LoadComponentAsync(screenStack = new Loader(), d =>
            {
                screenStack.ModePushed += screenAdded;
                screenStack.Exited     += screenRemoved;
                mainContent.Add(screenStack);
            });

            //overlay elements
            LoadComponentAsync(direct = new DirectOverlay {
                Depth = -1
            }, mainContent.Add);
            LoadComponentAsync(social = new SocialOverlay {
                Depth = -1
            }, mainContent.Add);
            LoadComponentAsync(chat = new ChatOverlay {
                Depth = -1
            }, mainContent.Add);
            LoadComponentAsync(settings = new MainSettings
            {
                GetToolbarHeight = () => ToolbarOffset,
                Depth            = -1
            }, overlayContent.Add);
            LoadComponentAsync(userProfile = new UserProfileOverlay {
                Depth = -2
            }, mainContent.Add);
            LoadComponentAsync(beatmapSetOverlay = new BeatmapSetOverlay {
                Depth = -3
            }, mainContent.Add);
            LoadComponentAsync(musicController = new MusicController
            {
                Depth    = -4,
                Position = new Vector2(0, Toolbar.HEIGHT),
                Anchor   = Anchor.TopRight,
                Origin   = Anchor.TopRight,
            }, overlayContent.Add);

            LoadComponentAsync(notificationOverlay = new NotificationOverlay
            {
                Depth  = -4,
                Anchor = Anchor.TopRight,
                Origin = Anchor.TopRight,
            }, overlayContent.Add);

            LoadComponentAsync(dialogOverlay = new DialogOverlay
            {
                Depth = -5,
            }, overlayContent.Add);

            Logger.NewEntry += entry =>
            {
                if (entry.Level < LogLevel.Important)
                {
                    return;
                }

                notificationOverlay.Post(new SimpleNotification
                {
                    Text = $@"{entry.Level}: {entry.Message}"
                });
            };

            dependencies.Cache(settings);
            dependencies.Cache(social);
            dependencies.Cache(direct);
            dependencies.Cache(chat);
            dependencies.Cache(userProfile);
            dependencies.Cache(musicController);
            dependencies.Cache(beatmapSetOverlay);
            dependencies.Cache(notificationOverlay);
            dependencies.Cache(dialogOverlay);

            // ensure only one of these overlays are open at once.
            var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct };

            foreach (var overlay in singleDisplayOverlays)
            {
                overlay.StateChanged += state =>
                {
                    if (state == Visibility.Hidden)
                    {
                        return;
                    }

                    foreach (var c in singleDisplayOverlays)
                    {
                        if (c == overlay)
                        {
                            continue;
                        }
                        c.State = Visibility.Hidden;
                    }
                };
            }

            LoadComponentAsync(Toolbar = new Toolbar
            {
                Depth  = -4,
                OnHome = delegate
                {
                    hideAllOverlays();
                    intro?.ChildScreen?.MakeCurrent();
                },
            }, overlayContent.Add);

            settings.StateChanged += delegate
            {
                switch (settings.State)
                {
                case Visibility.Hidden:
                    intro.MoveToX(0, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint);
                    break;

                case Visibility.Visible:
                    intro.MoveToX(SettingsOverlay.SIDEBAR_WIDTH / 2, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint);
                    break;
                }
            };

            Cursor.State = Visibility.Hidden;
        }
Exemple #13
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            AddRange(new Drawable[] {
                new VolumeControlReceptor
                {
                    RelativeSizeAxes = Axes.Both,
                    ActionRequested  = delegate(InputState state) { volume.Adjust(state); }
                },
                mainContent = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                },
                volume         = new VolumeControl(),
                overlayContent = new Container {
                    RelativeSizeAxes = Axes.Both
                },
                new OnScreenDisplay(),
                new GlobalHotkeys //exists because UserInputManager is at a level below us.
                {
                    Handler = globalHotkeyPressed
                }
            });

            LoadComponentAsync(screenStack = new Loader(), d =>
            {
                screenStack.ModePushed += screenAdded;
                screenStack.Exited     += screenRemoved;
                mainContent.Add(screenStack);
            });

            //overlay elements
            LoadComponentAsync(direct = new DirectOverlay {
                Depth = -1
            }, mainContent.Add);
            LoadComponentAsync(social = new SocialOverlay {
                Depth = -1
            }, mainContent.Add);
            LoadComponentAsync(chat = new ChatOverlay {
                Depth = -1
            }, mainContent.Add);
            LoadComponentAsync(userProfile = new UserProfileOverlay {
                Depth = -1
            }, mainContent.Add);
            LoadComponentAsync(settings = new SettingsOverlay {
                Depth = -1
            }, overlayContent.Add);
            LoadComponentAsync(musicController = new MusicController
            {
                Depth    = -2,
                Position = new Vector2(0, Toolbar.HEIGHT),
                Anchor   = Anchor.TopRight,
                Origin   = Anchor.TopRight,
            }, overlayContent.Add);

            LoadComponentAsync(notificationManager = new NotificationManager
            {
                Depth  = -2,
                Anchor = Anchor.TopRight,
                Origin = Anchor.TopRight,
            }, overlayContent.Add);

            LoadComponentAsync(dialogOverlay = new DialogOverlay
            {
                Depth = -4,
            }, overlayContent.Add);

            Logger.NewEntry += entry =>
            {
                if (entry.Level < LogLevel.Important)
                {
                    return;
                }

                notificationManager.Post(new SimpleNotification
                {
                    Text = $@"{entry.Level}: {entry.Message}"
                });
            };

            Dependencies.Cache(settings);
            Dependencies.Cache(social);
            Dependencies.Cache(chat);
            Dependencies.Cache(userProfile);
            Dependencies.Cache(musicController);
            Dependencies.Cache(notificationManager);
            Dependencies.Cache(dialogOverlay);

            // ensure both overlays aren't presented at the same time
            chat.StateChanged   += (container, state) => social.State = state == Visibility.Visible ? Visibility.Hidden : social.State;
            social.StateChanged += (container, state) => chat.State = state == Visibility.Visible ? Visibility.Hidden : chat.State;

            LoadComponentAsync(Toolbar = new Toolbar
            {
                Depth  = -3,
                OnHome = delegate { intro?.ChildScreen?.MakeCurrent(); },
            }, overlayContent.Add);

            settings.StateChanged += delegate
            {
                switch (settings.State)
                {
                case Visibility.Hidden:
                    intro.MoveToX(0, SettingsOverlay.TRANSITION_LENGTH, EasingTypes.OutQuint);
                    break;

                case Visibility.Visible:
                    intro.MoveToX(SettingsOverlay.SIDEBAR_WIDTH / 2, SettingsOverlay.TRANSITION_LENGTH, EasingTypes.OutQuint);
                    break;
                }
            };

            Cursor.State = Visibility.Hidden;
        }
Exemple #14
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();
        }
Exemple #15
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            // hook up notifications to components.
            BeatmapManager.PostNotification = n => notificationOverlay?.Post(n);
            BeatmapManager.GetStableStorage = GetStorageForStableInstall;

            AddRange(new Drawable[] {
                new VolumeControlReceptor
                {
                    RelativeSizeAxes = Axes.Both,
                    ActionRequested  = delegate(InputState state) { volume.Adjust(state); }
                },
                mainContent = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                },
                volume         = new VolumeControl(),
                overlayContent = new Container {
                    RelativeSizeAxes = Axes.Both
                },
                new OnScreenDisplay(),
            });

            LoadComponentAsync(screenStack = new Loader(), d =>
            {
                screenStack.ModePushed += screenAdded;
                screenStack.Exited     += screenRemoved;
                mainContent.Add(screenStack);
            });

            //overlay elements
            LoadComponentAsync(direct = new DirectOverlay {
                Depth = -1
            }, mainContent.Add);
            LoadComponentAsync(social = new SocialOverlay {
                Depth = -1
            }, mainContent.Add);
            LoadComponentAsync(chat = new ChatOverlay {
                Depth = -1
            }, mainContent.Add);
            LoadComponentAsync(settings = new SettingsOverlay {
                Depth = -1
            }, overlayContent.Add);
            LoadComponentAsync(userProfile = new UserProfileOverlay {
                Depth = -2
            }, mainContent.Add);
            LoadComponentAsync(musicController = new MusicController
            {
                Depth    = -3,
                Position = new Vector2(0, Toolbar.HEIGHT),
                Anchor   = Anchor.TopRight,
                Origin   = Anchor.TopRight,
            }, overlayContent.Add);

            LoadComponentAsync(notificationOverlay = new NotificationOverlay
            {
                Depth  = -3,
                Anchor = Anchor.TopRight,
                Origin = Anchor.TopRight,
            }, overlayContent.Add);

            LoadComponentAsync(dialogOverlay = new DialogOverlay
            {
                Depth = -5,
            }, overlayContent.Add);

            Logger.NewEntry += entry =>
            {
                if (entry.Level < LogLevel.Important)
                {
                    return;
                }

                notificationOverlay.Post(new SimpleNotification
                {
                    Text = $@"{entry.Level}: {entry.Message}"
                });
            };

            dependencies.Cache(settings);
            dependencies.Cache(social);
            dependencies.Cache(chat);
            dependencies.Cache(userProfile);
            dependencies.Cache(musicController);
            dependencies.Cache(notificationOverlay);
            dependencies.Cache(dialogOverlay);

            // ensure both overlays aren't presented at the same time
            chat.StateChanged   += (container, state) => social.State = state == Visibility.Visible ? Visibility.Hidden : social.State;
            social.StateChanged += (container, state) => chat.State = state == Visibility.Visible ? Visibility.Hidden : chat.State;

            LoadComponentAsync(Toolbar = new Toolbar
            {
                Depth  = -4,
                OnHome = delegate
                {
                    //Create variable double step home exit
                    //If overlay was visible, home button will only close it
                    //Pressing home twice will go to main menu. This behavior should match Key.Escape
                    var overlayWasVisible = false;
                    foreach (var container in overlayContainers())
                    {
                        if (container.State == Visibility.Visible)
                        {
                            container.State   = Visibility.Hidden;
                            overlayWasVisible = true;
                        }
                    }
                    //Execute double exit if overlay was active
                    if (!overlayWasVisible)
                    {
                        intro?.ChildScreen?.MakeCurrent();
                    }
                },
            }, overlayContent.Add);

            settings.StateChanged += delegate
            {
                switch (settings.State)
                {
                case Visibility.Hidden:
                    intro.MoveToX(0, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint);
                    break;

                case Visibility.Visible:
                    intro.MoveToX(SettingsOverlay.SIDEBAR_WIDTH / 2, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint);
                    break;
                }
            };

            Cursor.State = Visibility.Hidden;
        }
Exemple #16
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            // The next time this is updated is in UpdateAfterChildren, which occurs too late and results
            // in the cursor being shown for a few frames during the intro.
            // This prevents the cursor from showing until we have a screen with CursorVisible = true
            MenuCursorContainer.CanShowCursor = currentScreen?.CursorVisible ?? false;

            // todo: all archive managers should be able to be looped here.
            SkinManager.PostNotification = n => notifications?.Post(n);
            SkinManager.GetStableStorage = GetStorageForStableInstall;

            BeatmapManager.PostNotification = n => notifications?.Post(n);
            BeatmapManager.GetStableStorage = GetStorageForStableInstall;

            BeatmapManager.PresentBeatmap = PresentBeatmap;

            AddRange(new Drawable[]
            {
                new VolumeControlReceptor
                {
                    RelativeSizeAxes      = Axes.Both,
                    ActionRequested       = action => volume.Adjust(action),
                    ScrollActionRequested = (action, amount, isPrecise) => volume.Adjust(action, amount, isPrecise),
                },
                screenContainer = new ScalingContainer(ScalingMode.ExcludeOverlays)
                {
                    RelativeSizeAxes = Axes.Both,
                },
                mainContent = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                },
                overlayContent = new Container {
                    RelativeSizeAxes = Axes.Both, Depth = float.MinValue
                },
                idleTracker = new IdleTracker(6000)
            });

            loadComponentSingleFile(screenStack = new Loader(), d =>
            {
                screenStack.ModePushed += screenAdded;
                screenStack.Exited     += screenRemoved;
                screenContainer.Add(screenStack);
            });

            loadComponentSingleFile(Toolbar = new Toolbar
            {
                Depth  = -5,
                OnHome = delegate
                {
                    CloseAllOverlays(false);
                    intro?.ChildScreen?.MakeCurrent();
                },
            }, overlayContent.Add);

            loadComponentSingleFile(volume          = new VolumeOverlay(), overlayContent.Add);
            loadComponentSingleFile(onscreenDisplay = new OnScreenDisplay(), Add);

            loadComponentSingleFile(screenshotManager, Add);

            //overlay elements
            loadComponentSingleFile(direct = new DirectOverlay {
                Depth = -1
            }, mainContent.Add);
            loadComponentSingleFile(social = new SocialOverlay {
                Depth = -1
            }, mainContent.Add);
            loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal);
            loadComponentSingleFile(chatOverlay    = new ChatOverlay {
                Depth = -1
            }, mainContent.Add);
            loadComponentSingleFile(settings = new MainSettings
            {
                GetToolbarHeight = () => ToolbarOffset,
                Depth            = -1
            }, overlayContent.Add);
            loadComponentSingleFile(userProfile = new UserProfileOverlay {
                Depth = -2
            }, mainContent.Add);
            loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay {
                Depth = -3
            }, mainContent.Add);
            loadComponentSingleFile(musicController = new MusicController
            {
                Depth    = -5,
                Position = new Vector2(0, Toolbar.HEIGHT),
                Anchor   = Anchor.TopRight,
                Origin   = Anchor.TopRight,
            }, overlayContent.Add);

            loadComponentSingleFile(notifications = new NotificationOverlay
            {
                GetToolbarHeight = () => ToolbarOffset,
                Depth            = -4,
                Anchor           = Anchor.TopRight,
                Origin           = Anchor.TopRight,
            }, overlayContent.Add);

            loadComponentSingleFile(accountCreation = new AccountCreationOverlay
            {
                Depth = -6,
            }, overlayContent.Add);

            loadComponentSingleFile(dialogOverlay = new DialogOverlay
            {
                Depth = -7,
            }, overlayContent.Add);

            loadComponentSingleFile(externalLinkOpener = new ExternalLinkOpener
            {
                Depth = -8,
            }, overlayContent.Add);

            dependencies.Cache(idleTracker);
            dependencies.Cache(settings);
            dependencies.Cache(onscreenDisplay);
            dependencies.Cache(social);
            dependencies.Cache(direct);
            dependencies.Cache(chatOverlay);
            dependencies.Cache(channelManager);
            dependencies.Cache(userProfile);
            dependencies.Cache(musicController);
            dependencies.Cache(beatmapSetOverlay);
            dependencies.Cache(notifications);
            dependencies.Cache(dialogOverlay);
            dependencies.Cache(accountCreation);

            chatOverlay.StateChanged += state => channelManager.HighPollRate.Value = state == Visibility.Visible;

            Add(externalLinkOpener = new ExternalLinkOpener());

            var singleDisplaySideOverlays = new OverlayContainer[] { settings, notifications };

            overlays.AddRange(singleDisplaySideOverlays);

            foreach (var overlay in singleDisplaySideOverlays)
            {
                overlay.StateChanged += state =>
                {
                    if (state == Visibility.Hidden)
                    {
                        return;
                    }
                    singleDisplaySideOverlays.Where(o => o != overlay).ForEach(o => o.Hide());
                };
            }

            // eventually informational overlays should be displayed in a stack, but for now let's only allow one to stay open at a time.
            var informationalOverlays = new OverlayContainer[] { beatmapSetOverlay, userProfile };

            overlays.AddRange(informationalOverlays);

            foreach (var overlay in informationalOverlays)
            {
                overlay.StateChanged += state =>
                {
                    if (state == Visibility.Hidden)
                    {
                        return;
                    }
                    informationalOverlays.Where(o => o != overlay).ForEach(o => o.Hide());
                };
            }

            // ensure only one of these overlays are open at once.
            var singleDisplayOverlays = new OverlayContainer[] { chatOverlay, social, direct };

            overlays.AddRange(singleDisplayOverlays);

            foreach (var overlay in singleDisplayOverlays)
            {
                overlay.StateChanged += state =>
                {
                    // informational overlays should be dismissed on a show or hide of a full overlay.
                    informationalOverlays.ForEach(o => o.Hide());

                    if (state == Visibility.Hidden)
                    {
                        return;
                    }

                    singleDisplayOverlays.Where(o => o != overlay).ForEach(o => o.Hide());
                };
            }

            OverlayActivationMode.ValueChanged += v =>
            {
                if (v != OverlayActivation.All)
                {
                    CloseAllOverlays();
                }
            };

            void updateScreenOffset()
            {
                float offset = 0;

                if (settings.State == Visibility.Visible)
                {
                    offset += ToolbarButton.WIDTH / 2;
                }
                if (notifications.State == Visibility.Visible)
                {
                    offset -= ToolbarButton.WIDTH / 2;
                }

                screenContainer.MoveToX(offset, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint);
            }

            settings.StateChanged      += _ => updateScreenOffset();
            notifications.StateChanged += _ => updateScreenOffset();
        }
Exemple #17
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();
        }
Exemple #18
0
 public TestCaseSettings()
 {
     Children = new[] { settings = new MainSettings() };
 }
Exemple #19
0
 public TestCaseSettings()
 {
     Children = new[] { settings = new SettingsOverlay() };
 }
Exemple #20
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            // hook up notifications to components.
            BeatmapManager.PostNotification = n => notifications?.Post(n);
            BeatmapManager.GetStableStorage = GetStorageForStableInstall;

            AddRange(new Drawable[]
            {
                new VolumeControlReceptor
                {
                    RelativeSizeAxes = Axes.Both,
                    ActionRequested  = action => volume.Adjust(action)
                },
                mainContent = new Container {
                    RelativeSizeAxes = Axes.Both
                },
                overlayContent = new Container {
                    RelativeSizeAxes = Axes.Both, Depth = float.MinValue
                },
            });

            loadComponentSingleFile(screenStack = new Loader(), d =>
            {
                screenStack.ModePushed += screenAdded;
                screenStack.Exited     += screenRemoved;
                mainContent.Add(screenStack);
            });

            loadComponentSingleFile(Toolbar = new Toolbar
            {
                Depth  = -5,
                OnHome = delegate
                {
                    hideAllOverlays();
                    intro?.ChildScreen?.MakeCurrent();
                },
            }, overlayContent.Add);

            loadComponentSingleFile(volume = new VolumeControl(), Add);
            loadComponentSingleFile(new OnScreenDisplay(), Add);

            //overlay elements
            loadComponentSingleFile(direct = new DirectOverlay {
                Depth = -1
            }, mainContent.Add);
            loadComponentSingleFile(social = new SocialOverlay {
                Depth = -1
            }, mainContent.Add);
            loadComponentSingleFile(chat = new ChatOverlay {
                Depth = -1
            }, mainContent.Add);
            loadComponentSingleFile(settings = new MainSettings
            {
                GetToolbarHeight = () => ToolbarOffset,
                Depth            = -1
            }, overlayContent.Add);
            loadComponentSingleFile(userProfile = new UserProfileOverlay {
                Depth = -2
            }, mainContent.Add);
            loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay {
                Depth = -3
            }, mainContent.Add);
            loadComponentSingleFile(musicController = new MusicController
            {
                Depth    = -4,
                Position = new Vector2(0, Toolbar.HEIGHT),
                Anchor   = Anchor.TopRight,
                Origin   = Anchor.TopRight,
            }, overlayContent.Add);

            loadComponentSingleFile(notifications = new NotificationOverlay
            {
                GetToolbarHeight = () => ToolbarOffset,
                Depth            = -4,
                Anchor           = Anchor.TopRight,
                Origin           = Anchor.TopRight,
            }, overlayContent.Add);

            loadComponentSingleFile(dialogOverlay = new DialogOverlay
            {
                Depth = -6,
            }, overlayContent.Add);

            Logger.NewEntry += entry =>
            {
                if (entry.Level < LogLevel.Important)
                {
                    return;
                }

                notifications.Post(new SimpleNotification
                {
                    Text = $@"{entry.Level}: {entry.Message}"
                });
            };

            dependencies.Cache(settings);
            dependencies.Cache(social);
            dependencies.Cache(direct);
            dependencies.Cache(chat);
            dependencies.Cache(userProfile);
            dependencies.Cache(musicController);
            dependencies.Cache(beatmapSetOverlay);
            dependencies.Cache(notifications);
            dependencies.Cache(dialogOverlay);

            // ensure only one of these overlays are open at once.
            var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct };

            foreach (var overlay in singleDisplayOverlays)
            {
                overlay.StateChanged += state =>
                {
                    if (state == Visibility.Hidden)
                    {
                        return;
                    }

                    foreach (var c in singleDisplayOverlays)
                    {
                        if (c == overlay)
                        {
                            continue;
                        }
                        c.State = Visibility.Hidden;
                    }
                };
            }

            // eventually informational overlays should be displayed in a stack, but for now let's only allow one to stay open at a time.
            var informationalOverlays = new OverlayContainer[] { beatmapSetOverlay, userProfile };

            foreach (var overlay in informationalOverlays)
            {
                overlay.StateChanged += state =>
                {
                    if (state == Visibility.Hidden)
                    {
                        return;
                    }

                    foreach (var c in informationalOverlays)
                    {
                        if (c == overlay)
                        {
                            continue;
                        }
                        c.State = Visibility.Hidden;
                    }
                };
            }

            void updateScreenOffset()
            {
                float offset = 0;

                if (settings.State == Visibility.Visible)
                {
                    offset += ToolbarButton.WIDTH / 2;
                }
                if (notifications.State == Visibility.Visible)
                {
                    offset -= ToolbarButton.WIDTH / 2;
                }

                screenStack.MoveToX(offset, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint);
            }

            settings.StateChanged      += _ => updateScreenOffset();
            notifications.StateChanged += _ => updateScreenOffset();

            Cursor.State = Visibility.Hidden;
        }
Exemple #21
0
        private void load(TextureStore textures, ArborGame game, Story story)
        {
            InternalChildren = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Children         = new Drawable[]
                    {
                        new Sprite
                        {
                            Depth            = float.MaxValue,
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.Centre,
                            Texture          = textures.Get("Backgrounds/grass"),
                            Size             = Vector2.One,
                            RelativeSizeAxes = Axes.Both,
                            FillMode         = FillMode.Fill,
                        },
                        new Button
                        {
                            Position         = new Vector2(10, -160),
                            Anchor           = Anchor.CentreLeft,
                            Origin           = Anchor.CentreLeft,
                            Text             = "Load Test World",
                            CornerRadius     = 8,
                            Size             = new Vector2(200, 100),
                            Action           = () => this.Push(new GameScreen()),
                            BackgroundColour = Color4.Gray,
                        },
                        settings = new SettingsOverlay
                        {
                            Anchor           = Anchor.CentreRight,
                            Origin           = Anchor.CentreRight,
                            RelativeSizeAxes = Axes.Y,
                        },
                        new Button
                        {
                            Position         = new Vector2(10, 160),
                            Anchor           = Anchor.CentreLeft,
                            Origin           = Anchor.CentreLeft,
                            Text             = "Toggle Settings",
                            CornerRadius     = 8,
                            Size             = new Vector2(200, 100),
                            Action           = settings.ToggleVisibility,
                            BackgroundColour = Color4.Gray,
                        },
                        new SpriteText
                        {
                            Colour = Color4.Wheat,
                            Anchor = Anchor.TopLeft,
                            Origin = Anchor.TopLeft,
                            Font   = FontUsage.Default.With(size: 60),
                            Text   = $"Welcome to the \"{story.Name}\" game!"
                        },
                    }
                }
            };

            if (game.StoryStorage != null)
            {
                AddInternal(new Button
                {
                    Position         = new Vector2(10, 0),
                    Anchor           = Anchor.CentreLeft,
                    Origin           = Anchor.CentreLeft,
                    Text             = "Load Editor",
                    CornerRadius     = 8,
                    Size             = new Vector2(200, 100),
                    Action           = () => this.Push(new MapEditorScreen()),
                    BackgroundColour = Color4.Gray,
                });
            }
        }
Exemple #22
0
        protected override void LoadComplete()
        {
            // this needs to be cached before base.LoadComplete as it is used by MenuCursorContainer.
            dependencies.Cache(screenshotManager = new ScreenshotManager());

            base.LoadComplete();

            // The next time this is updated is in UpdateAfterChildren, which occurs too late and results
            // in the cursor being shown for a few frames during the intro.
            // This prevents the cursor from showing until we have a screen with CursorVisible = true
            MenuCursorContainer.CanShowCursor = currentScreen?.CursorVisible ?? false;

            // hook up notifications to components.
            SkinManager.PostNotification    = n => notifications?.Post(n);
            BeatmapManager.PostNotification = n => notifications?.Post(n);

            BeatmapManager.GetStableStorage = GetStorageForStableInstall;

            AddRange(new Drawable[]
            {
                new VolumeControlReceptor
                {
                    RelativeSizeAxes = Axes.Both,
                    ActionRequested  = action => volume.Adjust(action)
                },
                mainContent = new Container {
                    RelativeSizeAxes = Axes.Both
                },
                overlayContent = new Container {
                    RelativeSizeAxes = Axes.Both, Depth = float.MinValue
                },
            });

            loadComponentSingleFile(screenStack = new Loader(), d =>
            {
                screenStack.ModePushed += screenAdded;
                screenStack.Exited     += screenRemoved;
                mainContent.Add(screenStack);
            });

            loadComponentSingleFile(Toolbar = new Toolbar
            {
                Depth  = -5,
                OnHome = delegate
                {
                    hideAllOverlays();
                    intro?.ChildScreen?.MakeCurrent();
                },
            }, overlayContent.Add);

            loadComponentSingleFile(volume          = new VolumeOverlay(), overlayContent.Add);
            loadComponentSingleFile(onscreenDisplay = new OnScreenDisplay(), Add);

            loadComponentSingleFile(screenshotManager, Add);

            //overlay elements
            loadComponentSingleFile(direct = new DirectOverlay {
                Depth = -1
            }, mainContent.Add);
            loadComponentSingleFile(social = new SocialOverlay {
                Depth = -1
            }, mainContent.Add);
            loadComponentSingleFile(chat = new ChatOverlay {
                Depth = -1
            }, mainContent.Add);
            loadComponentSingleFile(settings = new MainSettings
            {
                GetToolbarHeight = () => ToolbarOffset,
                Depth            = -1
            }, overlayContent.Add);
            loadComponentSingleFile(userProfile = new UserProfileOverlay {
                Depth = -2
            }, mainContent.Add);
            loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay {
                Depth = -3
            }, mainContent.Add);
            loadComponentSingleFile(musicController = new MusicController
            {
                Depth    = -4,
                Position = new Vector2(0, Toolbar.HEIGHT),
                Anchor   = Anchor.TopRight,
                Origin   = Anchor.TopRight,
            }, overlayContent.Add);

            loadComponentSingleFile(notifications = new NotificationOverlay
            {
                GetToolbarHeight = () => ToolbarOffset,
                Depth            = -4,
                Anchor           = Anchor.TopRight,
                Origin           = Anchor.TopRight,
            }, overlayContent.Add);

            loadComponentSingleFile(dialogOverlay = new DialogOverlay
            {
                Depth = -6,
            }, overlayContent.Add);

            forwardLoggedErrorsToNotifications();

            dependencies.Cache(settings);
            dependencies.Cache(onscreenDisplay);
            dependencies.Cache(social);
            dependencies.Cache(direct);
            dependencies.Cache(chat);
            dependencies.Cache(userProfile);
            dependencies.Cache(musicController);
            dependencies.Cache(beatmapSetOverlay);
            dependencies.Cache(notifications);
            dependencies.Cache(dialogOverlay);

            // ensure only one of these overlays are open at once.
            var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct };

            foreach (var overlay in singleDisplayOverlays)
            {
                overlay.StateChanged += state =>
                {
                    if (state == Visibility.Hidden)
                    {
                        return;
                    }

                    foreach (var c in singleDisplayOverlays)
                    {
                        if (c == overlay)
                        {
                            continue;
                        }
                        c.State = Visibility.Hidden;
                    }
                };
            }

            var singleDisplaySideOverlays = new OverlayContainer[] { settings, notifications };

            foreach (var overlay in singleDisplaySideOverlays)
            {
                overlay.StateChanged += state =>
                {
                    if (state == Visibility.Hidden)
                    {
                        return;
                    }

                    foreach (var c in singleDisplaySideOverlays)
                    {
                        if (c == overlay)
                        {
                            continue;
                        }
                        c.State = Visibility.Hidden;
                    }
                };
            }

            // eventually informational overlays should be displayed in a stack, but for now let's only allow one to stay open at a time.
            var informationalOverlays = new OverlayContainer[] { beatmapSetOverlay, userProfile };

            foreach (var overlay in informationalOverlays)
            {
                overlay.StateChanged += state =>
                {
                    if (state == Visibility.Hidden)
                    {
                        return;
                    }

                    foreach (var c in informationalOverlays)
                    {
                        if (c == overlay)
                        {
                            continue;
                        }
                        c.State = Visibility.Hidden;
                    }
                };
            }

            void updateScreenOffset()
            {
                float offset = 0;

                if (settings.State == Visibility.Visible)
                {
                    offset += ToolbarButton.WIDTH / 2;
                }
                if (notifications.State == Visibility.Visible)
                {
                    offset -= ToolbarButton.WIDTH / 2;
                }

                screenStack.MoveToX(offset, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint);
            }

            settings.StateChanged      += _ => updateScreenOffset();
            notifications.StateChanged += _ => updateScreenOffset();

            notifications.Enabled.BindTo(AllowOpeningOverlays);

            HideOverlaysOnEnter.ValueChanged += hide =>
            {
                //central game screen change logic.
                if (hide)
                {
                    hideAllOverlays();
                    musicController.State = Visibility.Hidden;
                    Toolbar.State         = Visibility.Hidden;
                }
                else
                {
                    Toolbar.State = Visibility.Visible;
                }
            };
        }
    protected override void Init()
    {
        base.Init();

        Instance = this;
    }