mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 12:35:34 +08:00
add custom file path support for osu\!mania judgement sprite
This commit is contained in:
parent
c726e6f514
commit
7c3e7b65a8
@ -11,6 +11,7 @@ using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||
using osu.Game.Skinning;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Skinning
|
||||
{
|
||||
@ -19,6 +20,36 @@ namespace osu.Game.Rulesets.Mania.Skinning
|
||||
private readonly ISkin source;
|
||||
private readonly ManiaBeatmap beatmap;
|
||||
|
||||
/// <summary>
|
||||
/// Mapping of <see cref="HitResult"/> to ther corresponding
|
||||
/// <see cref="LegacyManiaSkinConfigurationLookups"/> value.
|
||||
/// </summary>
|
||||
private static readonly IReadOnlyDictionary<HitResult, LegacyManiaSkinConfigurationLookups> componentMapping
|
||||
= new Dictionary<HitResult, LegacyManiaSkinConfigurationLookups>
|
||||
{
|
||||
{ HitResult.Perfect, LegacyManiaSkinConfigurationLookups.Hit300g },
|
||||
{ HitResult.Great, LegacyManiaSkinConfigurationLookups.Hit300 },
|
||||
{ HitResult.Good, LegacyManiaSkinConfigurationLookups.Hit200 },
|
||||
{ HitResult.Ok, LegacyManiaSkinConfigurationLookups.Hit100 },
|
||||
{ HitResult.Meh, LegacyManiaSkinConfigurationLookups.Hit50 },
|
||||
{ HitResult.Miss, LegacyManiaSkinConfigurationLookups.Hit0 }
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Mapping of <see cref="HitResult"/> to their corresponding
|
||||
/// default filenames.
|
||||
/// </summary>
|
||||
private static readonly IReadOnlyDictionary<HitResult, string> defaultName
|
||||
= new Dictionary<HitResult, string>
|
||||
{
|
||||
{ HitResult.Perfect, "mania-hit300g" },
|
||||
{ HitResult.Great, "mania-hit300" },
|
||||
{ HitResult.Good, "mania-hit200" },
|
||||
{ HitResult.Ok, "mania-hit100" },
|
||||
{ HitResult.Meh, "mania-hit50" },
|
||||
{ HitResult.Miss, "mania-hit0" }
|
||||
};
|
||||
|
||||
private Lazy<bool> isLegacySkin;
|
||||
|
||||
/// <summary>
|
||||
@ -47,15 +78,15 @@ namespace osu.Game.Rulesets.Mania.Skinning
|
||||
|
||||
public Drawable GetDrawableComponent(ISkinComponent component)
|
||||
{
|
||||
if (!isLegacySkin.Value || !hasKeyTexture.Value)
|
||||
return null;
|
||||
|
||||
switch (component)
|
||||
{
|
||||
case GameplaySkinComponent<HitResult> resultComponent:
|
||||
return getResult(resultComponent);
|
||||
return getResult(resultComponent.Component);
|
||||
|
||||
case ManiaSkinComponent maniaComponent:
|
||||
if (!isLegacySkin.Value || !hasKeyTexture.Value)
|
||||
return null;
|
||||
|
||||
switch (maniaComponent.Component)
|
||||
{
|
||||
case ManiaSkinComponents.ColumnBackground:
|
||||
@ -95,30 +126,13 @@ namespace osu.Game.Rulesets.Mania.Skinning
|
||||
return null;
|
||||
}
|
||||
|
||||
private Drawable getResult(GameplaySkinComponent<HitResult> resultComponent)
|
||||
private Drawable getResult(HitResult result)
|
||||
{
|
||||
switch (resultComponent.Component)
|
||||
{
|
||||
case HitResult.Miss:
|
||||
return this.GetAnimation("mania-hit0", true, true);
|
||||
string image = GetConfig<ManiaSkinConfigurationLookup, string>(
|
||||
new ManiaSkinConfigurationLookup(componentMapping[result])
|
||||
)?.Value ?? defaultName[result];
|
||||
|
||||
case HitResult.Meh:
|
||||
return this.GetAnimation("mania-hit50", true, true);
|
||||
|
||||
case HitResult.Ok:
|
||||
return this.GetAnimation("mania-hit100", true, true);
|
||||
|
||||
case HitResult.Good:
|
||||
return this.GetAnimation("mania-hit200", true, true);
|
||||
|
||||
case HitResult.Great:
|
||||
return this.GetAnimation("mania-hit300", true, true);
|
||||
|
||||
case HitResult.Perfect:
|
||||
return this.GetAnimation("mania-hit300g", true, true);
|
||||
}
|
||||
|
||||
return null;
|
||||
return this.GetAnimation(image, true, true);
|
||||
}
|
||||
|
||||
public Texture GetTexture(string componentName) => source.GetTexture(componentName);
|
||||
|
@ -43,6 +43,12 @@ namespace osu.Game.Skinning
|
||||
MinimumColumnWidth,
|
||||
LeftStageImage,
|
||||
RightStageImage,
|
||||
BottomStageImage
|
||||
BottomStageImage,
|
||||
Hit300g,
|
||||
Hit300,
|
||||
Hit200,
|
||||
Hit100,
|
||||
Hit50,
|
||||
Hit0,
|
||||
}
|
||||
}
|
||||
|
@ -257,6 +257,24 @@ namespace osu.Game.Skinning
|
||||
case LegacyManiaSkinConfigurationLookups.RightLineWidth:
|
||||
Debug.Assert(maniaLookup.TargetColumn != null);
|
||||
return SkinUtils.As<TValue>(new Bindable<float>(existing.ColumnLineWidth[maniaLookup.TargetColumn.Value + 1]));
|
||||
|
||||
case LegacyManiaSkinConfigurationLookups.Hit0:
|
||||
return SkinUtils.As<TValue>(getManiaImage(existing, "Hit0"));
|
||||
|
||||
case LegacyManiaSkinConfigurationLookups.Hit50:
|
||||
return SkinUtils.As<TValue>(getManiaImage(existing, "Hit50"));
|
||||
|
||||
case LegacyManiaSkinConfigurationLookups.Hit100:
|
||||
return SkinUtils.As<TValue>(getManiaImage(existing, "Hit100"));
|
||||
|
||||
case LegacyManiaSkinConfigurationLookups.Hit200:
|
||||
return SkinUtils.As<TValue>(getManiaImage(existing, "Hit200"));
|
||||
|
||||
case LegacyManiaSkinConfigurationLookups.Hit300:
|
||||
return SkinUtils.As<TValue>(getManiaImage(existing, "Hit300"));
|
||||
|
||||
case LegacyManiaSkinConfigurationLookups.Hit300g:
|
||||
return SkinUtils.As<TValue>(getManiaImage(existing, "Hit300g"));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user