1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 18:42:56 +08:00

Rename SelectedMods -> Mods

This commit is contained in:
smoogipoo 2019-04-10 12:03:57 +09:00
parent 1c952e58cc
commit 4310f07a5c
26 changed files with 55 additions and 58 deletions

View File

@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Catch.Tests
protected override Player CreatePlayer(Ruleset ruleset) protected override Player CreatePlayer(Ruleset ruleset)
{ {
SelectedMods.Value = SelectedMods.Value.Concat(new[] { ruleset.GetAutoplayMod() }); Mods.Value = Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
return base.CreatePlayer(ruleset); return base.CreatePlayer(ruleset);
} }
} }

View File

@ -30,7 +30,6 @@ namespace osu.Game.Rulesets.Osu.Tests
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
private int depthIndex; private int depthIndex;
protected readonly List<Mod> Mods = new List<Mod>();
public TestCaseHitCircle() public TestCaseHitCircle()
{ {
@ -68,7 +67,7 @@ namespace osu.Game.Rulesets.Osu.Tests
Depth = depthIndex++ Depth = depthIndex++
}; };
foreach (var mod in Mods.OfType<IApplicableToDrawableHitObjects>()) foreach (var mod in Mods.Value.OfType<IApplicableToDrawableHitObjects>())
mod.ApplyToDrawableHitObjects(new[] { drawable }); mod.ApplyToDrawableHitObjects(new[] { drawable });
Add(drawable); Add(drawable);

View File

@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Tests
public TestCaseHitCircleHidden() public TestCaseHitCircleHidden()
{ {
Mods.Add(new OsuModHidden()); Mods.Value = new[] { new OsuModHidden() };
} }
} }
} }

View File

@ -44,7 +44,6 @@ namespace osu.Game.Rulesets.Osu.Tests
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
private int depthIndex; private int depthIndex;
protected readonly List<Mod> Mods = new List<Mod>();
public TestCaseSlider() public TestCaseSlider()
{ {
@ -292,7 +291,7 @@ namespace osu.Game.Rulesets.Osu.Tests
Depth = depthIndex++ Depth = depthIndex++
}; };
foreach (var mod in Mods.OfType<IApplicableToDrawableHitObjects>()) foreach (var mod in Mods.Value.OfType<IApplicableToDrawableHitObjects>())
mod.ApplyToDrawableHitObjects(new[] { drawable }); mod.ApplyToDrawableHitObjects(new[] { drawable });
drawable.OnNewResult += onNewResult; drawable.OnNewResult += onNewResult;

View File

@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Tests
public TestCaseSliderHidden() public TestCaseSliderHidden()
{ {
Mods.Add(new OsuModHidden()); Mods.Value = new[] { new OsuModHidden() };
} }
} }
} }

View File

@ -31,7 +31,6 @@ namespace osu.Game.Rulesets.Osu.Tests
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
private int depthIndex; private int depthIndex;
protected readonly List<Mod> Mods = new List<Mod>();
public TestCaseSpinner() public TestCaseSpinner()
{ {
@ -57,7 +56,7 @@ namespace osu.Game.Rulesets.Osu.Tests
Depth = depthIndex++ Depth = depthIndex++
}; };
foreach (var mod in Mods.OfType<IApplicableToDrawableHitObjects>()) foreach (var mod in Mods.Value.OfType<IApplicableToDrawableHitObjects>())
mod.ApplyToDrawableHitObjects(new[] { drawable }); mod.ApplyToDrawableHitObjects(new[] { drawable });
Add(drawable); Add(drawable);

View File

@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Tests
public TestCaseSpinnerHidden() public TestCaseSpinnerHidden()
{ {
Mods.Add(new OsuModHidden()); Mods.Value = new[] { new OsuModHidden() };
} }
} }
} }

View File

@ -267,7 +267,7 @@ namespace osu.Game.Tests.Visual.Background
AddUntilStep("Song select has selection", () => songSelect.Carousel.SelectedBeatmap != null); AddUntilStep("Song select has selection", () => songSelect.Carousel.SelectedBeatmap != null);
AddStep("Set default user settings", () => AddStep("Set default user settings", () =>
{ {
SelectedMods.Value = SelectedMods.Value.Concat(new[] { new OsuModNoFail() }); Mods.Value = Mods.Value.Concat(new[] { new OsuModNoFail() });
songSelect.DimLevel.Value = 0.7f; songSelect.DimLevel.Value = 0.7f;
songSelect.BlurLevel.Value = 0.4f; songSelect.BlurLevel.Value = 0.4f;
}); });

View File

@ -14,7 +14,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{ {
protected override Player CreatePlayer(Ruleset ruleset) protected override Player CreatePlayer(Ruleset ruleset)
{ {
SelectedMods.Value = SelectedMods.Value.Concat(new[] { ruleset.GetAutoplayMod() }); Mods.Value = Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
return new ScoreAccessiblePlayer(); return new ScoreAccessiblePlayer();
} }

View File

@ -171,17 +171,17 @@ namespace osu.Game.Tests.Visual.SongSelect
AddStep("change ruleset", () => AddStep("change ruleset", () =>
{ {
SelectedMods.ValueChanged += onModChange; Mods.ValueChanged += onModChange;
songSelect.Ruleset.ValueChanged += onRulesetChange; songSelect.Ruleset.ValueChanged += onRulesetChange;
Ruleset.Value = new TaikoRuleset().RulesetInfo; Ruleset.Value = new TaikoRuleset().RulesetInfo;
SelectedMods.ValueChanged -= onModChange; Mods.ValueChanged -= onModChange;
songSelect.Ruleset.ValueChanged -= onRulesetChange; songSelect.Ruleset.ValueChanged -= onRulesetChange;
}); });
AddAssert("mods changed before ruleset", () => modChangeIndex < rulesetChangeIndex); AddAssert("mods changed before ruleset", () => modChangeIndex < rulesetChangeIndex);
AddAssert("empty mods", () => !SelectedMods.Value.Any()); AddAssert("empty mods", () => !Mods.Value.Any());
void onModChange(ValueChangedEvent<IEnumerable<Mod>> e) => modChangeIndex = actionIndex++; void onModChange(ValueChangedEvent<IEnumerable<Mod>> e) => modChangeIndex = actionIndex++;
void onRulesetChange(ValueChangedEvent<RulesetInfo> e) => rulesetChangeIndex = actionIndex--; void onRulesetChange(ValueChangedEvent<RulesetInfo> e) => rulesetChangeIndex = actionIndex--;
@ -214,7 +214,7 @@ namespace osu.Game.Tests.Visual.SongSelect
private static int importId; private static int importId;
private int getImportId() => ++importId; private int getImportId() => ++importId;
private void changeMods(params Mod[] mods) => AddStep($"change mods to {string.Join(", ", mods.Select(m => m.Acronym))}", () => SelectedMods.Value = mods); private void changeMods(params Mod[] mods) => AddStep($"change mods to {string.Join(", ", mods.Select(m => m.Acronym))}", () => Mods.Value = mods);
private void changeRuleset(int id) => AddStep($"change ruleset to {id}", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == id)); private void changeRuleset(int id) => AddStep($"change ruleset to {id}", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == id));

View File

@ -113,7 +113,7 @@ namespace osu.Game
// todo: move this to SongSelect once Screen has the ability to unsuspend. // todo: move this to SongSelect once Screen has the ability to unsuspend.
[Cached] [Cached]
[Cached(Type = typeof(IBindable<IEnumerable<Mod>>))] [Cached(Type = typeof(IBindable<IEnumerable<Mod>>))]
private readonly Bindable<IEnumerable<Mod>> selectedMods = new Bindable<IEnumerable<Mod>>(Enumerable.Empty<Mod>()); private readonly Bindable<IEnumerable<Mod>> mods = new Bindable<IEnumerable<Mod>>(Enumerable.Empty<Mod>());
public OsuGame(string[] args = null) public OsuGame(string[] args = null)
{ {
@ -294,7 +294,7 @@ namespace osu.Game
{ {
ruleset.Value = databasedScoreInfo.Ruleset; ruleset.Value = databasedScoreInfo.Ruleset;
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap); Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap);
selectedMods.Value = databasedScoreInfo.Mods; mods.Value = databasedScoreInfo.Mods;
menuScreen.Push(new PlayerLoader(() => new ReplayPlayer(databasedScore))); menuScreen.Push(new PlayerLoader(() => new ReplayPlayer(databasedScore)));
}, $"watch {databasedScoreInfo}", bypassScreenAllowChecks: true); }, $"watch {databasedScoreInfo}", bypassScreenAllowChecks: true);

View File

@ -42,19 +42,19 @@ namespace osu.Game.Overlays.Mods
protected readonly FillFlowContainer<ModSection> ModSectionsContainer; protected readonly FillFlowContainer<ModSection> ModSectionsContainer;
protected readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>(new Mod[] { }); protected readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>(Enumerable.Empty<Mod>());
protected readonly IBindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>(); protected readonly IBindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(OsuColour colours, IBindable<RulesetInfo> ruleset, AudioManager audio, Bindable<IEnumerable<Mod>> selectedMods) private void load(OsuColour colours, IBindable<RulesetInfo> ruleset, AudioManager audio, Bindable<IEnumerable<Mod>> mods)
{ {
LowMultiplierColour = colours.Red; LowMultiplierColour = colours.Red;
HighMultiplierColour = colours.Green; HighMultiplierColour = colours.Green;
UnrankedLabel.Colour = colours.Blue; UnrankedLabel.Colour = colours.Blue;
Ruleset.BindTo(ruleset); Ruleset.BindTo(ruleset);
if (selectedMods != null) SelectedMods.BindTo(selectedMods); if (mods != null) SelectedMods.BindTo(mods);
sampleOn = audio.Sample.Get(@"UI/check-on"); sampleOn = audio.Sample.Get(@"UI/check-on");
sampleOff = audio.Sample.Get(@"UI/check-off"); sampleOff = audio.Sample.Get(@"UI/check-off");

View File

@ -59,7 +59,7 @@ namespace osu.Game.Overlays
private Bindable<WorkingBeatmap> beatmap { get; set; } private Bindable<WorkingBeatmap> beatmap { get; set; }
[Resolved] [Resolved]
private IBindable<IEnumerable<Mod>> selectedMods { get; set; } private IBindable<IEnumerable<Mod>> mods { get; set; }
/// <summary> /// <summary>
/// Provide a source for the toolbar height. /// Provide a source for the toolbar height.
@ -235,7 +235,7 @@ namespace osu.Game.Overlays
{ {
beatmap.BindValueChanged(beatmapChanged, true); beatmap.BindValueChanged(beatmapChanged, true);
beatmap.BindDisabledChanged(beatmapDisabledChanged, true); beatmap.BindDisabledChanged(beatmapDisabledChanged, true);
selectedMods.BindValueChanged(_ => updateAudioAdjustments(), true); mods.BindValueChanged(_ => updateAudioAdjustments(), true);
base.LoadComplete(); base.LoadComplete();
} }
@ -372,7 +372,7 @@ namespace osu.Game.Overlays
track.ResetSpeedAdjustments(); track.ResetSpeedAdjustments();
foreach (var mod in selectedMods.Value.OfType<IApplicableToClock>()) foreach (var mod in mods.Value.OfType<IApplicableToClock>())
mod.ApplyToClock(track); mod.ApplyToClock(track);
} }

View File

@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.UI
private IBindable<WorkingBeatmap> beatmap { get; set; } private IBindable<WorkingBeatmap> beatmap { get; set; }
[Resolved] [Resolved]
private IBindable<IEnumerable<Mod>> selectedMods { get; set; } private IBindable<IEnumerable<Mod>> mods { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
@ -125,7 +125,7 @@ namespace osu.Game.Rulesets.UI
base.Update(); base.Update();
if (beatmap != null) if (beatmap != null)
foreach (var mod in selectedMods.Value) foreach (var mod in mods.Value)
if (mod is IUpdatableByPlayfield updatable) if (mod is IUpdatableByPlayfield updatable)
updatable.Update(this); updatable.Update(this);
} }

View File

@ -179,7 +179,7 @@ namespace osu.Game.Screens.Multi.Match
{ {
RoomManager?.PartRoom(); RoomManager?.PartRoom();
SelectedMods.Value = Enumerable.Empty<Mod>(); Mods.Value = Enumerable.Empty<Mod>();
return base.OnExiting(next); return base.OnExiting(next);
} }
@ -193,7 +193,7 @@ namespace osu.Game.Screens.Multi.Match
var localBeatmap = e.NewValue?.Beatmap == null ? null : beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == e.NewValue.Beatmap.OnlineBeatmapID); var localBeatmap = e.NewValue?.Beatmap == null ? null : beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == e.NewValue.Beatmap.OnlineBeatmapID);
Beatmap.Value = beatmapManager.GetWorkingBeatmap(localBeatmap); Beatmap.Value = beatmapManager.GetWorkingBeatmap(localBeatmap);
SelectedMods.Value = e.NewValue?.RequiredMods ?? Enumerable.Empty<Mod>(); Mods.Value = e.NewValue?.RequiredMods ?? Enumerable.Empty<Mod>();
if (e.NewValue?.Ruleset != null) if (e.NewValue?.Ruleset != null)
Ruleset.Value = e.NewValue.Ruleset; Ruleset.Value = e.NewValue.Ruleset;
} }

View File

@ -56,7 +56,7 @@ namespace osu.Game.Screens.Multi.Play
if (ruleset.Value.ID != playlistItem.Ruleset.ID) if (ruleset.Value.ID != playlistItem.Ruleset.ID)
throw new InvalidOperationException("Current Ruleset does not match PlaylistItem's Ruleset"); throw new InvalidOperationException("Current Ruleset does not match PlaylistItem's Ruleset");
if (!playlistItem.RequiredMods.All(m => SelectedMods.Value.Contains(m))) if (!playlistItem.RequiredMods.All(m => Mods.Value.Contains(m)))
throw new InvalidOperationException("Current Mods do not match PlaylistItem's RequiredMods"); throw new InvalidOperationException("Current Mods do not match PlaylistItem's RequiredMods");
var req = new CreateRoomScoreRequest(roomId.Value ?? 0, playlistItem.ID); var req = new CreateRoomScoreRequest(roomId.Value ?? 0, playlistItem.ID);

View File

@ -65,7 +65,7 @@ namespace osu.Game.Screens
public Bindable<RulesetInfo> Ruleset { get; private set; } public Bindable<RulesetInfo> Ruleset { get; private set; }
public Bindable<IEnumerable<Mod>> SelectedMods { get; private set; } public Bindable<IEnumerable<Mod>> Mods { get; private set; }
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{ {
@ -73,7 +73,7 @@ namespace osu.Game.Screens
Beatmap = screenDependencies.Beatmap; Beatmap = screenDependencies.Beatmap;
Ruleset = screenDependencies.Ruleset; Ruleset = screenDependencies.Ruleset;
SelectedMods = screenDependencies.SelectedMods; Mods = screenDependencies.Mods;
return base.CreateChildDependencies(screenDependencies); return base.CreateChildDependencies(screenDependencies);
} }

View File

@ -16,7 +16,7 @@ namespace osu.Game.Screens
public Bindable<RulesetInfo> Ruleset { get; } public Bindable<RulesetInfo> Ruleset { get; }
public Bindable<IEnumerable<Mod>> SelectedMods { get; } public Bindable<IEnumerable<Mod>> Mods { get; }
public OsuScreenDependencies(bool requireLease, IReadOnlyDependencyContainer parent) public OsuScreenDependencies(bool requireLease, IReadOnlyDependencyContainer parent)
: base(parent) : base(parent)
@ -31,15 +31,15 @@ namespace osu.Game.Screens
if (Ruleset == null) if (Ruleset == null)
Cache(Ruleset = parent.Get<Bindable<RulesetInfo>>().BeginLease(true)); Cache(Ruleset = parent.Get<Bindable<RulesetInfo>>().BeginLease(true));
SelectedMods = parent.Get<LeasedBindable<IEnumerable<Mod>>>()?.GetBoundCopy(); Mods = parent.Get<LeasedBindable<IEnumerable<Mod>>>()?.GetBoundCopy();
if (SelectedMods == null) if (Mods == null)
Cache(SelectedMods = parent.Get<Bindable<IEnumerable<Mod>>>().BeginLease(true)); Cache(Mods = parent.Get<Bindable<IEnumerable<Mod>>>().BeginLease(true));
} }
else else
{ {
Beatmap = (parent.Get<LeasedBindable<WorkingBeatmap>>() ?? parent.Get<Bindable<WorkingBeatmap>>()).GetBoundCopy(); Beatmap = (parent.Get<LeasedBindable<WorkingBeatmap>>() ?? parent.Get<Bindable<WorkingBeatmap>>()).GetBoundCopy();
Ruleset = (parent.Get<LeasedBindable<RulesetInfo>>() ?? parent.Get<Bindable<RulesetInfo>>()).GetBoundCopy(); Ruleset = (parent.Get<LeasedBindable<RulesetInfo>>() ?? parent.Get<Bindable<RulesetInfo>>()).GetBoundCopy();
SelectedMods = (parent.Get<LeasedBindable<IEnumerable<Mod>>>() ?? parent.Get<Bindable<IEnumerable<Mod>>>()).GetBoundCopy(); Mods = (parent.Get<LeasedBindable<IEnumerable<Mod>>>() ?? parent.Get<Bindable<IEnumerable<Mod>>>()).GetBoundCopy();
} }
} }
} }

View File

@ -102,7 +102,7 @@ namespace osu.Game.Screens.Play
if (!ScoreProcessor.Mode.Disabled) if (!ScoreProcessor.Mode.Disabled)
config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode); config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode);
InternalChild = GameplayClockContainer = new GameplayClockContainer(working, SelectedMods.Value, DrawableRuleset.GameplayStartTime); InternalChild = GameplayClockContainer = new GameplayClockContainer(working, Mods.Value, DrawableRuleset.GameplayStartTime);
GameplayClockContainer.Children = new[] GameplayClockContainer.Children = new[]
{ {
@ -123,7 +123,7 @@ namespace osu.Game.Screens.Play
}, },
// display the cursor above some HUD elements. // display the cursor above some HUD elements.
DrawableRuleset.Cursor?.CreateProxy() ?? new Container(), DrawableRuleset.Cursor?.CreateProxy() ?? new Container(),
HUDOverlay = new HUDOverlay(ScoreProcessor, DrawableRuleset, SelectedMods.Value) HUDOverlay = new HUDOverlay(ScoreProcessor, DrawableRuleset, Mods.Value)
{ {
HoldToQuit = { Action = performUserRequestedExit }, HoldToQuit = { Action = performUserRequestedExit },
PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = GameplayClockContainer.UserPlaybackRate } } }, PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = GameplayClockContainer.UserPlaybackRate } } },
@ -170,7 +170,7 @@ namespace osu.Game.Screens.Play
ScoreProcessor.AllJudged += onCompletion; ScoreProcessor.AllJudged += onCompletion;
ScoreProcessor.Failed += onFail; ScoreProcessor.Failed += onFail;
foreach (var mod in SelectedMods.Value.OfType<IApplicableToScoreProcessor>()) foreach (var mod in Mods.Value.OfType<IApplicableToScoreProcessor>())
mod.ApplyToScoreProcessor(ScoreProcessor); mod.ApplyToScoreProcessor(ScoreProcessor);
} }
@ -192,7 +192,7 @@ namespace osu.Game.Screens.Play
try try
{ {
DrawableRuleset = rulesetInstance.CreateDrawableRulesetWith(working, SelectedMods.Value); DrawableRuleset = rulesetInstance.CreateDrawableRulesetWith(working, Mods.Value);
} }
catch (BeatmapInvalidForRulesetException) catch (BeatmapInvalidForRulesetException)
{ {
@ -200,7 +200,7 @@ namespace osu.Game.Screens.Play
// let's try again forcing the beatmap's ruleset. // let's try again forcing the beatmap's ruleset.
ruleset = beatmap.BeatmapInfo.Ruleset; ruleset = beatmap.BeatmapInfo.Ruleset;
rulesetInstance = ruleset.CreateInstance(); rulesetInstance = ruleset.CreateInstance();
DrawableRuleset = rulesetInstance.CreateDrawableRulesetWith(Beatmap.Value, SelectedMods.Value); DrawableRuleset = rulesetInstance.CreateDrawableRulesetWith(Beatmap.Value, Mods.Value);
} }
if (!DrawableRuleset.Objects.Any()) if (!DrawableRuleset.Objects.Any())
@ -271,7 +271,7 @@ namespace osu.Game.Screens.Play
{ {
Beatmap = Beatmap.Value.BeatmapInfo, Beatmap = Beatmap.Value.BeatmapInfo,
Ruleset = ruleset, Ruleset = ruleset,
Mods = SelectedMods.Value.ToArray(), Mods = Mods.Value.ToArray(),
User = api.LocalUser.Value, User = api.LocalUser.Value,
}; };
@ -325,7 +325,7 @@ namespace osu.Game.Screens.Play
private bool onFail() private bool onFail()
{ {
if (SelectedMods.Value.OfType<IApplicableFailOverride>().Any(m => !m.AllowFail)) if (Mods.Value.OfType<IApplicableFailOverride>().Any(m => !m.AllowFail))
return false; return false;
GameplayClockContainer.Stop(); GameplayClockContainer.Stop();

View File

@ -68,7 +68,7 @@ namespace osu.Game.Screens.Play
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
info = new BeatmapMetadataDisplay(Beatmap.Value, SelectedMods.Value) info = new BeatmapMetadataDisplay(Beatmap.Value, Mods.Value)
{ {
Alpha = 0, Alpha = 0,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,

View File

@ -42,7 +42,7 @@ namespace osu.Game.Screens.Select
RulesetID = Ruleset.Value.ID ?? 0 RulesetID = Ruleset.Value.ID ?? 0
}; };
item.RequiredMods.AddRange(SelectedMods.Value); item.RequiredMods.AddRange(Mods.Value);
Selected?.Invoke(item); Selected?.Invoke(item);
@ -61,12 +61,12 @@ namespace osu.Game.Screens.Select
{ {
Ruleset.Value = CurrentItem.Value.Ruleset; Ruleset.Value = CurrentItem.Value.Ruleset;
Beatmap.Value = beatmaps.GetWorkingBeatmap(CurrentItem.Value.Beatmap); Beatmap.Value = beatmaps.GetWorkingBeatmap(CurrentItem.Value.Beatmap);
SelectedMods.Value = CurrentItem.Value.RequiredMods ?? Enumerable.Empty<Mod>(); Mods.Value = CurrentItem.Value.RequiredMods ?? Enumerable.Empty<Mod>();
} }
Beatmap.Disabled = true; Beatmap.Disabled = true;
Ruleset.Disabled = true; Ruleset.Disabled = true;
SelectedMods.Disabled = true; Mods.Disabled = true;
return false; return false;
} }
@ -77,7 +77,7 @@ namespace osu.Game.Screens.Select
Beatmap.Disabled = false; Beatmap.Disabled = false;
Ruleset.Disabled = false; Ruleset.Disabled = false;
SelectedMods.Disabled = false; Mods.Disabled = false;
} }
} }
} }

View File

@ -52,10 +52,10 @@ namespace osu.Game.Screens.Select
var auto = Ruleset.Value.CreateInstance().GetAutoplayMod(); var auto = Ruleset.Value.CreateInstance().GetAutoplayMod();
var autoType = auto.GetType(); var autoType = auto.GetType();
var mods = SelectedMods.Value; var mods = Mods.Value;
if (mods.All(m => m.GetType() != autoType)) if (mods.All(m => m.GetType() != autoType))
{ {
SelectedMods.Value = mods.Append(auto); Mods.Value = mods.Append(auto);
removeAutoModOnResume = true; removeAutoModOnResume = true;
} }
} }

View File

@ -85,7 +85,7 @@ namespace osu.Game.Screens.Select
[Cached] [Cached]
[Cached(Type = typeof(IBindable<IEnumerable<Mod>>))] [Cached(Type = typeof(IBindable<IEnumerable<Mod>>))]
private readonly Bindable<IEnumerable<Mod>> selectedMods = new Bindable<IEnumerable<Mod>>(Enumerable.Empty<Mod>()); // Bound to the game's mods, but is not reset on exiting private readonly Bindable<IEnumerable<Mod>> mods = new Bindable<IEnumerable<Mod>>(Enumerable.Empty<Mod>()); // Bound to the game's mods, but is not reset on exiting
protected SongSelect() protected SongSelect()
{ {
@ -219,7 +219,7 @@ namespace osu.Game.Screens.Select
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins) private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins)
{ {
selectedMods.BindTo(SelectedMods); mods.BindTo(Mods);
if (Footer != null) if (Footer != null)
{ {
@ -394,7 +394,7 @@ namespace osu.Game.Screens.Select
{ {
Logger.Log($"ruleset changed from \"{decoupledRuleset.Value}\" to \"{ruleset}\""); Logger.Log($"ruleset changed from \"{decoupledRuleset.Value}\" to \"{ruleset}\"");
selectedMods.Value = Enumerable.Empty<Mod>(); mods.Value = Enumerable.Empty<Mod>();
decoupledRuleset.Value = ruleset; decoupledRuleset.Value = ruleset;
// force a filter before attempting to change the beatmap. // force a filter before attempting to change the beatmap.
@ -529,8 +529,8 @@ namespace osu.Game.Screens.Select
if (Beatmap.Value.Track != null) if (Beatmap.Value.Track != null)
Beatmap.Value.Track.Looping = false; Beatmap.Value.Track.Looping = false;
selectedMods.UnbindAll(); mods.UnbindAll();
SelectedMods.Value = Enumerable.Empty<Mod>(); Mods.Value = Enumerable.Empty<Mod>();
return false; return false;
} }

View File

@ -68,7 +68,7 @@ namespace osu.Game.Tests.Visual
var working = CreateWorkingBeatmap(beatmap, Clock); var working = CreateWorkingBeatmap(beatmap, Clock);
Beatmap.Value = working; Beatmap.Value = working;
SelectedMods.Value = new[] { r.GetAllMods().First(m => m is ModNoFail) }; Mods.Value = new[] { r.GetAllMods().First(m => m is ModNoFail) };
Player?.Exit(); Player?.Exit();
Player = null; Player = null;

View File

@ -29,7 +29,7 @@ namespace osu.Game.Tests.Visual
[Cached] [Cached]
[Cached(Type = typeof(IBindable<IEnumerable<Mod>>))] [Cached(Type = typeof(IBindable<IEnumerable<Mod>>))]
protected readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>(Enumerable.Empty<Mod>()); protected readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>(Enumerable.Empty<Mod>());
protected DependencyContainer Dependencies { get; private set; } protected DependencyContainer Dependencies { get; private set; }

View File

@ -55,7 +55,7 @@ namespace osu.Game.Tests.Visual
Beatmap.Value = new TestWorkingBeatmap(beatmap, Clock); Beatmap.Value = new TestWorkingBeatmap(beatmap, Clock);
if (!AllowFail) if (!AllowFail)
SelectedMods.Value = new[] { ruleset.GetAllMods().First(m => m is ModNoFail) }; Mods.Value = new[] { ruleset.GetAllMods().First(m => m is ModNoFail) };
Player = CreatePlayer(ruleset); Player = CreatePlayer(ruleset);
LoadScreen(Player); LoadScreen(Player);