1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 16:33:21 +08:00

Fix defaults not being set (keep in mind this will be changed in a later pullrequest).

This commit is contained in:
smoogipooo 2017-03-14 19:04:40 +09:00
parent 785b970125
commit 069a7a24ce
9 changed files with 13 additions and 19 deletions

View File

@ -8,11 +8,11 @@ namespace osu.Game.Modes.Catch.Beatmaps
{ {
internal class CatchBeatmapProcessor : IBeatmapProcessor<CatchBaseHit> internal class CatchBeatmapProcessor : IBeatmapProcessor<CatchBaseHit>
{ {
public void PostProcess(Beatmap<CatchBaseHit> beatmap) public void SetDefaults(CatchBaseHit hitObject, Beatmap<CatchBaseHit> beatmap)
{ {
} }
public void SetDefaults(CatchBaseHit hitObject) public void PostProcess(Beatmap<CatchBaseHit> beatmap)
{ {
} }
} }

View File

@ -8,11 +8,11 @@ namespace osu.Game.Modes.Mania.Beatmaps
{ {
internal class ManiaBeatmapProcessor : IBeatmapProcessor<ManiaBaseHit> internal class ManiaBeatmapProcessor : IBeatmapProcessor<ManiaBaseHit>
{ {
public void PostProcess(Beatmap<ManiaBaseHit> beatmap) public void SetDefaults(ManiaBaseHit hitObject, Beatmap<ManiaBaseHit> beatmap)
{ {
} }
public void SetDefaults(ManiaBaseHit hitObject) public void PostProcess(Beatmap<ManiaBaseHit> beatmap)
{ {
} }
} }

View File

@ -8,8 +8,9 @@ namespace osu.Game.Modes.Osu.Beatmaps
{ {
internal class OsuBeatmapProcessor : IBeatmapProcessor<OsuHitObject> internal class OsuBeatmapProcessor : IBeatmapProcessor<OsuHitObject>
{ {
public void SetDefaults(OsuHitObject hitObject) public void SetDefaults(OsuHitObject hitObject, Beatmap<OsuHitObject> beatmap)
{ {
hitObject.SetDefaultsFromBeatmap(beatmap);
} }
public void PostProcess(Beatmap<OsuHitObject> beatmap) public void PostProcess(Beatmap<OsuHitObject> beatmap)

View File

@ -67,10 +67,8 @@ namespace osu.Game.Modes.Osu.Objects
return OsuScoreResult.Miss; return OsuScoreResult.Miss;
} }
public override void SetDefaultsFromBeatmap(Beatmap beatmap) public virtual void SetDefaultsFromBeatmap(Beatmap<OsuHitObject> beatmap)
{ {
base.SetDefaultsFromBeatmap(beatmap);
Scale = (1.0f - 0.7f * (beatmap.BeatmapInfo.BaseDifficulty.CircleSize - 5) / 5) / 2; Scale = (1.0f - 0.7f * (beatmap.BeatmapInfo.BaseDifficulty.CircleSize - 5) / 5) / 2;
} }
} }

View File

@ -75,7 +75,7 @@ namespace osu.Game.Modes.Osu.Objects
public double Velocity; public double Velocity;
public double TickDistance; public double TickDistance;
public override void SetDefaultsFromBeatmap(Beatmap beatmap) public override void SetDefaultsFromBeatmap(Beatmap<OsuHitObject> beatmap)
{ {
base.SetDefaultsFromBeatmap(beatmap); base.SetDefaultsFromBeatmap(beatmap);

View File

@ -8,11 +8,11 @@ namespace osu.Game.Modes.Taiko.Beatmaps
{ {
internal class TaikoBeatmapProcessor : IBeatmapProcessor<TaikoBaseHit> internal class TaikoBeatmapProcessor : IBeatmapProcessor<TaikoBaseHit>
{ {
public void PostProcess(Beatmap<TaikoBaseHit> beatmap) public void SetDefaults(TaikoBaseHit hitObject, Beatmap<TaikoBaseHit> beatmap)
{ {
} }
public void SetDefaults(TaikoBaseHit hitObject) public void PostProcess(Beatmap<TaikoBaseHit> beatmap)
{ {
} }
} }

View File

@ -16,7 +16,8 @@ namespace osu.Game.Beatmaps
/// Sets default values for a HitObject. /// Sets default values for a HitObject.
/// </summary> /// </summary>
/// <param name="hitObject">The HitObject to set default values for.</param> /// <param name="hitObject">The HitObject to set default values for.</param>
void SetDefaults(T hitObject); /// <param name="beatmap">The Beatmap to extract the default values from.</param>
void SetDefaults(T hitObject, Beatmap<T> beatmap);
/// <summary> /// <summary>
/// Post-processes a Beatmap to add mode-specific components that aren't added during conversion. /// Post-processes a Beatmap to add mode-specific components that aren't added during conversion.

View File

@ -23,11 +23,5 @@ namespace osu.Game.Modes.Objects
/// The sample to be played when this HitObject is hit. /// The sample to be played when this HitObject is hit.
/// </summary> /// </summary>
public HitSampleInfo Sample { get; set; } public HitSampleInfo Sample { get; set; }
/// <summary>
/// Sets default parameters from a beatmap.
/// </summary>
/// <param name="beatmap">The beatmap to set from.</param>
public virtual void SetDefaultsFromBeatmap(Beatmap beatmap) { }
} }
} }

View File

@ -65,7 +65,7 @@ namespace osu.Game.Modes.UI
// Convert + process the beatmap // Convert + process the beatmap
Beatmap = CreateBeatmapConverter().Convert(beatmap.Beatmap); Beatmap = CreateBeatmapConverter().Convert(beatmap.Beatmap);
Beatmap.HitObjects.ForEach(CreateBeatmapProcessor().SetDefaults); Beatmap.HitObjects.ForEach(h => CreateBeatmapProcessor().SetDefaults(h, Beatmap));
CreateBeatmapProcessor().PostProcess(Beatmap); CreateBeatmapProcessor().PostProcess(Beatmap);
applyMods(beatmap.Mods.Value); applyMods(beatmap.Mods.Value);