Esempio n. 1
0
        //protected override void Dispose(bool isDisposing)
        //{
        //    if (oldDb != null)
        //        db = null;

        //    base.Dispose(isDisposing);
        //}

        private BeatmapSetInfo createTestBeatmapSet(int i)
        {
            return(new BeatmapSetInfo
            {
                OnlineBeatmapSetID = 1234 + i,
                Hash = "d8e8fca2dc0f896fd7cb4cb0031ba249",
                Path = string.Empty,
                Metadata = new BeatmapMetadata
                {
                    OnlineBeatmapSetID = 1234 + i,
                    // Create random metadata, then we can check if sorting works based on these
                    Artist = "MONACA " + RNG.Next(0, 9),
                    Title = "Black Song " + RNG.Next(0, 9),
                    Author = "Some Guy " + RNG.Next(0, 9),
                },
                Beatmaps = new List <BeatmapInfo>(new[]
                {
                    new BeatmapInfo
                    {
                        OnlineBeatmapID = 1234 + i,
                        Ruleset = rulesets.Query <RulesetInfo>().First(),
                        Path = "normal.osu",
                        Version = "Normal",
                        Difficulty = new BeatmapDifficulty
                        {
                            OverallDifficulty = 3.5f,
                        }
                    },
                    new BeatmapInfo
                    {
                        OnlineBeatmapID = 1235 + i,
                        Ruleset = rulesets.Query <RulesetInfo>().First(),
                        Path = "hard.osu",
                        Version = "Hard",
                        Difficulty = new BeatmapDifficulty
                        {
                            OverallDifficulty = 5,
                        }
                    },
                    new BeatmapInfo
                    {
                        OnlineBeatmapID = 1236 + i,
                        Ruleset = rulesets.Query <RulesetInfo>().First(),
                        Path = "insane.osu",
                        Version = "Insane",
                        Difficulty = new BeatmapDifficulty
                        {
                            OverallDifficulty = 7,
                        }
                    },
                }),
            });
        }
Esempio n. 2
0
        public override void Reset()
        {
            base.Reset();

            WorkingBeatmap beatmap = null;

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

            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 : OsuPlayfield.BASE_SIZE.X,
                                                i % 4 < 2 ? 0 : OsuPlayfield.BASE_SIZE.Y),
                        NewCombo = i % 4 == 0
                    });

                    time += 500;
                }

                Beatmap b = new Beatmap
                {
                    HitObjects  = objects,
                    BeatmapInfo = new BeatmapInfo
                    {
                        Difficulty = new BeatmapDifficulty(),
                        Ruleset    = rulesets.Query <RulesetInfo>().First(),
                        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(Player = CreatePlayer(beatmap));
        }
Esempio n. 3
0
        /// <summary>
        /// get faake beatmap
        /// </summary>
        /// <param name="rulesetId"></param>
        /// <returns></returns>
        private Beatmap getFakeBeatmapByRulesetId(int rulesetId)
        {
            switch (rulesetId)
            {
            case 0:
                GetOsuFakeBeatmapScript getOsuFakeBeatmapScript = new GetOsuFakeBeatmapScript();
                return(getOsuFakeBeatmapScript.GetFakeBeatmap(rulesets.Query <RulesetInfo>().FirstOrDefault()));

                break;

            case 5:
                GetRpFakeBeatmapScript getRpFakeBeatmapScript = new GetRpFakeBeatmapScript();
                return(getRpFakeBeatmapScript.GetFakeBeatmap(rulesets.Query <RulesetInfo>().FirstOrDefault(info => info.ID == 5)));

                break;
            }

            GetOsuFakeBeatmapScript getDefaultFakeBeatmapScript = new GetOsuFakeBeatmapScript();

            return(getDefaultFakeBeatmapScript.GetFakeBeatmap(rulesets.Query <RulesetInfo>().FirstOrDefault()));
        }
Esempio n. 4
0
        public override void Reset()
        {
            base.Reset();

            List <HitObject> objects = new List <HitObject>();

            int time = 500;

            for (int i = 0; i < 100; i++)
            {
                objects.Add(new HitCircle
                {
                    StartTime = time,
                    Position  = new Vector2(RNG.Next(0, (int)OsuPlayfield.BASE_SIZE.X), RNG.Next(0, (int)OsuPlayfield.BASE_SIZE.Y)),
                    Scale     = RNG.NextSingle(0.5f, 1.0f),
                });

                time += RNG.Next(50, 500);
            }

            WorkingBeatmap beatmap = new TestWorkingBeatmap(new Beatmap
            {
                HitObjects  = objects,
                BeatmapInfo = new BeatmapInfo
                {
                    Difficulty = new BeatmapDifficulty(),
                    Ruleset    = rulesets.Query <RulesetInfo>().First(),
                    Metadata   = new BeatmapMetadata
                    {
                        Artist = @"Unknown",
                        Title  = @"Sample Beatmap",
                        Author = @"peppy",
                    }
                }
            });

            Add(new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    //ensure we are at offset 0
                    Clock    = new FramedClock(),
                    Children = new Drawable[]
                    {
                        new OsuHitRenderer(beatmap)
                        {
                            Scale  = new Vector2(0.5f),
                            Anchor = Anchor.TopLeft,
                            Origin = Anchor.TopLeft
                        },
                        new TaikoHitRenderer(beatmap)
                        {
                            Scale  = new Vector2(0.5f),
                            Anchor = Anchor.TopRight,
                            Origin = Anchor.TopRight
                        },
                        new CatchHitRenderer(beatmap)
                        {
                            Scale  = new Vector2(0.5f),
                            Anchor = Anchor.BottomLeft,
                            Origin = Anchor.BottomLeft
                        },
                        new ManiaHitRenderer(beatmap)
                        {
                            Scale  = new Vector2(0.5f),
                            Anchor = Anchor.BottomRight,
                            Origin = Anchor.BottomRight
                        }
                    }
                }
            });
        }