Add mania hidden mod configuration

This commit is contained in:
Dylan Nantz 2022-12-19 18:31:28 -05:00
parent b42accb763
commit c200e77994
3 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,19 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Game.Rulesets.Mania.Mods;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Mania.Tests.Mods
{
public partial class TestSceneManiaModHidden : ModTestScene
{
protected override Ruleset CreatePlayerRuleset() => new ManiaRuleset();
[TestCase(0.5f)]
[TestCase(0.2f)]
[TestCase(0.8f)]
public void TestCoverage(float Coverage) => CreateModTest(new ModTestData { Mod = new ManiaModHidden { CoverageAmount = { Value = Coverage } }, PassCondition = () => true });
}
}

View File

@ -4,7 +4,9 @@
using System;
using System.Linq;
using osu.Framework.Localisation;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mania.UI;
using osu.Framework.Bindables;
namespace osu.Game.Rulesets.Mania.Mods
{
@ -13,6 +15,16 @@ public class ManiaModHidden : ManiaModPlayfieldCover
public override LocalisableString Description => @"Keys fade out before you hit them!";
public override double ScoreMultiplier => 1;
[SettingSource("Coverage", "How much of the playfield notes should be hidden for.")]
public BindableNumber<float> CoverageAmount { get; } = new BindableFloat(0.5f)
{
Precision = 0.01f,
MinValue = 0.2f,
MaxValue = 0.8f,
Default = 0.5f,
};
public override float Coverage => CoverageAmount.Value;
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ManiaModFadeIn)).ToArray();
protected override CoverExpandDirection ExpandDirection => CoverExpandDirection.AgainstScroll;

View File

@ -22,6 +22,8 @@ public abstract class ManiaModPlayfieldCover : ModHidden, IApplicableToDrawableR
/// </summary>
protected abstract CoverExpandDirection ExpandDirection { get; }
public virtual float Coverage {get => 0.5f;}
public virtual void ApplyToDrawableRuleset(DrawableRuleset<ManiaHitObject> drawableRuleset)
{
ManiaPlayfield maniaPlayfield = (ManiaPlayfield)drawableRuleset.Playfield;
@ -36,7 +38,7 @@ public virtual void ApplyToDrawableRuleset(DrawableRuleset<ManiaHitObject> drawa
{
c.RelativeSizeAxes = Axes.Both;
c.Direction = ExpandDirection;
c.Coverage = 0.5f;
c.Coverage = Coverage;
}));
}
}