mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 17:47:29 +08:00
Fix deselection of autoplay mod failing
This commit is contained in:
parent
57a8cd7461
commit
9bac791a57
@ -9,6 +9,7 @@ using osu.Framework.Screens;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Screens.Ranking;
|
using osu.Game.Screens.Ranking;
|
||||||
@ -42,6 +43,8 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea();
|
protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea();
|
||||||
|
|
||||||
|
private ModAutoplay getAutoplayMod() => Ruleset.Value.CreateInstance().GetAutoplayMod();
|
||||||
|
|
||||||
public override void OnResuming(IScreen last)
|
public override void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
@ -50,10 +53,10 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
if (removeAutoModOnResume)
|
if (removeAutoModOnResume)
|
||||||
{
|
{
|
||||||
var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod()?.GetType();
|
var autoType = getAutoplayMod()?.GetType();
|
||||||
|
|
||||||
if (autoType != null)
|
if (autoType != null)
|
||||||
ModSelect.DeselectTypes(new[] { autoType }, true);
|
Mods.Value = Mods.Value.Where(m => m.GetType() != autoType).ToArray();
|
||||||
|
|
||||||
removeAutoModOnResume = false;
|
removeAutoModOnResume = false;
|
||||||
}
|
}
|
||||||
@ -81,12 +84,9 @@ namespace osu.Game.Screens.Select
|
|||||||
// Ctrl+Enter should start map with autoplay enabled.
|
// Ctrl+Enter should start map with autoplay enabled.
|
||||||
if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true)
|
if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true)
|
||||||
{
|
{
|
||||||
var auto = Ruleset.Value.CreateInstance().GetAutoplayMod();
|
var autoplayMod = getAutoplayMod();
|
||||||
var autoType = auto?.GetType();
|
|
||||||
|
|
||||||
var mods = Mods.Value;
|
if (autoplayMod == null)
|
||||||
|
|
||||||
if (autoType == null)
|
|
||||||
{
|
{
|
||||||
notifications?.Post(new SimpleNotification
|
notifications?.Post(new SimpleNotification
|
||||||
{
|
{
|
||||||
@ -95,9 +95,11 @@ namespace osu.Game.Screens.Select
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mods.All(m => m.GetType() != autoType))
|
var mods = Mods.Value;
|
||||||
|
|
||||||
|
if (mods.All(m => m.GetType() != autoplayMod.GetType()))
|
||||||
{
|
{
|
||||||
Mods.Value = mods.Append(auto).ToArray();
|
Mods.Value = mods.Append(autoplayMod).ToArray();
|
||||||
removeAutoModOnResume = true;
|
removeAutoModOnResume = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user