mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Remove mods from workingbeatmap
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
// 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 System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Screens
|
||||
{
|
||||
@ -14,6 +16,8 @@ namespace osu.Game.Screens
|
||||
|
||||
public Bindable<RulesetInfo> Ruleset { get; }
|
||||
|
||||
public Bindable<IEnumerable<Mod>> SelectedMods { get; }
|
||||
|
||||
public OsuScreenDependencies(bool requireLease, IReadOnlyDependencyContainer parent)
|
||||
: base(parent)
|
||||
{
|
||||
@ -21,20 +25,21 @@ namespace osu.Game.Screens
|
||||
{
|
||||
Beatmap = parent.Get<LeasedBindable<WorkingBeatmap>>()?.GetBoundCopy();
|
||||
if (Beatmap == null)
|
||||
{
|
||||
Cache(Beatmap = parent.Get<Bindable<WorkingBeatmap>>().BeginLease(false));
|
||||
}
|
||||
|
||||
Ruleset = parent.Get<LeasedBindable<RulesetInfo>>()?.GetBoundCopy();
|
||||
if (Ruleset == null)
|
||||
{
|
||||
Cache(Ruleset = parent.Get<Bindable<RulesetInfo>>().BeginLease(true));
|
||||
}
|
||||
|
||||
SelectedMods = parent.Get<LeasedBindable<IEnumerable<Mod>>>()?.GetBoundCopy();
|
||||
if (SelectedMods == null)
|
||||
Cache(SelectedMods = parent.Get<Bindable<IEnumerable<Mod>>>().BeginLease(true));
|
||||
}
|
||||
else
|
||||
{
|
||||
Beatmap = (parent.Get<LeasedBindable<WorkingBeatmap>>() ?? parent.Get<Bindable<WorkingBeatmap>>()).GetBoundCopy();
|
||||
Ruleset = (parent.Get<LeasedBindable<RulesetInfo>>() ?? parent.Get<Bindable<RulesetInfo>>()).GetBoundCopy();
|
||||
SelectedMods = (parent.Get<LeasedBindable<IEnumerable<Mod>>>() ?? parent.Get<Bindable<IEnumerable<Mod>>>()).GetBoundCopy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user