Merge pull request #7577 from ProTheory8/mod-autoopen

Make Difficulty Adjust mod customisation menu open automatically
This commit is contained in:
Dean Herbert 2020-01-23 17:03:04 +09:00 committed by GitHub
commit a6d97f8ee6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 0 deletions

View File

@ -25,6 +25,8 @@ namespace osu.Game.Tests.Visual.UserInterface
private readonly Mod testCustomisableMod = new TestModCustomisable1();
private readonly Mod testCustomisableAutoOpenMod = new TestModCustomisable2();
[Test]
public void TestButtonShowsOnCustomisableMod()
{
@ -53,6 +55,17 @@ namespace osu.Game.Tests.Visual.UserInterface
AddAssert("button enabled", () => modSelect.CustomiseButton.Enabled.Value);
}
[Test]
public void TestCustomisationOpensOnModSelect()
{
createModSelect();
AddStep("open", () => modSelect.Show());
AddAssert("Customisation closed", () => modSelect.ModSettingsContainer.Alpha == 0);
AddStep("select mod", () => modSelect.SelectMod(testCustomisableAutoOpenMod));
AddAssert("Customisation opened", () => modSelect.ModSettingsContainer.Alpha == 1);
}
private void createModSelect()
{
AddStep("create mod select", () =>
@ -128,6 +141,8 @@ namespace osu.Game.Tests.Visual.UserInterface
public override string Name => "Customisable Mod 2";
public override string Acronym => "CM2";
public override bool RequiresConfiguration => true;
}
private abstract class TestModCustomisable : Mod, IApplicableMod

View File

@ -473,7 +473,10 @@ namespace osu.Game.Overlays.Mods
if (selectedMod != null)
{
if (State.Value == Visibility.Visible) sampleOn?.Play();
DeselectTypes(selectedMod.IncompatibleMods, true);
if (selectedMod.RequiresConfiguration) ModSettingsContainer.Alpha = 1;
}
else
{

View File

@ -60,6 +60,12 @@ namespace osu.Game.Rulesets.Mods
[JsonIgnore]
public virtual bool Ranked => false;
/// <summary>
/// Whether this mod requires configuration to apply changes to the game.
/// </summary>
[JsonIgnore]
public virtual bool RequiresConfiguration => false;
/// <summary>
/// The mods this mod cannot be enabled with.
/// </summary>

View File

@ -24,6 +24,8 @@ namespace osu.Game.Rulesets.Mods
public override double ScoreMultiplier => 1.0;
public override bool RequiresConfiguration => true;
public override Type[] IncompatibleMods => new[] { typeof(ModEasy), typeof(ModHardRock) };
[SettingSource("Drain Rate", "Override a beatmap's set HP.")]