示例#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);
                    }
                }
            }));
        }
示例#2
0
        private BeatmapGroup createGroup(BeatmapSetInfo beatmapSet)
        {
            database.GetChildren(beatmapSet);
            beatmapSet.Beatmaps.ForEach(b =>
            {
                database.GetChildren(b);
                if (b.Metadata == null)
                {
                    b.Metadata = beatmapSet.Metadata;
                }
            });

            return(new BeatmapGroup(beatmapSet, database)
            {
                SelectionChanged = (g, p) => selectGroup(g, p),
                StartRequested = b => StartRequested?.Invoke(),
                State = BeatmapGroupState.Collapsed
            });
        }
示例#3
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);
                    }
                }
            }));
        }
示例#4
0
        private void load(AudioManager audio, OsuConfigManager config, BeatmapDatabase beatmaps, Framework.Game game)
        {
            menuVoice = config.GetBindable <bool>(OsuSetting.MenuVoice);
            menuMusic = config.GetBindable <bool>(OsuSetting.MenuMusic);

            var trackManager = audio.Track;

            BeatmapSetInfo setInfo = null;

            if (!menuMusic)
            {
                var query = beatmaps.Query <BeatmapSetInfo>().Where(b => !b.DeletePending);
                int count = query.Count();
                if (count > 0)
                {
                    setInfo = query.ElementAt(RNG.Next(0, count - 1));
                }
            }

            if (setInfo == null)
            {
                var query = beatmaps.Query <BeatmapSetInfo>().Where(b => b.Hash == MENU_MUSIC_BEATMAP_HASH);

                setInfo = query.FirstOrDefault();

                if (setInfo == null)
                {
                    // we need to import the default menu background beatmap
                    beatmaps.Import(new OszArchiveReader(game.Resources.GetStream(@"Tracks/circles.osz")));

                    setInfo = query.First();

                    setInfo.DeletePending = true;
                    beatmaps.Update(setInfo, false);
                }
            }

            beatmaps.GetChildren(setInfo);
            Beatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);

            track = Beatmap.Track;
            trackManager.SetExclusive(track);

            welcome = audio.Sample.Get(@"welcome");
            seeya   = audio.Sample.Get(@"seeya");
        }
示例#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();
     Schedule(() =>
     {
         var group = new BeatmapGroup(beatmapSet)
         {
             SelectionChanged = selectBeatmap
         };
         setList.Add(group);
         if (setList.Children.Count() == 1)
         {
             group.State = BeatmapGroupState.Expanded;
         }
     });
 }
示例#6
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;
            });
        }
示例#7
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);
                }
            }));
        }