mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:17:26 +08:00
Always reset local user settings when a mod is deselected in ModSelectOverlay
This commit is contained in:
parent
be379e0e3c
commit
8204d360a8
@ -69,6 +69,8 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
Mod newSelection = SelectedMod ?? Mods[0];
|
||||
|
||||
newSelection.ResetSettingsToDefaults();
|
||||
|
||||
Schedule(() =>
|
||||
{
|
||||
if (beforeSelected != Selected)
|
||||
|
@ -197,8 +197,10 @@ namespace osu.Game.Overlays.Mods
|
||||
continue;
|
||||
|
||||
var buttonMod = button.Mods[index];
|
||||
buttonMod.CopyFrom(mod);
|
||||
button.SelectAt(index);
|
||||
|
||||
// the selection above will reset settings to defaults, but as this is an external change we want to copy the new settings across.
|
||||
buttonMod.CopyFrom(mod);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -173,5 +173,10 @@ namespace osu.Game.Rulesets.Mods
|
||||
}
|
||||
|
||||
public bool Equals(IMod other) => GetType() == other?.GetType();
|
||||
|
||||
/// <summary>
|
||||
/// Reset all custom settings for this mod back to their defaults.
|
||||
/// </summary>
|
||||
public virtual void ResetSettingsToDefaults() => CopyFrom((Mod)Activator.CreateInstance(GetType()));
|
||||
}
|
||||
}
|
||||
|
@ -141,5 +141,16 @@ namespace osu.Game.Rulesets.Mods
|
||||
ApplySetting(DrainRate, dr => difficulty.DrainRate = dr);
|
||||
ApplySetting(OverallDifficulty, od => difficulty.OverallDifficulty = od);
|
||||
}
|
||||
|
||||
public override void ResetSettingsToDefaults()
|
||||
{
|
||||
base.ResetSettingsToDefaults();
|
||||
|
||||
if (difficulty != null)
|
||||
{
|
||||
// base implementation potentially overwrite modified defaults that came from a beatmap selection.
|
||||
TransferSettings(difficulty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user