Fix setting items not creating if mods initially not empty

This commit is contained in:
Bartłomiej Dach 2022-05-02 23:05:35 +02:00
parent e3641213e1
commit 970361676b
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
2 changed files with 5 additions and 2 deletions

View File

@ -68,6 +68,7 @@ public void TestPreexistingSelection()
return Precision.AlmostEquals(multiplier, modSelectScreen.ChildrenOfType<DifficultyMultiplierDisplay>().Single().Current.Value);
});
assertCustomisationToggleState(disabled: false, active: false);
AddAssert("setting items created", () => modSelectScreen.ChildrenOfType<ISettingsItem>().Any());
}
[Test]
@ -82,6 +83,7 @@ public void TestExternalSelection()
return Precision.AlmostEquals(multiplier, modSelectScreen.ChildrenOfType<DifficultyMultiplierDisplay>().Single().Current.Value);
});
assertCustomisationToggleState(disabled: false, active: false);
AddAssert("setting items created", () => modSelectScreen.ChildrenOfType<ISettingsItem>().Any());
}
[Test]

View File

@ -1,6 +1,7 @@
// 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 System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
@ -21,7 +22,7 @@ namespace osu.Game.Overlays.Mods
{
public class ModSettingsArea : CompositeDrawable
{
public Bindable<IReadOnlyList<Mod>> SelectedMods { get; } = new Bindable<IReadOnlyList<Mod>>();
public Bindable<IReadOnlyList<Mod>> SelectedMods { get; } = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
public const float HEIGHT = 250;
@ -77,7 +78,7 @@ private void load()
protected override void LoadComplete()
{
base.LoadComplete();
SelectedMods.BindValueChanged(_ => updateMods());
SelectedMods.BindValueChanged(_ => updateMods(), true);
}
private void updateMods()