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>
{
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>
{
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>
{
public void SetDefaults(OsuHitObject hitObject)
public void SetDefaults(OsuHitObject hitObject, Beatmap<OsuHitObject> beatmap)
{
hitObject.SetDefaultsFromBeatmap(beatmap);
}
public void PostProcess(Beatmap<OsuHitObject> beatmap)

View File

@ -67,10 +67,8 @@ public OsuScoreResult ScoreResultForOffset(double offset)
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;
}
}

View File

@ -75,7 +75,7 @@ public CurveType CurveType
public double Velocity;
public double TickDistance;
public override void SetDefaultsFromBeatmap(Beatmap beatmap)
public override void SetDefaultsFromBeatmap(Beatmap<OsuHitObject> beatmap)
{
base.SetDefaultsFromBeatmap(beatmap);

View File

@ -8,11 +8,11 @@ namespace osu.Game.Modes.Taiko.Beatmaps
{
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 @@ public interface IBeatmapProcessor<T>
/// Sets default values for a HitObject.
/// </summary>
/// <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>
/// Post-processes a Beatmap to add mode-specific components that aren't added during conversion.

View File

@ -23,11 +23,5 @@ public class HitObject
/// The sample to be played when this HitObject is hit.
/// </summary>
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 @@ protected HitRenderer(WorkingBeatmap beatmap)
// Convert + process the beatmap
Beatmap = CreateBeatmapConverter().Convert(beatmap.Beatmap);
Beatmap.HitObjects.ForEach(CreateBeatmapProcessor().SetDefaults);
Beatmap.HitObjects.ForEach(h => CreateBeatmapProcessor().SetDefaults(h, Beatmap));
CreateBeatmapProcessor().PostProcess(Beatmap);
applyMods(beatmap.Mods.Value);