Use enum values instead of class override

This commit is contained in:
smoogipoo
2020-07-16 21:29:39 +09:00
parent 03a7b8a6ef
commit 8d9e5db641
3 changed files with 33 additions and 22 deletions

View File

@ -9,7 +9,6 @@ using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI;
using osuTK;
namespace osu.Game.Rulesets.Mania.Mods
{
@ -19,6 +18,11 @@ namespace osu.Game.Rulesets.Mania.Mods
public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight<ManiaHitObject>) };
/// <summary>
/// The direction in which the cover should expand.
/// </summary>
protected virtual CoverExpandDirection ExpandDirection => CoverExpandDirection.AgainstScroll;
public virtual void ApplyToDrawableRuleset(DrawableRuleset<ManiaHitObject> drawableRuleset)
{
ManiaPlayfield maniaPlayfield = (ManiaPlayfield)drawableRuleset.Playfield;
@ -29,24 +33,13 @@ namespace osu.Game.Rulesets.Mania.Mods
Container hocParent = (Container)hoc.Parent;
hocParent.Remove(hoc);
hocParent.Add(CreateCover(hoc).With(c =>
hocParent.Add(new PlayfieldCoveringWrapper(hoc).With(c =>
{
c.RelativeSizeAxes = Axes.Both;
c.Direction = ExpandDirection;
c.Coverage = 0.5f;
}));
}
}
protected virtual PlayfieldCoveringWrapper CreateCover(Drawable content) => new ModHiddenCoveringWrapper(content);
private class ModHiddenCoveringWrapper : PlayfieldCoveringWrapper
{
public ModHiddenCoveringWrapper(Drawable content)
: base(content)
{
// This cover extends outwards from the hit position.
Cover.Scale = new Vector2(1, -1);
}
}
}
}