mirror of
https://github.com/osukey/osukey.git
synced 2025-06-22 19:57:56 +09:00
Use removeAutoModOnResume as a field.
This commit is contained in:
parent
62b3540fd6
commit
74facb32b4
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -12,7 +11,6 @@ using osu.Framework.Screens;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Overlays.Mods;
|
using osu.Game.Overlays.Mods;
|
||||||
using osu.Game.Rulesets.Mods;
|
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Screens.Ranking;
|
using osu.Game.Screens.Ranking;
|
||||||
@ -24,7 +22,7 @@ namespace osu.Game.Screens.Select
|
|||||||
private OsuScreen player;
|
private OsuScreen player;
|
||||||
private readonly ModSelectOverlay modSelect;
|
private readonly ModSelectOverlay modSelect;
|
||||||
private readonly BeatmapDetailArea beatmapDetails;
|
private readonly BeatmapDetailArea beatmapDetails;
|
||||||
private IEnumerable<Mod> originalMods;
|
private bool removeAutoModOnResume;
|
||||||
|
|
||||||
public PlaySongSelect()
|
public PlaySongSelect()
|
||||||
{
|
{
|
||||||
@ -76,8 +74,12 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
player = null;
|
player = null;
|
||||||
|
|
||||||
modSelect.SelectedMods.Value = originalMods;
|
if (removeAutoModOnResume)
|
||||||
originalMods = null;
|
{
|
||||||
|
var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod().GetType();
|
||||||
|
modSelect.SelectedMods.Value = modSelect.SelectedMods.Value.Where(m => m.GetType() != autoType).ToArray();
|
||||||
|
}
|
||||||
|
removeAutoModOnResume = false;
|
||||||
|
|
||||||
Beatmap.Value.Track.Looping = true;
|
Beatmap.Value.Track.Looping = true;
|
||||||
|
|
||||||
@ -112,14 +114,17 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
if (player != null) return;
|
if (player != null) return;
|
||||||
|
|
||||||
originalMods = modSelect.SelectedMods.Value;
|
|
||||||
if (state?.Keyboard.ControlPressed == true)
|
if (state?.Keyboard.ControlPressed == true)
|
||||||
{
|
{
|
||||||
var auto = Ruleset.Value.CreateInstance().GetAutoplayMod();
|
var auto = Ruleset.Value.CreateInstance().GetAutoplayMod();
|
||||||
var autoType = auto.GetType();
|
var autoType = auto.GetType();
|
||||||
|
|
||||||
if (originalMods.All(m => m.GetType() != autoType))
|
var mods = modSelect.SelectedMods.Value;
|
||||||
modSelect.SelectedMods.Value = originalMods.Concat(new[] { auto });
|
if (mods.All(m => m.GetType() != autoType))
|
||||||
|
{
|
||||||
|
modSelect.SelectedMods.Value = mods.Concat(new[] { auto });
|
||||||
|
removeAutoModOnResume = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Beatmap.Value.Track.Looping = false;
|
Beatmap.Value.Track.Looping = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user