mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Fix global mods being retained by rooms
This commit is contained in:
@ -162,6 +162,28 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddAssert("item 2 has rate 2", () => Precision.AlmostEquals(2, ((OsuModDoubleTime)Room.Playlist.Last().RequiredMods[0]).SpeedChange.Value));
|
AddAssert("item 2 has rate 2", () => Precision.AlmostEquals(2, ((OsuModDoubleTime)Room.Playlist.Last().RequiredMods[0]).SpeedChange.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tests that the global mod instances are not retained by the rooms, as global mod instances are retained and re-used by the mod select overlay.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestGlobalModInstancesNotRetained()
|
||||||
|
{
|
||||||
|
OsuModDoubleTime mod = null;
|
||||||
|
|
||||||
|
AddStep("set dt mod and store", () =>
|
||||||
|
{
|
||||||
|
SelectedMods.Value = new[] { new OsuModDoubleTime() };
|
||||||
|
|
||||||
|
// Mod select overlay replaces our mod.
|
||||||
|
mod = (OsuModDoubleTime)SelectedMods.Value[0];
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("create item", () => songSelect.BeatmapDetails.CreateNewItem());
|
||||||
|
|
||||||
|
AddStep("change stored mod rate", () => mod.SpeedChange.Value = 2);
|
||||||
|
AddAssert("item has rate 1.5", () => Precision.AlmostEquals(1.5, ((OsuModDoubleTime)Room.Playlist.First().RequiredMods[0]).SpeedChange.Value));
|
||||||
|
}
|
||||||
|
|
||||||
private class TestMatchSongSelect : MatchSongSelect
|
private class TestMatchSongSelect : MatchSongSelect
|
||||||
{
|
{
|
||||||
public new MatchBeatmapDetailArea BeatmapDetails => (MatchBeatmapDetailArea)base.BeatmapDetails;
|
public new MatchBeatmapDetailArea BeatmapDetails => (MatchBeatmapDetailArea)base.BeatmapDetails;
|
||||||
|
@ -76,9 +76,7 @@ namespace osu.Game.Screens.Select
|
|||||||
item.Ruleset.Value = Ruleset.Value;
|
item.Ruleset.Value = Ruleset.Value;
|
||||||
|
|
||||||
item.RequiredMods.Clear();
|
item.RequiredMods.Clear();
|
||||||
item.RequiredMods.AddRange(Mods.Value);
|
item.RequiredMods.AddRange(Mods.Value.Select(m => m.CreateCopy()));
|
||||||
|
|
||||||
Mods.Value = Mods.Value.Select(m => m.CreateCopy()).ToArray();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user