Rename variables and avoid the need for a property

This commit is contained in:
Dean Herbert 2023-01-09 16:49:36 +09:00
parent 28bd005c21
commit efded323e4
4 changed files with 10 additions and 6 deletions

View File

@ -14,6 +14,6 @@ public partial class TestSceneManiaModHidden : ModTestScene
[TestCase(0.5f)] [TestCase(0.5f)]
[TestCase(0.2f)] [TestCase(0.2f)]
[TestCase(0.8f)] [TestCase(0.8f)]
public void TestCoverage(float coverage) => CreateModTest(new ModTestData { Mod = new ManiaModHidden { CoverageAmount = { Value = coverage } }, PassCondition = () => true }); public void TestCoverage(float coverage) => CreateModTest(new ModTestData { Mod = new ManiaModHidden { Coverage = { Value = coverage } }, PassCondition = () => true });
} }
} }

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mania.UI;
@ -18,5 +19,9 @@ public class ManiaModFadeIn : ManiaModPlayfieldCover
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ManiaModHidden)).ToArray(); public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ManiaModHidden)).ToArray();
protected override CoverExpandDirection ExpandDirection => CoverExpandDirection.AlongScroll; protected override CoverExpandDirection ExpandDirection => CoverExpandDirection.AlongScroll;
// This could be customisable like ManiaModHidden in the future if there's any demand.
// At that point, the bindable could be moved to `ManiaModPlayfieldCover`.
public override BindableNumber<float> Coverage { get; } = new BindableFloat(0.5f);
} }
} }

View File

@ -16,7 +16,7 @@ public class ManiaModHidden : ManiaModPlayfieldCover
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
[SettingSource("Coverage", "The proportion of playfield height that notes will be hidden for.")] [SettingSource("Coverage", "The proportion of playfield height that notes will be hidden for.")]
public BindableNumber<float> CoverageAmount { get; } = new BindableFloat(0.5f) public override BindableNumber<float> Coverage { get; } = new BindableFloat(0.5f)
{ {
Precision = 0.1f, Precision = 0.1f,
MinValue = 0.2f, MinValue = 0.2f,
@ -24,8 +24,6 @@ public class ManiaModHidden : ManiaModPlayfieldCover
Default = 0.5f, Default = 0.5f,
}; };
protected override float Coverage => CoverageAmount.Value;
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ManiaModFadeIn)).ToArray(); public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ManiaModFadeIn)).ToArray();
protected override CoverExpandDirection ExpandDirection => CoverExpandDirection.AgainstScroll; protected override CoverExpandDirection ExpandDirection => CoverExpandDirection.AgainstScroll;

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
@ -22,7 +23,7 @@ public abstract class ManiaModPlayfieldCover : ModHidden, IApplicableToDrawableR
/// </summary> /// </summary>
protected abstract CoverExpandDirection ExpandDirection { get; } protected abstract CoverExpandDirection ExpandDirection { get; }
protected virtual float Coverage => 0.5f; public abstract BindableNumber<float> Coverage { get; }
public virtual void ApplyToDrawableRuleset(DrawableRuleset<ManiaHitObject> drawableRuleset) public virtual void ApplyToDrawableRuleset(DrawableRuleset<ManiaHitObject> drawableRuleset)
{ {
@ -38,7 +39,7 @@ public virtual void ApplyToDrawableRuleset(DrawableRuleset<ManiaHitObject> drawa
{ {
c.RelativeSizeAxes = Axes.Both; c.RelativeSizeAxes = Axes.Both;
c.Direction = ExpandDirection; c.Direction = ExpandDirection;
c.Coverage = Coverage; c.Coverage = Coverage.Value;
})); }));
} }
} }