Exemple #1
0
        //get single osu beatmap
        public WorkingBeatmap GetWorkingBeatmap(int rulesetID = 0, bool useFake = false, int beatmapIndex = 0, List <Mod> listMops = null)
        {
            WorkingBeatmap beatmap = null;

            var beatmapInfo = db.Query <BeatmapInfo>().FirstOrDefault(b => b.RulesetID == rulesetID);

            if (beatmapInfo != null)
            {
                beatmap = db.GetWorkingBeatmap(beatmapInfo);
            }

            //if cannot find any beatmap ,or use fake beatmap just create one
            if (beatmap?.Track == null || useFake)
            {
                beatmap = new RpTestWorkingBeatmap(getFakeBeatmapByRulesetId(rulesetID));
            }

            //adding Mods
            if (listMops != null)
            {
                beatmap.Mods.Value = listMops?.ToArray();
            }

            return(beatmap);
        }
Exemple #2
0
 private void addBeatmapSets()
 {
     foreach (var beatmapSet in database.Query <BeatmapSetInfo>())
     {
         addBeatmapSet(beatmapSet);
     }
 }
Exemple #3
0
        private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours)
        {
            if (Footer != null)
            {
                Footer.AddButton(@"random", colours.Green, SelectRandom, Key.F2);
                Footer.AddButton(@"options", colours.Blue, BeatmapOptions.ToggleVisibility, Key.F3);

                BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, promptDelete, Key.Number4, float.MaxValue);
            }

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

            if (osu != null)
            {
                ruleset.BindTo(osu.Ruleset);
            }

            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();

            carousel.BeatmapsChanged = beatmapsLoaded;
            carousel.Beatmaps        = database.Query <BeatmapSetInfo>().Where(b => !b.DeletePending);
        }
Exemple #4
0
        public override void Reset()
        {
            base.Reset();

            WorkingBeatmap beatmap = null;

            var beatmapInfo = db.Query <BeatmapInfo>().FirstOrDefault(b => b.Mode == PlayMode.Osu);

            if (beatmapInfo != null)
            {
                beatmap = db.GetWorkingBeatmap(beatmapInfo);
            }

            if (beatmap?.Track == null)
            {
                var objects = new List <HitObject>();

                int time = 1500;
                for (int i = 0; i < 50; i++)
                {
                    objects.Add(new HitCircle
                    {
                        StartTime = time,
                        Position  = new Vector2(i % 4 == 0 || i % 4 == 2 ? 0 : 512,
                                                i % 4 < 2 ? 0 : 384),
                        NewCombo = i % 4 == 0
                    });

                    time += 500;
                }

                Beatmap b = new Beatmap
                {
                    HitObjects  = objects,
                    BeatmapInfo = new BeatmapInfo
                    {
                        Difficulty = new BeatmapDifficulty(),
                        Metadata   = new BeatmapMetadata
                        {
                            Artist = @"Unknown",
                            Title  = @"Sample Beatmap",
                            Author = @"peppy",
                        }
                    }
                };

                beatmap = new TestWorkingBeatmap(b);
            }

            Add(new Box
            {
                RelativeSizeAxes = Framework.Graphics.Axes.Both,
                Colour           = Color4.Black,
            });

            Add(new PlayerLoader(Player = CreatePlayer(beatmap))
            {
                Beatmap = beatmap
            });
        }
Exemple #5
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");
        }
Exemple #6
0
        private void load(BeatmapDatabase db)
        {
            var beatmapInfo = db.Query <BeatmapInfo>().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault();

            if (beatmapInfo != null)
            {
                beatmap = db.GetWorkingBeatmap(beatmapInfo);
            }
        }
Exemple #7
0
 private void addBeatmapSets(Framework.Game game, CancellationToken token)
 {
     foreach (var beatmapSet in database.Query <BeatmapSetInfo>().Where(b => !b.DeletePending))
     {
         if (token.IsCancellationRequested)
         {
             return;
         }
         addBeatmapSet(beatmapSet, game);
     }
 }
Exemple #8
0
 private void addBeatmapSets(BaseGame game, CancellationToken token)
 {
     foreach (var beatmapSet in database.Query <BeatmapSetInfo>())
     {
         if (token.IsCancellationRequested)
         {
             return;
         }
         addBeatmapSet(beatmapSet, game);
     }
 }
Exemple #9
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();
        }
Exemple #10
0
        public override void Reset()
        {
            base.Reset();

            if (beatmap == null)
            {
                var beatmapInfo = db.Query <BeatmapInfo>().FirstOrDefault(b => b.RulesetID == 0);
                if (beatmapInfo != null)
                {
                    beatmap = db.GetWorkingBeatmap(beatmapInfo);
                }
            }

            base.Reset();

            Add(new Results(new Score
            {
                TotalScore = 2845370,
                Accuracy   = 0.98,
                MaxCombo   = 123,
                Rank       = ScoreRank.A,
                Date       = DateTime.Now,
                Statistics = new Dictionary <string, dynamic>()
                {
                    { "300", 50 },
                    { "100", 20 },
                    { "50", 50 },
                    { "x", 1 }
                },
                User = new User
                {
                    Username = "******",
                }
            })
            {
                Beatmap = beatmap
            });
        }
Exemple #11
0
 private void load(BeatmapDatabase db)
 {
     beatmap = db.GetWorkingBeatmap(db.Query<BeatmapInfo>().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault());
 }
Exemple #12
0
 private void load(BeatmapDatabase db)
 {
     beatmap = db.GetWorkingBeatmap(db.Query <BeatmapInfo>().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault());
 }