Example #1
0
        private void addBeatmapSet(BeatmapSetInfo beatmapSet, BaseGame game)
        {
            beatmapSet = database.GetWithChildren <BeatmapSetInfo>(beatmapSet.BeatmapSetID);
            beatmapSet.Beatmaps.ForEach(b => database.GetChildren(b));
            beatmapSet.Beatmaps = beatmapSet.Beatmaps.OrderBy(b => b.BaseDifficulty.OverallDifficulty).ToList();

            var beatmap = database.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault());

            var group = new BeatmapGroup(beatmap)
            {
                SelectionChanged = selectionChanged
            };

            //for the time being, let's completely load the difficulty panels in the background.
            //this likely won't scale so well, but allows us to completely async the loading flow.
            Task.WhenAll(group.BeatmapPanels.Select(panel => panel.Preload(game))).ContinueWith(task => Schedule(delegate
            {
                carousel.AddGroup(group);

                if (Beatmap == null)
                {
                    carousel.SelectBeatmap(beatmapSet.Beatmaps.First());
                }
                else
                {
                    var panel = group.BeatmapPanels.FirstOrDefault(p => p.Beatmap.Equals(Beatmap.BeatmapInfo));
                    if (panel != null)
                    {
                        carousel.SelectGroup(group, panel);
                    }
                }
            }));
        }
Example #2
0
        private void addBeatmapSet(BeatmapSetInfo beatmapSet, Framework.Game game, bool select = false)
        {
            beatmapSet = database.GetWithChildren <BeatmapSetInfo>(beatmapSet.ID);
            beatmapSet.Beatmaps.ForEach(b =>
            {
                database.GetChildren(b);
                if (b.Metadata == null)
                {
                    b.Metadata = beatmapSet.Metadata;
                }
            });

            foreach (var b in beatmapSet.Beatmaps)
            {
                b.ComputeDifficulty(database);
            }
            beatmapSet.Beatmaps = beatmapSet.Beatmaps.OrderBy(b => b.StarDifficulty).ToList();

            var beatmap = new WorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault(), beatmapSet, database);

            var group = new BeatmapGroup(beatmap)
            {
                SelectionChanged = selectionChanged,
                StartRequested   = b => footer.StartButton.TriggerClick()
            };

            //for the time being, let's completely load the difficulty panels in the background.
            //this likely won't scale so well, but allows us to completely async the loading flow.
            Task.WhenAll(group.BeatmapPanels.Select(panel => panel.Preload(game))).ContinueWith(task => Schedule(delegate
            {
                beatmapGroups.Add(group);

                carousel.AddGroup(group);

                if (Beatmap == null || select)
                {
                    carousel.SelectBeatmap(beatmapSet.Beatmaps.First());
                }
                else
                {
                    var panel = group.BeatmapPanels.FirstOrDefault(p => p.Beatmap.Equals(Beatmap.BeatmapInfo));
                    if (panel != null)
                    {
                        carousel.SelectGroup(group, panel);
                    }
                }
            }));
        }
Example #3
0
 private void addBeatmapSet(BeatmapSetInfo beatmapSet)
 {
     beatmapSet = database.GetWithChildren <BeatmapSetInfo>(beatmapSet.BeatmapSetID);
     beatmapSet.Beatmaps.ForEach(b => database.GetChildren(b));
     beatmapSet.Beatmaps = beatmapSet.Beatmaps.OrderBy(b => b.BaseDifficulty.OverallDifficulty).ToList();
     Schedule(() =>
     {
         var group = new BeatmapGroup(beatmapSet)
         {
             SelectionChanged = selectBeatmap
         };
         setList.Add(group);
         if (setList.Children.Count() == 1)
         {
             group.State = BeatmapGroupState.Expanded;
         }
     });
 }
Example #4
0
        private void load(OsuGame game, OsuConfigManager config, BeatmapDatabase beatmaps)
        {
            menuMusic = config.GetBindable <bool>(OsuConfig.MenuMusic);
            LoadComponentAsync(background);

            if (!menuMusic)
            {
                trackManager = game.Audio.Track;
                int choosableBeatmapsetAmmount = beatmaps.Query <BeatmapSetInfo>().Count();
                if (choosableBeatmapsetAmmount > 0)
                {
                    song    = beatmaps.GetWorkingBeatmap(beatmaps.GetWithChildren <BeatmapSetInfo>(RNG.Next(1, choosableBeatmapsetAmmount)).Beatmaps[0]);
                    Beatmap = song;
                }
            }

            buttons.OnSettings = game.ToggleOptions;

            preloadSongSelect();
        }
Example #5
0
        private void addBeatmapSet(BeatmapSetInfo beatmapSet)
        {
            beatmapSet = database.GetWithChildren <BeatmapSetInfo>(beatmapSet.BeatmapSetID);
            beatmapSet.Beatmaps.ForEach(b => database.GetChildren(b));
            beatmapSet.Beatmaps = beatmapSet.Beatmaps.OrderBy(b => b.BaseDifficulty.OverallDifficulty).ToList();

            var working = database.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault());

            var group = new BeatmapGroup(beatmapSet, working)
            {
                SelectionChanged = selectionChanged
            };

            group.Preload(Game, g =>
            {
                beatmapSetFlow.Add(group);

                if (Beatmap == null)
                {
                    if (beatmapSetFlow.Children.Count() == 1)
                    {
                        group.State = BeatmapGroupState.Expanded;
                        return;
                    }
                }
                else
                {
                    if (selectedBeatmapInfo?.Equals(Beatmap.BeatmapInfo) != true)
                    {
                        var panel = group.BeatmapPanels.FirstOrDefault(p => p.Beatmap.Equals(Beatmap.BeatmapInfo));
                        if (panel != null)
                        {
                            panel.State = PanelSelectedState.Selected;
                            return;
                        }
                    }
                }

                group.State = BeatmapGroupState.Collapsed;
            });
        }
Example #6
0
        private void addBeatmapSet(BeatmapSetInfo beatmapSet, Framework.Game game, bool select = false)
        {
            beatmapSet = database.GetWithChildren <BeatmapSetInfo>(beatmapSet.ID);
            beatmapSet.Beatmaps.ForEach(b =>
            {
                database.GetChildren(b);
                if (b.Metadata == null)
                {
                    b.Metadata = beatmapSet.Metadata;
                }
            });

            var group = new BeatmapGroup(beatmapSet, database)
            {
                SelectionChanged = selectionChanged,
                StartRequested   = b => raiseSelect()
            };

            //for the time being, let's completely load the difficulty panels in the background.
            //this likely won't scale so well, but allows us to completely async the loading flow.
            Task.WhenAll(group.BeatmapPanels.Select(panel => panel.LoadAsync(game))).ContinueWith(task => Schedule(delegate
            {
                beatmapGroups.Add(group);

                group.State = BeatmapGroupState.Collapsed;
                carousel.AddGroup(group);

                filterChanged(false, false);

                if (Beatmap == null || select)
                {
                    carousel.SelectBeatmap(beatmapSet.Beatmaps.First());
                }
                else
                {
                    carousel.SelectBeatmap(Beatmap.BeatmapInfo);
                }
            }));
        }