Inheritance: osu.Framework.Graphics.Containers.Container
Exemple #1
0
        public override bool OnExiting(IScreen next)
        {
            if (ModSelect.State.Value == Visibility.Visible)
            {
                ModSelect.Hide();
                return(true);
            }

            if (base.OnExiting(next))
            {
                return(true);
            }

            beatmapInfoWedge.Hide();

            this.FadeOut(100);

            FilterControl.Deactivate();

            if (Beatmap.Value.Track != null)
            {
                Beatmap.Value.Track.Looping = false;
            }

            return(false);
        }
Exemple #2
0
        public override void OnResuming(IScreen last)
        {
            base.OnResuming(last);

            // required due to https://github.com/ppy/osu-framework/issues/3218
            ModSelect.SelectedMods.Disabled = false;
            ModSelect.SelectedMods.BindTo(selectedMods);

            Carousel.AllowSelection = true;

            BeatmapDetails.Refresh();

            Beatmap.Value.Track.Looping = true;
            music?.ResetTrackAdjustments();

            if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
            {
                updateComponentFromBeatmap(Beatmap.Value);

                // restart playback on returning to song select, regardless.
                music?.Play();
            }

            this.FadeIn(250);

            this.ScaleTo(1, 250, Easing.OutSine);

            FilterControl.Activate();
        }
Exemple #3
0
        private void workingBeatmapChanged(ValueChangedEvent <WorkingBeatmap> e)
        {
            if (e.NewValue is DummyWorkingBeatmap || !this.IsCurrentScreen())
            {
                return;
            }

            Logger.Log($"working beatmap updated to {e.NewValue}");

            if (!Carousel.SelectBeatmap(e.NewValue.BeatmapInfo, false))
            {
                // A selection may not have been possible with filters applied.

                // There was possibly a ruleset mismatch. This is a case we can help things along by updating the game-wide ruleset to match.
                if (e.NewValue.BeatmapInfo.Ruleset != null && !e.NewValue.BeatmapInfo.Ruleset.Equals(decoupledRuleset.Value))
                {
                    Ruleset.Value = e.NewValue.BeatmapInfo.Ruleset;
                    transferRulesetValue();
                }

                // Even if a ruleset mismatch was not the cause (ie. a text filter is applied),
                // we still want to temporarily show the new beatmap, bypassing filters.
                // This will be undone the next time the user changes the filter.
                var criteria = FilterControl.CreateCriteria();
                criteria.SelectedBeatmapSet = e.NewValue.BeatmapInfo.BeatmapSet;
                Carousel.Filter(criteria);

                Carousel.SelectBeatmap(e.NewValue.BeatmapInfo);
            }
        }
Exemple #4
0
        public override void OnEntering(IScreen last)
        {
            base.OnEntering(last);

            Carousel.Filter(FilterControl.CreateCriteria(), false);

            this.FadeInFromZero(250);
            FilterControl.Activate();
        }
Exemple #5
0
        public override void OnEntering(IScreen last)
        {
            base.OnEntering(last);

            this.FadeInFromZero(250);
            FilterControl.Activate();

            ModSelect.SelectedMods.BindTo(selectedMods);
        }
Exemple #6
0
        public override void OnEntering(IScreen last)
        {
            base.OnEntering(last);

            this.FadeInFromZero(250);
            FilterControl.Activate();

            ModSelect.SelectedMods.BindTo(selectedMods);

            music.TrackChanged += ensureTrackLooping;
        }
Exemple #7
0
        public override void OnSuspending(IScreen next)
        {
            ModSelect.Hide();

            BeatmapOptions.Hide();

            this.ScaleTo(1.1f, 250, Easing.InSine);

            this.FadeOut(250);

            FilterControl.Deactivate();
            base.OnSuspending(next);
        }
Exemple #8
0
        public override void OnSuspending(IScreen next)
        {
            ModSelect.SelectedMods.UnbindFrom(selectedMods);
            ModSelect.Hide();

            BeatmapOptions.Hide();

            music.CurrentTrack.Looping = false;

            this.ScaleTo(1.1f, 250, Easing.InSine);

            this.FadeOut(250);

            FilterControl.Deactivate();
            base.OnSuspending(next);
        }
Exemple #9
0
        public override bool OnExiting(IScreen next)
        {
            if (base.OnExiting(next))
            {
                return(true);
            }

            beatmapInfoWedge.Hide();

            this.FadeOut(100);

            FilterControl.Deactivate();

            endLooping();

            return(false);
        }
Exemple #10
0
        public override bool OnExiting(IScreen next)
        {
            if (base.OnExiting(next))
            {
                return(true);
            }

            beatmapInfoWedge.Hide();

            this.FadeOut(100);

            FilterControl.Deactivate();

            music.CurrentTrack.Looping = false;
            music.TrackChanged        -= ensureTrackLooping;

            return(false);
        }
Exemple #11
0
        public override void OnResuming(IScreen last)
        {
            BeatmapDetails.Leaderboard.RefreshScores();

            Beatmap.Value.Track.Looping = true;
            music?.ResetTrackAdjustments();

            if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
            {
                UpdateBeatmap(Beatmap.Value);

                // restart playback on returning to song select, regardless.
                music?.Play();
            }

            base.OnResuming(last);

            this.FadeIn(250);

            this.ScaleTo(1, 250, Easing.OutSine);

            FilterControl.Activate();
        }
Exemple #12
0
        private void load(BeatmapDatabase beatmaps, AudioManager audio, Framework.Game game,
                          OsuGame osuGame, OsuColour colours)
        {
            const float carousel_width = 640;
            const float filter_height  = 100;

            beatmapGroups = new List <BeatmapGroup>();
            Children      = new Drawable[]
            {
                new ParallaxContainer
                {
                    Padding = new MarginPadding {
                        Top = filter_height
                    },
                    ParallaxAmount   = 0.005f,
                    RelativeSizeAxes = Axes.Both,
                    Children         = new[]
                    {
                        new WedgeBackground
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding
                            {
                                Right = carousel_width * 0.76f
                            },
                        },
                    }
                },
                carousel = new CarouselContainer
                {
                    RelativeSizeAxes = Axes.Y,
                    Size             = new Vector2(carousel_width, 1),
                    Anchor           = Anchor.CentreRight,
                    Origin           = Anchor.CentreRight,
                },
                filter = new FilterControl
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = filter_height,
                    FilterChanged    = filterChanged,
                    Exit             = Exit,
                },
                beatmapInfoWedge = new BeatmapInfoWedge
                {
                    Alpha            = 0,
                    Size             = wedged_container_size,
                    RelativeSizeAxes = Axes.X,
                    Margin           = new MarginPadding
                    {
                        Top   = 20,
                        Right = 20,
                    },
                },
                footer = new Footer
                {
                    OnBack  = Exit,
                    OnStart = () =>
                    {
                        if (player != null || Beatmap == null)
                        {
                            return;
                        }

                        (player = new PlayerLoader(new Player
                        {
                            BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap,
                            PreferredPlayMode = playMode.Value
                        })).LoadAsync(Game, l => Push(player));
                    }
                }
            };

            footer.AddButton(@"mods", colours.Yellow, null);
            footer.AddButton(@"random", colours.Green, carousel.SelectRandom);
            footer.AddButton(@"options", colours.Blue, null);

            if (osuGame != null)
            {
                playMode = osuGame.PlayMode;
                playMode.ValueChanged += playMode_ValueChanged;
            }

            if (database == null)
            {
                database = beatmaps;
            }

            database.BeatmapSetAdded   += onBeatmapSetAdded;
            database.BeatmapSetRemoved += onBeatmapSetRemoved;

            trackManager = audio.Track;

            sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty");
            sampleChangeBeatmap    = audio.Sample.Get(@"SongSelect/select-expand");

            initialAddSetsTask = new CancellationTokenSource();

            Task.Factory.StartNew(() => addBeatmapSets(game, initialAddSetsTask.Token), initialAddSetsTask.Token);
        }
Exemple #13
0
        private readonly Bindable <IReadOnlyList <Mod> > mods = new Bindable <IReadOnlyList <Mod> >(Array.Empty <Mod>()); // Bound to the game's mods, but is not reset on exiting

        protected SongSelect()
        {
            AddRangeInternal(new Drawable[]
            {
                new ParallaxContainer
                {
                    Masking          = true,
                    ParallaxAmount   = 0.005f,
                    RelativeSizeAxes = Axes.Both,
                    Children         = new[]
                    {
                        new WedgeBackground
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Right = -150
                            },
                            Size = new Vector2(wedged_container_size.X, 1),
                        }
                    }
                },
                new Container
                {
                    Origin           = Anchor.BottomLeft,
                    Anchor           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.Both,
                    Size             = new Vector2(wedged_container_size.X, 1),
                    Padding          = new MarginPadding
                    {
                        Bottom = Footer.HEIGHT,
                        Top    = wedged_container_size.Y + left_area_padding,
                        Left   = left_area_padding,
                        Right  = left_area_padding * 2,
                    },
                    Child = BeatmapDetails = new BeatmapDetailArea
                    {
                        RelativeSizeAxes = Axes.Both,
                        Padding          = new MarginPadding {
                            Top = 10, Right = 5
                        },
                    }
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Masking          = true,
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    Width            = 2, //avoid horizontal masking so the panels don't clip when screen stack is pushed.
                    Child            = new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        Width            = 0.5f,
                        Children         = new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding
                                {
                                    Top    = FilterControl.HEIGHT,
                                    Bottom = Footer.HEIGHT
                                },
                                Child = Carousel = new BeatmapCarousel
                                {
                                    RelativeSizeAxes   = Axes.Both,
                                    Size               = new Vector2(1 - wedged_container_size.X, 1),
                                    Anchor             = Anchor.CentreRight,
                                    Origin             = Anchor.CentreRight,
                                    SelectionChanged   = updateSelectedBeatmap,
                                    BeatmapSetsChanged = carouselBeatmapsLoaded,
                                },
                            },
                            FilterControl = new FilterControl
                            {
                                RelativeSizeAxes = Axes.X,
                                Height           = FilterControl.HEIGHT,
                                FilterChanged    = c => Carousel.Filter(c),
                                Background       = { Width = 2 },
                                Exit             = () =>
                                {
                                    if (this.IsCurrentScreen())
                                    {
                                        this.Exit();
                                    }
                                },
                            },
                        }
                    },
                },
                beatmapInfoWedge = new BeatmapInfoWedge
                {
                    Size             = wedged_container_size,
                    RelativeSizeAxes = Axes.X,
                    Margin           = new MarginPadding
                    {
                        Top   = left_area_padding,
                        Right = left_area_padding,
                    },
                },
                new ResetScrollContainer(() => Carousel.ScrollToSelected())
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = 250,
                }
            });

            if (ShowFooter)
            {
                AddRangeInternal(new[]
                {
                    FooterPanels = new Container
                    {
                        Anchor           = Anchor.BottomLeft,
                        Origin           = Anchor.BottomLeft,
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Margin           = new MarginPadding {
                            Bottom = Footer.HEIGHT
                        },
                        Children = new Drawable[]
                        {
                            BeatmapOptions = new BeatmapOptionsOverlay(),
                            ModSelect      = new ModSelectOverlay
                            {
                                RelativeSizeAxes = Axes.X,
                                Origin           = Anchor.BottomCentre,
                                Anchor           = Anchor.BottomCentre,
                            }
                        }
                    },
                    Footer = new Footer()
                });
            }

            BeatmapDetails.Leaderboard.ScoreSelected += s => this.Push(new SoloResults(s));
        }
Exemple #14
0
        private void load(AudioManager audio, IDialogOverlay dialog, OsuColour colours, ManageCollectionsDialog manageCollectionsDialog, DifficultyRecommender recommender)
        {
            // initial value transfer is required for FilterControl (it uses our re-cached bindables in its async load for the initial filter).
            transferRulesetValue();

            LoadComponentAsync(Carousel = new BeatmapCarousel
            {
                AllowSelection        = false, // delay any selection until our bindables are ready to make a good choice.
                Anchor                = Anchor.CentreRight,
                Origin                = Anchor.CentreRight,
                RelativeSizeAxes      = Axes.Both,
                BleedTop              = FilterControl.HEIGHT,
                BleedBottom           = Footer.HEIGHT,
                SelectionChanged      = updateSelectedBeatmap,
                BeatmapSetsChanged    = carouselBeatmapsLoaded,
                GetRecommendedBeatmap = s => recommender?.GetRecommendedBeatmap(s),
            }, c => carouselContainer.Child = c);

            AddRangeInternal(new Drawable[]
            {
                new ResetScrollContainer(() => Carousel.ScrollToSelected())
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = 250,
                },
                new VerticalMaskingContainer
                {
                    Children = new Drawable[]
                    {
                        new GridContainer // used for max width implementation
                        {
                            RelativeSizeAxes = Axes.Both,
                            ColumnDimensions = new[]
                            {
                                new Dimension(),
                                new Dimension(GridSizeMode.Relative, 0.5f, maxSize: 850),
                            },
                            Content = new[]
                            {
                                new Drawable[]
                                {
                                    new ParallaxContainer
                                    {
                                        ParallaxAmount   = 0.005f,
                                        RelativeSizeAxes = Axes.Both,
                                        Child            = new WedgeBackground
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Padding          = new MarginPadding {
                                                Right = -150
                                            },
                                        },
                                    },
                                    carouselContainer = new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Padding          = new MarginPadding
                                        {
                                            Top    = FilterControl.HEIGHT,
                                            Bottom = Footer.HEIGHT
                                        },
                                        Child = new LoadingSpinner(true)
                                        {
                                            State = { Value = Visibility.Visible }
                                        }
                                    }
                                },
                            }
                        },
                        FilterControl = new FilterControl
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = FilterControl.HEIGHT,
                            FilterChanged    = ApplyFilterToCarousel,
                        },
                        new GridContainer // used for max width implementation
                        {
                            RelativeSizeAxes = Axes.Both,
                            ColumnDimensions = new[]
                            {
                                new Dimension(GridSizeMode.Relative, 0.5f, maxSize: 650),
                            },
                            Content = new[]
                            {
                                new Drawable[]
                                {
                                    LeftArea = new Container
                                    {
                                        Origin           = Anchor.BottomLeft,
                                        Anchor           = Anchor.BottomLeft,
                                        RelativeSizeAxes = Axes.Both,
                                        Padding          = new MarginPadding {
                                            Top = left_area_padding
                                        },
                                        Children = new Drawable[]
                                        {
                                            beatmapInfoWedge = new BeatmapInfoWedge
                                            {
                                                Height           = WEDGE_HEIGHT,
                                                RelativeSizeAxes = Axes.X,
                                                Margin           = new MarginPadding
                                                {
                                                    Right = left_area_padding,
                                                    Left  = -BeatmapInfoWedge.BORDER_THICKNESS, // Hide the left border
                                                },
                                            },
                                            new Container
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Padding          = new MarginPadding
                                                {
                                                    Bottom = Footer.HEIGHT,
                                                    Top    = WEDGE_HEIGHT,
                                                    Left   = left_area_padding,
                                                    Right  = left_area_padding * 2,
                                                },
                                                Child = BeatmapDetails = CreateBeatmapDetailArea().With(d =>
                                                {
                                                    d.RelativeSizeAxes = Axes.Both;
                                                    d.Padding          = new MarginPadding {
                                                        Top = 10, Right = 5
                                                    };
                                                })
                                            },
                                        }
                                    },
                                },
                            }
                        }
                    }
                },
                new SkinnableTargetContainer(SkinnableTarget.SongSelect)
                {
                    RelativeSizeAxes = Axes.Both,
                },
            });

            if (ShowFooter)
            {
                AddRangeInternal(new Drawable[]
                {
                    FooterPanels = new Container
                    {
                        Anchor           = Anchor.BottomLeft,
                        Origin           = Anchor.BottomLeft,
                        RelativeSizeAxes = Axes.Both,
                        Padding          = new MarginPadding {
                            Bottom = Footer.HEIGHT
                        },
                        Children = new Drawable[]
                        {
                            BeatmapOptions = new BeatmapOptionsOverlay(),
                        }
                    },
                    Footer = new Footer(),
                });
            }

            // preload the mod select overlay for later use in `LoadComplete()`.
            // therein it will be registered at the `OsuGame` level to properly function as a blocking overlay.
            LoadComponent(ModSelect = CreateModSelectOverlay());

            if (Footer != null)
            {
                foreach (var(button, overlay) in CreateFooterButtons())
                {
                    Footer.AddButton(button, overlay);
                }

                BeatmapOptions.AddButton(@"Manage", @"collections", FontAwesome.Solid.Book, colours.Green, () => manageCollectionsDialog?.Show());
                BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo));
                BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null);
                BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo));
            }

            dialogOverlay = dialog;

            sampleChangeDifficulty = audio.Samples.Get(@"SongSelect/select-difficulty");
            sampleChangeBeatmap    = audio.Samples.Get(@"SongSelect/select-expand");
            SampleConfirm          = audio.Samples.Get(@"SongSelect/confirm-selection");

            if (dialogOverlay != null)
            {
                Schedule(() =>
                {
                    // if we have no beatmaps, let's prompt the user to import from over a stable install if he has one.
                    if (beatmaps.QueryBeatmapSet(s => !s.Protected && !s.DeletePending) == null && DisplayStableImportPrompt)
                    {
                        dialogOverlay.Push(new ImportFromStablePopup(() =>
                        {
                            Task.Run(() => legacyImportManager.ImportFromStableAsync(StableContent.All));
                        }));
                    }
                });
            }
        }
Exemple #15
0
        protected SongSelect()
        {
            const float carousel_width = 640;
            const float filter_height  = 100;

            beatmapGroups = new List <BeatmapGroup>();
            Add(new ParallaxContainer
            {
                Padding = new MarginPadding {
                    Top = filter_height
                },
                ParallaxAmount   = 0.005f,
                RelativeSizeAxes = Axes.Both,
                Children         = new[]
                {
                    new WedgeBackground
                    {
                        RelativeSizeAxes = Axes.Both,
                        Padding          = new MarginPadding {
                            Right = carousel_width * 0.76f
                        },
                    }
                }
            });
            Add(carousel = new CarouselContainer
            {
                RelativeSizeAxes = Axes.Y,
                Size             = new Vector2(carousel_width, 1),
                Anchor           = Anchor.CentreRight,
                Origin           = Anchor.CentreRight,
            });
            Add(filter = new FilterControl
            {
                RelativeSizeAxes = Axes.X,
                Height           = filter_height,
                FilterChanged    = () => filterChanged(),
                Exit             = Exit,
            });
            Add(beatmapInfoWedge = new BeatmapInfoWedge
            {
                Alpha            = 0,
                Size             = wedged_container_size,
                RelativeSizeAxes = Axes.X,
                Margin           = new MarginPadding
                {
                    Top   = 20,
                    Right = 20,
                },
                X = -50,
            });

            if (ShowFooter)
            {
                Add(BeatmapOptions = new BeatmapOptionsOverlay
                {
                    Margin = new MarginPadding
                    {
                        Bottom = 50,
                    },
                });
                Add(Footer = new Footer
                {
                    OnBack  = Exit,
                    OnStart = raiseSelect,
                });
            }
        }
Exemple #16
0
        protected SongSelect()
        {
            const float carousel_width = 640;
            const float filter_height  = 100;

            AddRange(new Drawable[]
            {
                new ParallaxContainer
                {
                    Padding = new MarginPadding {
                        Top = filter_height
                    },
                    ParallaxAmount   = 0.005f,
                    RelativeSizeAxes = Axes.Both,
                    Children         = new[]
                    {
                        new WedgeBackground
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Right = carousel_width * 0.76f
                            },
                        }
                    }
                },
                LeftContent = new Container
                {
                    Origin           = Anchor.BottomLeft,
                    Anchor           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.Both,
                    Size             = new Vector2(wedged_container_size.X, 1),
                    Padding          = new MarginPadding
                    {
                        Bottom = 50,
                        Top    = wedged_container_size.Y + left_area_padding,
                        Left   = left_area_padding,
                        Right  = left_area_padding * 2,
                    }
                },
                carousel = new BeatmapCarousel
                {
                    RelativeSizeAxes   = Axes.Y,
                    Size               = new Vector2(carousel_width, 1),
                    Anchor             = Anchor.CentreRight,
                    Origin             = Anchor.CentreRight,
                    SelectionChanged   = carouselSelectionChanged,
                    BeatmapSetsChanged = carouselBeatmapsLoaded,
                },
                FilterControl = new FilterControl
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = filter_height,
                    FilterChanged    = c => carousel.Filter(c),
                    Exit             = Exit,
                },
                beatmapInfoWedge = new BeatmapInfoWedge
                {
                    Alpha            = 0,
                    Size             = wedged_container_size,
                    RelativeSizeAxes = Axes.X,
                    Margin           = new MarginPadding
                    {
                        Top   = left_area_padding,
                        Right = left_area_padding,
                    },
                },
                new ResetScrollContainer(() => carousel.ScrollToSelected())
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = 250,
                }
            });

            if (ShowFooter)
            {
                Add(FooterPanels = new Container
                {
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Margin           = new MarginPadding
                    {
                        Bottom = Footer.HEIGHT,
                    },
                });
                Add(Footer = new Footer
                {
                    OnBack = Exit,
                });

                FooterPanels.Add(BeatmapOptions = new BeatmapOptionsOverlay());
            }
        }
Exemple #17
0
        protected SongSelect()
        {
            const float carousel_width = 640;
            const float filter_height  = 100;

            Add(new ParallaxContainer
            {
                Padding = new MarginPadding {
                    Top = filter_height
                },
                ParallaxAmount   = 0.005f,
                RelativeSizeAxes = Axes.Both,
                Children         = new[]
                {
                    new WedgeBackground
                    {
                        RelativeSizeAxes = Axes.Both,
                        Padding          = new MarginPadding {
                            Right = carousel_width * 0.76f
                        },
                    }
                }
            });
            Add(LeftContent = new Container
            {
                Origin           = Anchor.BottomLeft,
                Anchor           = Anchor.BottomLeft,
                RelativeSizeAxes = Axes.Both,
                Size             = new Vector2(wedged_container_size.X, 1),
                Padding          = new MarginPadding
                {
                    Bottom = 50,
                    Top    = wedged_container_size.Y + left_area_padding,
                    Left   = left_area_padding,
                    Right  = left_area_padding * 2,
                }
            });
            Add(carousel = new BeatmapCarousel
            {
                RelativeSizeAxes = Axes.Y,
                Size             = new Vector2(carousel_width, 1),
                Anchor           = Anchor.CentreRight,
                Origin           = Anchor.CentreRight,
                SelectionChanged = selectionChanged,
                StartRequested   = raiseSelect
            });
            Add(FilterControl = new FilterControl
            {
                RelativeSizeAxes = Axes.X,
                Height           = filter_height,
                FilterChanged    = criteria => filterChanged(criteria),
                Exit             = Exit,
            });
            Add(beatmapInfoWedge = new BeatmapInfoWedge
            {
                Alpha            = 0,
                Size             = wedged_container_size,
                RelativeSizeAxes = Axes.X,
                Margin           = new MarginPadding
                {
                    Top   = left_area_padding,
                    Right = left_area_padding,
                },
                X = -50,
            });

            if (ShowFooter)
            {
                Add(FooterPanels = new Container
                {
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Margin           = new MarginPadding
                    {
                        Bottom = Footer.HEIGHT,
                    },
                });
                Add(Footer = new Footer
                {
                    OnBack  = Exit,
                    OnStart = raiseSelect,
                });

                FooterPanels.Add(BeatmapOptions = new BeatmapOptionsOverlay());
            }
        }
Exemple #18
0
        protected SongSelect()
        {
            const float carousel_width = 640;
            const float filter_height  = 100;

            Add(new ParallaxContainer
            {
                Padding = new MarginPadding {
                    Top = filter_height
                },
                ParallaxAmount   = 0.005f,
                RelativeSizeAxes = Axes.Both,
                Children         = new[]
                {
                    new WedgeBackground
                    {
                        RelativeSizeAxes = Axes.Both,
                        Padding          = new MarginPadding {
                            Right = carousel_width * 0.76f
                        },
                    }
                }
            });
            Add(LeftContent = new Container
            {
                Origin           = Anchor.BottomLeft,
                Anchor           = Anchor.BottomLeft,
                RelativeSizeAxes = Axes.Both,
                Size             = new Vector2(wedged_container_size.X, 1),
                Padding          = new MarginPadding
                {
                    Bottom = 50,
                    Top    = wedged_container_size.Y + left_area_padding,
                    Left   = left_area_padding,
                    Right  = left_area_padding * 2,
                }
            });
            Add(carousel = new BeatmapCarousel
            {
                RelativeSizeAxes = Axes.Y,
                Size             = new Vector2(carousel_width, 1),
                Anchor           = Anchor.CentreRight,
                Origin           = Anchor.CentreRight,
                SelectionChanged = carouselSelectionChanged,
                BeatmapsChanged  = carouselBeatmapsLoaded,
                DeleteRequested  = promptDelete,
                RestoreRequested = s => { foreach (var b in s.Beatmaps)
                                          {
                                              beatmaps.Restore(b);
                                          }
                },
                EditRequested           = editRequested,
                HideDifficultyRequested = b => beatmaps.Hide(b),
                StartRequested          = () => carouselRaisedStart(),
            });
            Add(FilterControl = new FilterControl
            {
                RelativeSizeAxes = Axes.X,
                Height           = filter_height,
                FilterChanged    = criteria => filterChanged(criteria),
                Exit             = Exit,
            });
            Add(beatmapInfoWedge = new BeatmapInfoWedge
            {
                Alpha            = 0,
                Size             = wedged_container_size,
                RelativeSizeAxes = Axes.X,
                Margin           = new MarginPadding
                {
                    Top   = left_area_padding,
                    Right = left_area_padding,
                },
            });
            Add(new ResetScrollContainer(() => carousel.ScrollToSelected())
            {
                RelativeSizeAxes = Axes.Y,
                Width            = 250,
            });

            if (ShowFooter)
            {
                Add(FooterPanels = new Container
                {
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Margin           = new MarginPadding
                    {
                        Bottom = Footer.HEIGHT,
                    },
                });
                Add(Footer = new Footer
                {
                    OnBack  = Exit,
                    OnStart = () => carouselRaisedStart(),
                });

                FooterPanels.Add(BeatmapOptions = new BeatmapOptionsOverlay());
            }
        }
Exemple #19
0
        private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, Framework.Game game,
                          OsuGame osu, OsuColour colours)
        {
            const float carousel_width = 640;
            const float filter_height  = 100;

            beatmapGroups = new List <BeatmapGroup>();
            Children      = new Drawable[]
            {
                new ParallaxContainer
                {
                    Padding = new MarginPadding {
                        Top = filter_height
                    },
                    ParallaxAmount   = 0.005f,
                    RelativeSizeAxes = Axes.Both,
                    Children         = new[]
                    {
                        new WedgeBackground
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding
                            {
                                Right = carousel_width * 0.76f
                            },
                        },
                    }
                },
                carousel = new CarouselContainer
                {
                    RelativeSizeAxes = Axes.Y,
                    Size             = new Vector2(carousel_width, 1),
                    Anchor           = Anchor.CentreRight,
                    Origin           = Anchor.CentreRight,
                },
                filter = new FilterControl
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = filter_height,
                    FilterChanged    = () => filterChanged(),
                    Exit             = Exit,
                },
                beatmapInfoWedge = new BeatmapInfoWedge
                {
                    Alpha            = 0,
                    Size             = wedged_container_size,
                    RelativeSizeAxes = Axes.X,
                    Margin           = new MarginPadding
                    {
                        Top   = 20,
                        Right = 20,
                    },
                },
                beatmapOptions = new BeatmapOptionsOverlay
                {
                    OnRemoveFromUnplayed = null,
                    OnClearLocalScores   = null,
                    OnEdit   = null,
                    OnDelete = promptDelete,
                    Margin   = new MarginPadding
                    {
                        Bottom = 50,
                    },
                },
                modSelect = new ModSelectOverlay
                {
                    RelativeSizeAxes = Axes.X,
                    Origin           = Anchor.BottomCentre,
                    Anchor           = Anchor.BottomCentre,
                    Margin           = new MarginPadding
                    {
                        Bottom = 50,
                    },
                },
                footer = new Footer
                {
                    OnBack  = Exit,
                    OnStart = () =>
                    {
                        if (player != null || Beatmap == null)
                        {
                            return;
                        }

                        Beatmap.PreferredPlayMode = playMode.Value;

                        (player = new PlayerLoader(new Player
                        {
                            Beatmap = Beatmap, //eagerly set this so it's present before push.
                        })).LoadAsync(Game, l => Push(player));
                    }
                },
            };

            footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility);
            footer.AddButton(@"random", colours.Green, carousel.SelectRandom);
            footer.AddButton(@"options", colours.Blue, beatmapOptions.ToggleVisibility);

            if (osu != null)
            {
                playMode.BindTo(osu.PlayMode);
            }
            playMode.ValueChanged += playMode_ValueChanged;

            if (database == null)
            {
                database = beatmaps;
            }

            database.BeatmapSetAdded   += onBeatmapSetAdded;
            database.BeatmapSetRemoved += onBeatmapSetRemoved;

            trackManager  = audio.Track;
            dialogOverlay = dialog;

            sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty");
            sampleChangeBeatmap    = audio.Sample.Get(@"SongSelect/select-expand");

            initialAddSetsTask = new CancellationTokenSource();

            Task.Factory.StartNew(() => addBeatmapSets(game, initialAddSetsTask.Token), initialAddSetsTask.Token);
        }
Exemple #20
0
        private void load(AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, ScoreManager scores, CollectionManager collections, ManageCollectionsDialog manageCollectionsDialog, DifficultyRecommender recommender)
        {
            // initial value transfer is required for FilterControl (it uses our re-cached bindables in its async load for the initial filter).
            transferRulesetValue();

            LoadComponentAsync(Carousel = new BeatmapCarousel
            {
                AllowSelection        = false, // delay any selection until our bindables are ready to make a good choice.
                Anchor                = Anchor.CentreRight,
                Origin                = Anchor.CentreRight,
                RelativeSizeAxes      = Axes.Both,
                BleedTop              = FilterControl.HEIGHT,
                BleedBottom           = Footer.HEIGHT,
                SelectionChanged      = updateSelectedBeatmap,
                BeatmapSetsChanged    = carouselBeatmapsLoaded,
                GetRecommendedBeatmap = s => recommender?.GetRecommendedBeatmap(s),
            }, c => carouselContainer.Child = c);

            AddRangeInternal(new Drawable[]
            {
                new ResetScrollContainer(() => Carousel.ScrollToSelected())
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = 250,
                },
                new VerticalMaskingContainer
                {
                    Children = new Drawable[]
                    {
                        new GridContainer // used for max width implementation
                        {
                            RelativeSizeAxes = Axes.Both,
                            ColumnDimensions = new[]
                            {
                                new Dimension(),
                                new Dimension(GridSizeMode.Relative, 0.5f, maxSize: 850),
                            },
                            Content = new[]
                            {
                                new Drawable[]
                                {
                                    new ParallaxContainer
                                    {
                                        ParallaxAmount   = 0.005f,
                                        RelativeSizeAxes = Axes.Both,
                                        Child            = new WedgeBackground
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Padding          = new MarginPadding {
                                                Right = -150
                                            },
                                        },
                                    },
                                    carouselContainer = new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Padding          = new MarginPadding
                                        {
                                            Top    = FilterControl.HEIGHT,
                                            Bottom = Footer.HEIGHT
                                        },
                                        Child = new LoadingSpinner(true)
                                        {
                                            State = { Value = Visibility.Visible }
                                        }
                                    }
                                },
                            }
                        },
                        FilterControl = new FilterControl
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = FilterControl.HEIGHT,
                            FilterChanged    = ApplyFilterToCarousel,
                        },
                        new GridContainer // used for max width implementation
                        {
                            RelativeSizeAxes = Axes.Both,
                            ColumnDimensions = new[]
                            {
                                new Dimension(GridSizeMode.Relative, 0.5f, maxSize: 650),
                            },
                            Content = new[]
                            {
                                new Drawable[]
                                {
                                    new Container
                                    {
                                        Origin           = Anchor.BottomLeft,
                                        Anchor           = Anchor.BottomLeft,
                                        RelativeSizeAxes = Axes.Both,

                                        Children = new Drawable[]
                                        {
                                            beatmapInfoWedge = new BeatmapInfoWedge
                                            {
                                                Height           = WEDGE_HEIGHT,
                                                RelativeSizeAxes = Axes.X,
                                                Margin           = new MarginPadding
                                                {
                                                    Top   = left_area_padding,
                                                    Right = left_area_padding,
                                                },
                                            },
                                            new Container
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Padding          = new MarginPadding
                                                {
                                                    Bottom = Footer.HEIGHT,
                                                    Top    = WEDGE_HEIGHT + left_area_padding,
                                                    Left   = left_area_padding,
                                                    Right  = left_area_padding * 2,
                                                },
                                                Child = BeatmapDetails = CreateBeatmapDetailArea().With(d =>
                                                {
                                                    d.RelativeSizeAxes = Axes.Both;
                                                    d.Padding          = new MarginPadding {
                                                        Top = 10, Right = 5
                                                    };
                                                })
                                            },
                                        }
                                    },
                                },
                            }
                        }
                    }
                },
            });

            if (ShowFooter)
            {
                AddRangeInternal(new Drawable[]
                {
                    new GridContainer // used for max height implementation
                    {
                        RelativeSizeAxes = Axes.Both,
                        RowDimensions    = new[]
                        {
                            new Dimension(),
                            new Dimension(GridSizeMode.Relative, 1f, maxSize: ModSelectOverlay.HEIGHT + Footer.HEIGHT),
                        },
                        Content = new[]
                        {
                            null,
                            new Drawable[]
                            {
                                FooterPanels = new Container
                                {
                                    Anchor           = Anchor.BottomLeft,
                                    Origin           = Anchor.BottomLeft,
                                    RelativeSizeAxes = Axes.Both,
                                    Padding          = new MarginPadding {
                                        Bottom = Footer.HEIGHT
                                    },
                                    Children = new Drawable[]
                                    {
                                        BeatmapOptions = new BeatmapOptionsOverlay(),
                                        ModSelect      = CreateModSelectOverlay()
                                    }
                                }
                            }
                        }
                    },
                    Footer = new Footer()
                });
            }

            if (Footer != null)
            {
                foreach (var(button, overlay) in CreateFooterButtons())
                {
                    Footer.AddButton(button, overlay);
                }

                BeatmapOptions.AddButton(@"Manage", @"collections", FontAwesome.Solid.Book, colours.Green, () => manageCollectionsDialog?.Show());
                BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo));
                BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null);
                BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo));
            }

            dialogOverlay = dialog;

            sampleChangeDifficulty = audio.Samples.Get(@"SongSelect/select-difficulty");
            sampleChangeBeatmap    = audio.Samples.Get(@"SongSelect/select-expand");
            SampleConfirm          = audio.Samples.Get(@"SongSelect/confirm-selection");

            if (dialogOverlay != null)
            {
                Schedule(() =>
                {
                    // if we have no beatmaps but osu-stable is found, let's prompt the user to import.
                    if (!beatmaps.GetAllUsableBeatmapSetsEnumerable(IncludedDetails.Minimal).Any() && beatmaps.StableInstallationAvailable)
                    {
                        dialogOverlay.Push(new ImportFromStablePopup(() =>
                        {
                            Task.Run(beatmaps.ImportFromStableAsync)
                            .ContinueWith(_ =>
                            {
                                Task.Run(scores.ImportFromStableAsync);
                                Task.Run(collections.ImportFromStableAsync);
                            }, TaskContinuationOptions.OnlyOnRanToCompletion);
                            Task.Run(skins.ImportFromStableAsync);
                        }));
                    }
                });
            }
        }
Exemple #21
0
        private void load(AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, ScoreManager scores)
        {
            // initial value transfer is required for FilterControl (it uses our re-cached bindables in its async load for the initial filter).
            transferRulesetValue();

            AddRangeInternal(new Drawable[]
            {
                new ResetScrollContainer(() => Carousel.ScrollToSelected())
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = 250,
                },
                new VerticalMaskingContainer
                {
                    Children = new Drawable[]
                    {
                        new GridContainer // used for max width implementation
                        {
                            RelativeSizeAxes = Axes.Both,
                            ColumnDimensions = new[]
                            {
                                new Dimension(),
                                new Dimension(GridSizeMode.Relative, 0.5f, maxSize: 850),
                            },
                            Content = new[]
                            {
                                new Drawable[]
                                {
                                    new ParallaxContainer
                                    {
                                        ParallaxAmount   = 0.005f,
                                        RelativeSizeAxes = Axes.Both,
                                        Child            = new WedgeBackground
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Padding          = new MarginPadding {
                                                Right = -150
                                            },
                                        },
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Padding          = new MarginPadding
                                        {
                                            Top    = FilterControl.HEIGHT,
                                            Bottom = Footer.HEIGHT
                                        },
                                        Child = Carousel = new BeatmapCarousel
                                        {
                                            Anchor             = Anchor.CentreRight,
                                            Origin             = Anchor.CentreRight,
                                            RelativeSizeAxes   = Axes.Both,
                                            SelectionChanged   = updateSelectedBeatmap,
                                            BeatmapSetsChanged = carouselBeatmapsLoaded,
                                        },
                                    }
                                },
                            }
                        },
                        FilterControl = new FilterControl
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = FilterControl.HEIGHT,
                            FilterChanged    = ApplyFilterToCarousel,
                            Background       = { Width = 2 },
                        },
                        new GridContainer // used for max width implementation
                        {
                            RelativeSizeAxes = Axes.Both,
                            ColumnDimensions = new[]
                            {
                                new Dimension(GridSizeMode.Relative, 0.5f, maxSize: 650),
                            },
                            Content = new[]
                            {
                                new Drawable[]
                                {
                                    new Container
                                    {
                                        Origin           = Anchor.BottomLeft,
                                        Anchor           = Anchor.BottomLeft,
                                        RelativeSizeAxes = Axes.Both,

                                        Children = new Drawable[]
                                        {
                                            beatmapInfoWedge = new BeatmapInfoWedge
                                            {
                                                Height           = WEDGE_HEIGHT,
                                                RelativeSizeAxes = Axes.X,
                                                Margin           = new MarginPadding
                                                {
                                                    Top   = left_area_padding,
                                                    Right = left_area_padding,
                                                },
                                            },
                                            new Container
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Padding          = new MarginPadding
                                                {
                                                    Bottom = Footer.HEIGHT,
                                                    Top    = WEDGE_HEIGHT + left_area_padding,
                                                    Left   = left_area_padding,
                                                    Right  = left_area_padding * 2,
                                                },
                                                Child = BeatmapDetails = new BeatmapDetailArea
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Padding          = new MarginPadding {
                                                        Top = 10, Right = 5
                                                    },
                                                },
                                            },
                                        }
                                    },
                                },
                            }
                        }
                    }
                },
            });

            if (ShowFooter)
            {
                AddRangeInternal(new Drawable[]
                {
                    new GridContainer // used for max height implementation
                    {
                        RelativeSizeAxes = Axes.Both,
                        RowDimensions    = new[]
                        {
                            new Dimension(),
                            new Dimension(GridSizeMode.Relative, 1f, maxSize: ModSelectOverlay.HEIGHT + Footer.HEIGHT),
                        },
                        Content = new[]
                        {
                            null,
                            new Drawable[]
                            {
                                FooterPanels = new Container
                                {
                                    Anchor           = Anchor.BottomLeft,
                                    Origin           = Anchor.BottomLeft,
                                    RelativeSizeAxes = Axes.Both,
                                    Padding          = new MarginPadding {
                                        Bottom = Footer.HEIGHT
                                    },
                                    Children = new Drawable[]
                                    {
                                        BeatmapOptions = new BeatmapOptionsOverlay(),
                                        ModSelect      = new ModSelectOverlay
                                        {
                                            Origin = Anchor.BottomCentre,
                                            Anchor = Anchor.BottomCentre,
                                        }
                                    }
                                }
                            }
                        }
                    },
                    Footer = new Footer()
                });
            }

            BeatmapDetails.Leaderboard.ScoreSelected += score => this.Push(new SoloResults(score));

            if (Footer != null)
            {
                Footer.AddButton(new FooterButtonMods {
                    Current = Mods
                }, ModSelect);
                Footer.AddButton(new FooterButtonRandom {
                    Action = triggerRandom
                });
                Footer.AddButton(new FooterButtonOptions(), BeatmapOptions);

                BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null, Key.Number1);
                BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo), Key.Number2);
                BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number3);
            }

            dialogOverlay = dialog;

            sampleChangeDifficulty = audio.Samples.Get(@"SongSelect/select-difficulty");
            sampleChangeBeatmap    = audio.Samples.Get(@"SongSelect/select-expand");
            SampleConfirm          = audio.Samples.Get(@"SongSelect/confirm-selection");

            if (dialogOverlay != null)
            {
                Schedule(() =>
                {
                    // if we have no beatmaps but osu-stable is found, let's prompt the user to import.
                    if (!beatmaps.GetAllUsableBeatmapSetsEnumerable().Any() && beatmaps.StableInstallationAvailable)
                    {
                        dialogOverlay.Push(new ImportFromStablePopup(() =>
                        {
                            Task.Run(beatmaps.ImportFromStableAsync).ContinueWith(_ => scores.ImportFromStableAsync(), TaskContinuationOptions.OnlyOnRanToCompletion);
                            Task.Run(skins.ImportFromStableAsync);
                        }));
                    }
                });
            }
        }