mirror of https://github.com/ppy/osu
Look up both sprites for legacy explosions
This commit is contained in:
parent
d5f1d94b51
commit
eb62ad4e55
|
@ -74,15 +74,23 @@ public override Drawable GetDrawableComponent(ISkinComponent component)
|
|||
|
||||
return null;
|
||||
|
||||
case TaikoSkinComponents.TaikoExplosionGood:
|
||||
case TaikoSkinComponents.TaikoExplosionGoodStrong:
|
||||
case TaikoSkinComponents.TaikoExplosionGreat:
|
||||
case TaikoSkinComponents.TaikoExplosionGreatStrong:
|
||||
case TaikoSkinComponents.TaikoExplosionMiss:
|
||||
|
||||
var sprite = this.GetAnimation(getHitName(taikoComponent.Component), true, false);
|
||||
if (sprite != null)
|
||||
return new LegacyHitExplosion(sprite);
|
||||
var missSprite = this.GetAnimation(getHitName(taikoComponent.Component), true, false);
|
||||
if (missSprite != null)
|
||||
return new LegacyHitExplosion(missSprite);
|
||||
|
||||
return null;
|
||||
|
||||
case TaikoSkinComponents.TaikoExplosionGood:
|
||||
case TaikoSkinComponents.TaikoExplosionGreat:
|
||||
|
||||
var hitName = getHitName(taikoComponent.Component);
|
||||
var hitSprite = this.GetAnimation(hitName, true, false);
|
||||
var strongHitSprite = this.GetAnimation($"{hitName}k", true, false);
|
||||
|
||||
if (hitSprite != null)
|
||||
return new LegacyHitExplosion(hitSprite, strongHitSprite);
|
||||
|
||||
return null;
|
||||
|
||||
|
@ -109,17 +117,11 @@ private string getHitName(TaikoSkinComponents component)
|
|||
case TaikoSkinComponents.TaikoExplosionGood:
|
||||
return "taiko-hit100";
|
||||
|
||||
case TaikoSkinComponents.TaikoExplosionGoodStrong:
|
||||
return "taiko-hit100k";
|
||||
|
||||
case TaikoSkinComponents.TaikoExplosionGreat:
|
||||
return "taiko-hit300";
|
||||
|
||||
case TaikoSkinComponents.TaikoExplosionGreatStrong:
|
||||
return "taiko-hit300k";
|
||||
}
|
||||
|
||||
throw new ArgumentOutOfRangeException(nameof(component), "Invalid result type");
|
||||
throw new ArgumentOutOfRangeException(nameof(component), $"Invalid component type: {component}");
|
||||
}
|
||||
|
||||
public override SampleChannel GetSample(ISampleInfo sampleInfo) => Source.GetSample(new LegacyTaikoSampleInfo(sampleInfo));
|
||||
|
|
|
@ -17,9 +17,7 @@ public enum TaikoSkinComponents
|
|||
BarLine,
|
||||
TaikoExplosionMiss,
|
||||
TaikoExplosionGood,
|
||||
TaikoExplosionGoodStrong,
|
||||
TaikoExplosionGreat,
|
||||
TaikoExplosionGreatStrong,
|
||||
Scroller,
|
||||
Mascot,
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osuTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
|
@ -10,7 +9,6 @@
|
|||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.UI
|
||||
|
@ -50,10 +48,10 @@ public HitExplosion(DrawableHitObject judgedObject, HitResult result)
|
|||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Child = skinnable = new SkinnableDrawable(new TaikoSkinComponent(getComponentName(JudgedObject)), _ => new DefaultHitExplosion(JudgedObject, result));
|
||||
Child = skinnable = new SkinnableDrawable(new TaikoSkinComponent(getComponentName(result)), _ => new DefaultHitExplosion(JudgedObject, result));
|
||||
}
|
||||
|
||||
private TaikoSkinComponents getComponentName(DrawableHitObject judgedObject)
|
||||
private static TaikoSkinComponents getComponentName(HitResult result)
|
||||
{
|
||||
switch (result)
|
||||
{
|
||||
|
@ -61,28 +59,13 @@ private TaikoSkinComponents getComponentName(DrawableHitObject judgedObject)
|
|||
return TaikoSkinComponents.TaikoExplosionMiss;
|
||||
|
||||
case HitResult.Good:
|
||||
return useStrongExplosion(judgedObject)
|
||||
? TaikoSkinComponents.TaikoExplosionGoodStrong
|
||||
: TaikoSkinComponents.TaikoExplosionGood;
|
||||
return TaikoSkinComponents.TaikoExplosionGood;
|
||||
|
||||
case HitResult.Great:
|
||||
return useStrongExplosion(judgedObject)
|
||||
? TaikoSkinComponents.TaikoExplosionGreatStrong
|
||||
: TaikoSkinComponents.TaikoExplosionGreat;
|
||||
return TaikoSkinComponents.TaikoExplosionGreat;
|
||||
}
|
||||
|
||||
throw new ArgumentOutOfRangeException(nameof(judgedObject), "Invalid result type");
|
||||
}
|
||||
|
||||
private bool useStrongExplosion(DrawableHitObject judgedObject)
|
||||
{
|
||||
if (!(judgedObject.HitObject is Hit))
|
||||
return false;
|
||||
|
||||
if (!(judgedObject.NestedHitObjects.SingleOrDefault() is DrawableStrongNestedHit nestedHit))
|
||||
return false;
|
||||
|
||||
return judgedObject.Result.Type == nestedHit.Result.Type;
|
||||
throw new ArgumentOutOfRangeException(nameof(result), $"Invalid result type: {result}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue