mirror of
https://github.com/ppy/osu
synced 2025-01-18 20:10:49 +00:00
Only open mod customisation panel on explicit selection of single mod
This commit is contained in:
parent
f0ad31b650
commit
10daac6752
@ -37,6 +37,8 @@ namespace osu.Game.Overlays.Mods
|
||||
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
|
||||
Scale = new Vector2(HEIGHT / ModSwitchSmall.DEFAULT_SIZE)
|
||||
};
|
||||
|
||||
Action = select;
|
||||
}
|
||||
|
||||
public ModPanel(Mod mod)
|
||||
@ -57,6 +59,20 @@ namespace osu.Game.Overlays.Mods
|
||||
Filtered.BindValueChanged(_ => updateFilterState(), true);
|
||||
}
|
||||
|
||||
private void select()
|
||||
{
|
||||
if (!Active.Value)
|
||||
{
|
||||
modState.RequiresConfiguration = Mod.RequiresConfiguration;
|
||||
Active.Value = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
modState.RequiresConfiguration = false;
|
||||
Active.Value = false;
|
||||
}
|
||||
}
|
||||
|
||||
#region Filtering support
|
||||
|
||||
private void updateFilterState()
|
||||
|
@ -247,8 +247,8 @@ namespace osu.Game.Overlays.Mods
|
||||
modSettingChangeTracker?.Dispose();
|
||||
|
||||
updateMultiplier();
|
||||
updateCustomisation(val);
|
||||
updateFromExternalSelection();
|
||||
updateCustomisation();
|
||||
|
||||
if (AllowCustomisation)
|
||||
{
|
||||
@ -356,25 +356,26 @@ namespace osu.Game.Overlays.Mods
|
||||
multiplierDisplay.Current.Value = multiplier;
|
||||
}
|
||||
|
||||
private void updateCustomisation(ValueChangedEvent<IReadOnlyList<Mod>> valueChangedEvent)
|
||||
private void updateCustomisation()
|
||||
{
|
||||
if (CustomisationButton == null)
|
||||
return;
|
||||
|
||||
bool anyCustomisableMod = false;
|
||||
bool anyModWithRequiredCustomisationAdded = false;
|
||||
bool anyCustomisableModActive = false;
|
||||
bool anyModRequiresCustomisation = false;
|
||||
|
||||
foreach (var mod in SelectedMods.Value)
|
||||
foreach (var modState in allAvailableMods)
|
||||
{
|
||||
anyCustomisableMod |= mod.GetSettingsSourceProperties().Any();
|
||||
anyModWithRequiredCustomisationAdded |= valueChangedEvent.OldValue.All(m => m.GetType() != mod.GetType()) && mod.RequiresConfiguration;
|
||||
anyCustomisableModActive |= modState.Active.Value && modState.Mod.GetSettingsSourceProperties().Any();
|
||||
anyModRequiresCustomisation |= modState.RequiresConfiguration;
|
||||
modState.RequiresConfiguration = false;
|
||||
}
|
||||
|
||||
if (anyCustomisableMod)
|
||||
if (anyCustomisableModActive)
|
||||
{
|
||||
customisationVisible.Disabled = false;
|
||||
|
||||
if (anyModWithRequiredCustomisationAdded && !customisationVisible.Value)
|
||||
if (anyModRequiresCustomisation && !customisationVisible.Value)
|
||||
customisationVisible.Value = true;
|
||||
}
|
||||
else
|
||||
|
@ -24,6 +24,13 @@ namespace osu.Game.Overlays.Mods
|
||||
/// </summary>
|
||||
public BindableBool Active { get; } = new BindableBool();
|
||||
|
||||
/// <summary>
|
||||
/// Whether the mod requires further customisation.
|
||||
/// This flag is read by the <see cref="ModSelectOverlay"/> to determine if the customisation panel should be opened after a mod change
|
||||
/// and cleared after reading.
|
||||
/// </summary>
|
||||
public bool RequiresConfiguration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the mod is currently filtered out due to not matching imposed criteria.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user