mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 22:22:54 +08:00
Merge pull request #13884 from peppy/remove-read-from-difficulty
Remove `IApplicableToDifficulty.ReadFromDifficulty`
This commit is contained in:
commit
4b4c341fb8
@ -525,16 +525,11 @@ namespace osu.Game
|
|||||||
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> beatmap)
|
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> beatmap)
|
||||||
{
|
{
|
||||||
beatmap.OldValue?.CancelAsyncLoad();
|
beatmap.OldValue?.CancelAsyncLoad();
|
||||||
|
|
||||||
updateModDefaults();
|
|
||||||
|
|
||||||
beatmap.NewValue?.BeginAsyncLoad();
|
beatmap.NewValue?.BeginAsyncLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void modsChanged(ValueChangedEvent<IReadOnlyList<Mod>> mods)
|
private void modsChanged(ValueChangedEvent<IReadOnlyList<Mod>> mods)
|
||||||
{
|
{
|
||||||
updateModDefaults();
|
|
||||||
|
|
||||||
// a lease may be taken on the mods bindable, at which point we can't really ensure valid mods.
|
// a lease may be taken on the mods bindable, at which point we can't really ensure valid mods.
|
||||||
if (SelectedMods.Disabled)
|
if (SelectedMods.Disabled)
|
||||||
return;
|
return;
|
||||||
@ -546,19 +541,6 @@ namespace osu.Game
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateModDefaults()
|
|
||||||
{
|
|
||||||
BeatmapDifficulty baseDifficulty = Beatmap.Value.BeatmapInfo.BaseDifficulty;
|
|
||||||
|
|
||||||
if (baseDifficulty != null && SelectedMods.Value.Any(m => m is IApplicableToDifficulty))
|
|
||||||
{
|
|
||||||
var adjustedDifficulty = baseDifficulty.Clone();
|
|
||||||
|
|
||||||
foreach (var mod in SelectedMods.Value.OfType<IApplicableToDifficulty>())
|
|
||||||
mod.ReadFromDifficulty(adjustedDifficulty);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private PerformFromMenuRunner performFromMainMenuTask;
|
private PerformFromMenuRunner performFromMainMenuTask;
|
||||||
|
@ -10,13 +10,6 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IApplicableToDifficulty : IApplicableMod
|
public interface IApplicableToDifficulty : IApplicableMod
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Called when a beatmap is changed. Can be used to read default values.
|
|
||||||
/// Any changes made will not be preserved.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="difficulty">The difficulty to read from.</param>
|
|
||||||
void ReadFromDifficulty(BeatmapDifficulty difficulty);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called post beatmap conversion. Can be used to apply changes to difficulty attributes.
|
/// Called post beatmap conversion. Can be used to apply changes to difficulty attributes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user