tidy up code

This commit is contained in:
mcendu 2020-06-13 11:31:34 +08:00
parent a42bfcb5ab
commit aa476835e7
2 changed files with 24 additions and 22 deletions

View File

@ -17,11 +17,12 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
{ {
public TestSceneDrawableJudgement() public TestSceneDrawableJudgement()
{ {
var HitWindows = new ManiaHitWindows(); var hitWindows = new ManiaHitWindows();
foreach (HitResult result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Skip(1)) foreach (HitResult result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Skip(1))
{ {
if (HitWindows.IsHitResultAllowed(result)) if (hitWindows.IsHitResultAllowed(result))
{
AddStep("Show " + result.GetDescription(), () => SetContents(() => AddStep("Show " + result.GetDescription(), () => SetContents(() =>
new DrawableManiaJudgement(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null) new DrawableManiaJudgement(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null)
{ {
@ -32,3 +33,4 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
} }
} }
} }
}

View File

@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Mania.Skinning
/// Mapping of <see cref="HitResult"/> to ther corresponding /// Mapping of <see cref="HitResult"/> to ther corresponding
/// <see cref="LegacyManiaSkinConfigurationLookups"/> value. /// <see cref="LegacyManiaSkinConfigurationLookups"/> value.
/// </summary> /// </summary>
private static readonly IReadOnlyDictionary<HitResult, LegacyManiaSkinConfigurationLookups> componentMapping private static readonly IReadOnlyDictionary<HitResult, LegacyManiaSkinConfigurationLookups> hitresult_mapping
= new Dictionary<HitResult, LegacyManiaSkinConfigurationLookups> = new Dictionary<HitResult, LegacyManiaSkinConfigurationLookups>
{ {
{ HitResult.Perfect, LegacyManiaSkinConfigurationLookups.Hit300g }, { HitResult.Perfect, LegacyManiaSkinConfigurationLookups.Hit300g },
@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Mania.Skinning
/// Mapping of <see cref="HitResult"/> to their corresponding /// Mapping of <see cref="HitResult"/> to their corresponding
/// default filenames. /// default filenames.
/// </summary> /// </summary>
private static readonly IReadOnlyDictionary<HitResult, string> defaultName private static readonly IReadOnlyDictionary<HitResult, string> default_hitresult_skin_filenames
= new Dictionary<HitResult, string> = new Dictionary<HitResult, string>
{ {
{ HitResult.Perfect, "mania-hit300g" }, { HitResult.Perfect, "mania-hit300g" },
@ -129,8 +129,8 @@ namespace osu.Game.Rulesets.Mania.Skinning
private Drawable getResult(HitResult result) private Drawable getResult(HitResult result)
{ {
string image = GetConfig<ManiaSkinConfigurationLookup, string>( string image = GetConfig<ManiaSkinConfigurationLookup, string>(
new ManiaSkinConfigurationLookup(componentMapping[result]) new ManiaSkinConfigurationLookup(hitresult_mapping[result])
)?.Value ?? defaultName[result]; )?.Value ?? default_hitresult_skin_filenames[result];
return this.GetAnimation(image, true, true); return this.GetAnimation(image, true, true);
} }