mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 12:12:54 +08:00
fix test issues
This commit is contained in:
parent
109a5ad3d7
commit
c5d5a5b342
@ -209,7 +209,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override IDifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
|
protected override IDifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
|
||||||
=> new IDifficultyAttributes(mods, mods.OfType<TestMod>().SingleOrDefault()?.Difficulty.Value ?? 0);
|
=> new EmptyDifficultyAttributes();
|
||||||
|
|
||||||
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
|
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
|
||||||
=> Array.Empty<DifficultyHitObject>();
|
=> Array.Empty<DifficultyHitObject>();
|
||||||
@ -226,7 +226,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override IPerformanceAttributes CreatePerformanceAttributes(ScoreInfo score, IDifficultyAttributes attributes)
|
protected override IPerformanceAttributes CreatePerformanceAttributes(ScoreInfo score, IDifficultyAttributes attributes)
|
||||||
=> new IPerformanceAttributes { Total = score.Mods.OfType<TestMod>().SingleOrDefault()?.Performance.Value ?? 0 };
|
=> new EmptyPerformanceAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestMod : Mod
|
private class TestMod : Mod
|
||||||
|
@ -252,7 +252,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
var performanceCalculator = ruleset.CreatePerformanceCalculator();
|
var performanceCalculator = ruleset.CreatePerformanceCalculator();
|
||||||
if (performanceCalculator == null)
|
if (performanceCalculator == null)
|
||||||
return new StarDifficulty(difficulty, new PerformanceAttributes());
|
return new StarDifficulty(difficulty, new EmptyPerformanceAttributes());
|
||||||
|
|
||||||
ScoreProcessor scoreProcessor = ruleset.CreateScoreProcessor();
|
ScoreProcessor scoreProcessor = ruleset.CreateScoreProcessor();
|
||||||
scoreProcessor.Mods.Value = key.OrderedMods;
|
scoreProcessor.Mods.Value = key.OrderedMods;
|
||||||
|
@ -21,4 +21,17 @@ namespace osu.Game.Rulesets.Difficulty
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public IEnumerable<PerformanceDisplayAttribute> GetAttributesForDisplay();
|
public IEnumerable<PerformanceDisplayAttribute> GetAttributesForDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a full, minimal implementation of <see cref="IPerformanceAttributes"/>.
|
||||||
|
/// </summary>
|
||||||
|
public class EmptyPerformanceAttributes : IPerformanceAttributes
|
||||||
|
{
|
||||||
|
public double Total { get; set; }
|
||||||
|
|
||||||
|
public IEnumerable<PerformanceDisplayAttribute> GetAttributesForDisplay()
|
||||||
|
{
|
||||||
|
yield return new PerformanceDisplayAttribute(nameof(Total), "Achieved PP", Total);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user