Better hit object defaults setting.

This commit is contained in:
smoogipooo
2017-03-16 16:55:08 +09:00
parent 296a3cd1e9
commit 0c47638820
8 changed files with 69 additions and 34 deletions

View File

@ -9,6 +9,7 @@ using osu.Game.Modes.Judgements;
using osu.Game.Modes.Mods;
using osu.Game.Modes.Objects;
using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Objects.Types;
using osu.Game.Screens.Play;
using System;
using System.Collections.Generic;
@ -86,16 +87,32 @@ namespace osu.Game.Modes.UI
{
Debug.Assert(beatmap != null, "HitRenderer initialized with a null beatmap.");
// Convert + process the beatmap
Beatmap = CreateBeatmapConverter().Convert(beatmap.Beatmap);
Beatmap.HitObjects.ForEach(h => CreateBeatmapProcessor().SetDefaults(h, Beatmap));
CreateBeatmapProcessor().PostProcess(Beatmap);
applyMods(beatmap.Mods.Value);
RelativeSizeAxes = Axes.Both;
IBeatmapConverter<TObject> converter = CreateBeatmapConverter();
IBeatmapProcessor<TObject> processor = CreateBeatmapProcessor();
// Convert the beatmap
Beatmap = converter.Convert(beatmap.Beatmap);
// Apply defaults
HitObjectDefaults defaults = new HitObjectDefaults
{
Timing = Beatmap.TimingInfo,
Difficulty = Beatmap.BeatmapInfo.BaseDifficulty
};
foreach (var h in Beatmap.HitObjects)
h.ApplyDefaults(defaults);
// Post-process the beatmap
processor.PostProcess(Beatmap);
// Add mods, should always be the last thing applied to give full control to mods
applyMods(beatmap.Mods.Value);
}
/// <summary>
/// Applies the active mods to this HitRenderer.
/// </summary>