private void load(OsuGameBase game, BeatmapManager beatmaps, OsuColour colours)
        {
            this.beatmaps = beatmaps;

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    CornerRadius     = 5,
                    Masking          = true,
                    EdgeEffect       = new EdgeEffectParameters
                    {
                        Type   = EdgeEffectType.Shadow,
                        Colour = Color4.Black.Opacity(40),
                        Radius = 5,
                    },
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = colours.Gray3,
                            RelativeSizeAxes = Axes.Both,
                        },
                        list = new PlaylistList
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Top = 95, Bottom = 10, Right = 10
                            },
                            OnSelect = itemSelected,
                        },
                        filter = new FilterControl
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            ExitRequested    = () => State = Visibility.Hidden,
                            FilterChanged    = search => list.Filter(search),
                            Padding          = new MarginPadding(10),
                        },
                    },
                },
            };

            beatmaps.BeatmapSetAdded   += list.AddBeatmapSet;
            beatmaps.BeatmapSetRemoved += list.RemoveBeatmapSet;

            list.BeatmapSets = beatmaps.GetAllUsableBeatmapSets();

            beatmapBacking.BindTo(game.Beatmap);

            filter.Search.OnCommit = (sender, newText) =>
            {
                var beatmap = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault();
                if (beatmap != null)
                {
                    playSpecified(beatmap);
                }
            };
        }
Exemple #2
0
        private void load(OsuColour colours, Bindable <WorkingBeatmap> beatmap, BeatmapManager beatmaps)
        {
            this.beatmap.BindTo(beatmap);
            this.beatmaps = beatmaps;

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    CornerRadius     = 5,
                    Masking          = true,
                    EdgeEffect       = new EdgeEffectParameters
                    {
                        Type   = EdgeEffectType.Shadow,
                        Colour = Color4.Black.Opacity(40),
                        Radius = 5,
                    },
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = colours.Gray3,
                            RelativeSizeAxes = Axes.Both,
                        },
                        list = new PlaylistList
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Top = 95, Bottom = 10, Right = 10
                            },
                            Selected     = itemSelected,
                            OrderChanged = (s, i) => OrderChanged?.Invoke(s, i)
                        },
                        filter = new FilterControl
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            ExitRequested    = Hide,
                            FilterChanged    = search => list.Filter(search),
                            Padding          = new MarginPadding(10),
                        },
                    },
                },
            };

            filter.Search.OnCommit = (sender, newText) =>
            {
                BeatmapInfo toSelect = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault();

                if (toSelect != null)
                {
                    beatmap.Value = beatmaps.GetWorkingBeatmap(toSelect);
                    beatmap.Value.Track.Restart();
                }
            };
        }
Exemple #3
0
        private void load(OsuGameBase game, BeatmapDatabase beatmaps, OsuColour colours)
        {
            this.beatmaps = beatmaps;
            trackManager  = game.Audio.Track;

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    CornerRadius     = 5,
                    Masking          = true,
                    EdgeEffect       = new EdgeEffect
                    {
                        Type   = EdgeEffectType.Shadow,
                        Colour = Color4.Black.Opacity(40),
                        Radius = 5,
                    },
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = colours.Gray3,
                            RelativeSizeAxes = Axes.Both,
                        },
                        list = new PlaylistList
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Top = 95, Bottom = 10, Right = 10
                            },
                            OnSelect = itemSelected,
                        },
                        filter = new FilterControl
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            ExitRequested    = () => State = Visibility.Hidden,
                            FilterChanged    = search => list.Filter(search),
                            Padding          = new MarginPadding(10),
                        },
                    },
                },
            };

            list.BeatmapSets = BeatmapSets = beatmaps.GetAllWithChildren <BeatmapSetInfo>().ToList();

            beatmapBacking.BindTo(game.Beatmap);
        }