mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Ensure gameplay can't start when an UnknownMod
is present
This commit is contained in:
parent
0267aed846
commit
1ee0be5e39
26
osu.Game.Tests/Visual/Gameplay/UnknownModTestScene.cs
Normal file
26
osu.Game.Tests/Visual/Gameplay/UnknownModTestScene.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
public class TestSceneUnknownMod : ModTestScene
|
||||||
|
{
|
||||||
|
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestUnknownModDoesntEnterGameplay()
|
||||||
|
{
|
||||||
|
CreateModTest(new ModTestData
|
||||||
|
{
|
||||||
|
Beatmap = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo).Beatmap,
|
||||||
|
Mod = new UnknownMod("WNG"),
|
||||||
|
PassCondition = () => Player.IsLoaded && !Player.LoadedBeatmapSuccessfully
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -185,6 +185,12 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
var gameplayMods = Mods.Value.Select(m => m.DeepClone()).ToArray();
|
var gameplayMods = Mods.Value.Select(m => m.DeepClone()).ToArray();
|
||||||
|
|
||||||
|
if (gameplayMods.Any(m => m is UnknownMod))
|
||||||
|
{
|
||||||
|
Logger.Log("Gameplay was started with an unknown mod applied.", level: LogLevel.Important);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Beatmap.Value is DummyWorkingBeatmap)
|
if (Beatmap.Value is DummyWorkingBeatmap)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user