mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Fix difficulty adjust mod not correctly reading settings while leaderboard visible
This commit is contained in:
@ -39,6 +39,7 @@ using osu.Game.Online.Chat;
|
|||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Game.Overlays.Volume;
|
using osu.Game.Overlays.Volume;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
@ -204,6 +205,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeFade);
|
Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeFade);
|
||||||
|
|
||||||
|
SelectedMods.BindValueChanged(modsChanged);
|
||||||
Beatmap.BindValueChanged(beatmapChanged, true);
|
Beatmap.BindValueChanged(beatmapChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,9 +405,29 @@ namespace osu.Game
|
|||||||
oldBeatmap.Track.Completed -= currentTrackCompleted;
|
oldBeatmap.Track.Completed -= currentTrackCompleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateModDefaults();
|
||||||
|
|
||||||
nextBeatmap?.LoadBeatmapAsync();
|
nextBeatmap?.LoadBeatmapAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void modsChanged(ValueChangedEvent<IReadOnlyList<Mod>> mods)
|
||||||
|
{
|
||||||
|
updateModDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void currentTrackCompleted() => Schedule(() =>
|
private void currentTrackCompleted() => Schedule(() =>
|
||||||
{
|
{
|
||||||
if (!Beatmap.Value.Track.Looping && !Beatmap.Disabled)
|
if (!Beatmap.Value.Track.Looping && !Beatmap.Disabled)
|
||||||
|
@ -10,6 +10,17 @@ 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"></param>
|
||||||
|
void ReadFromDifficulty(BeatmapDifficulty difficulty);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called post beatmap conversion. Can be used to apply changes to difficulty attributes.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="difficulty"></param>
|
||||||
void ApplyToDifficulty(BeatmapDifficulty difficulty);
|
void ApplyToDifficulty(BeatmapDifficulty difficulty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,17 +47,17 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
|
|
||||||
private BeatmapDifficulty difficulty;
|
private BeatmapDifficulty difficulty;
|
||||||
|
|
||||||
public void ApplyToDifficulty(BeatmapDifficulty difficulty)
|
public void ReadFromDifficulty(BeatmapDifficulty difficulty)
|
||||||
{
|
{
|
||||||
if (this.difficulty == null || this.difficulty.ID != difficulty.ID)
|
if (this.difficulty == null || this.difficulty.ID != difficulty.ID)
|
||||||
{
|
{
|
||||||
this.difficulty = difficulty;
|
this.difficulty = difficulty;
|
||||||
TransferSettings(difficulty);
|
TransferSettings(difficulty);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
ApplySettings(difficulty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ApplyToDifficulty(BeatmapDifficulty difficulty) => ApplySettings(difficulty);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Transfer initial settings from the beatmap to settings.
|
/// Transfer initial settings from the beatmap to settings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -33,6 +33,8 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
|
|
||||||
private BindableNumber<double> health;
|
private BindableNumber<double> health;
|
||||||
|
|
||||||
|
public void ReadFromDifficulty(BeatmapDifficulty difficulty) { }
|
||||||
|
|
||||||
public void ApplyToDifficulty(BeatmapDifficulty difficulty)
|
public void ApplyToDifficulty(BeatmapDifficulty difficulty)
|
||||||
{
|
{
|
||||||
const float ratio = 0.5f;
|
const float ratio = 0.5f;
|
||||||
|
@ -17,6 +17,8 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
public override string Description => "Everything just got a bit harder...";
|
public override string Description => "Everything just got a bit harder...";
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModEasy), typeof(ModDifficultyAdjust) };
|
public override Type[] IncompatibleMods => new[] { typeof(ModEasy), typeof(ModDifficultyAdjust) };
|
||||||
|
|
||||||
|
public void ReadFromDifficulty(BeatmapDifficulty difficulty) { }
|
||||||
|
|
||||||
public void ApplyToDifficulty(BeatmapDifficulty difficulty)
|
public void ApplyToDifficulty(BeatmapDifficulty difficulty)
|
||||||
{
|
{
|
||||||
const float ratio = 1.4f;
|
const float ratio = 1.4f;
|
||||||
|
Reference in New Issue
Block a user