public void SetBeatmap(Beatmap beatmap) { if (!beatmap.CompareHash(Replay.BeatmapHash)) { throw new Exception("The beatmap does not have the hash the replay requires."); } Beatmap = beatmap; _bManager = new BeatmapManager(beatmap); _bManager.SetMods(Replay.Enabled_Mods); _bManager.DifficultyCalculations(); }
//BeatmapManager and slider public void BeatmapManager() { //this class supplies functions for the hitobjects, difficulty ... //the constructor will automatically calculate combocolors, combonumbers and difficulties (such as approachrate ms and timing300) var beatmapManager = new BeatmapManager(beatmap); var timing300 = beatmapManager.HitWindow300; var approachratems = beatmapManager.PreEmpt; beatmapManager.SetMods(Mods.HardRock | Mods.Hidden); //enables the mods hardrock and hidden beatmapManager.DifficultyCalculations(); //recalculate the difficulties var timing300Hr = beatmapManager.HitWindow300; //this will now be different than the previous timing300 beatmapManager.SliderCalculations(); //this will create curves for the sliders. As this is an intensive task, it's async -> wait //this will get the selected map's hitobjects (better to work this way, no need for a reference to the beatmap) var hitobjects = beatmapManager.GetHitObjects(); //some LINQ to select the first slider in the list var firstslider = (Slider)hitobjects.First(ho => ho.IsHitObjectType(HitObjectType.Slider)); var positionAt20Ms = firstslider.PositionAtTime(firstslider.StartTime + 20); }