mirror of
https://github.com/ppy/osu
synced 2025-01-03 12:52:10 +00:00
Fix mods not correctly resetting when changing ruleset at song select
This commit is contained in:
parent
b02603000e
commit
e28a610757
@ -4,6 +4,7 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Rulesets.Configuration;
|
||||
using osu.Game.Rulesets.Mania.Configuration;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
|
||||
@ -19,14 +20,14 @@ namespace osu.Game.Rulesets.Mania
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ManiaConfigManager config)
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SettingsEnumDropdown<ManiaScrollingDirection>
|
||||
{
|
||||
LabelText = "Scrolling direction",
|
||||
Bindable = config.GetBindable<ManiaScrollingDirection>(ManiaSetting.ScrollDirection)
|
||||
Bindable = (Config as RulesetConfigManager<ManiaSetting>)?.GetBindable<ManiaScrollingDirection>(ManiaSetting.ScrollDirection)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -44,6 +44,8 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
private void rulesetChanged(RulesetInfo newRuleset)
|
||||
{
|
||||
if (newRuleset == null) return;
|
||||
|
||||
var instance = newRuleset.CreateInstance();
|
||||
|
||||
foreach (ModSection section in ModSectionsContainer.Children)
|
||||
@ -173,7 +175,10 @@ namespace osu.Game.Overlays.Mods
|
||||
refreshSelectedMods();
|
||||
}
|
||||
|
||||
private void refreshSelectedMods() => SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray();
|
||||
private void refreshSelectedMods()
|
||||
{
|
||||
SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray();
|
||||
}
|
||||
|
||||
public ModSelectOverlay()
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Configuration;
|
||||
|
||||
namespace osu.Game.Overlays.Settings
|
||||
{
|
||||
@ -14,6 +15,8 @@ namespace osu.Game.Overlays.Settings
|
||||
{
|
||||
private readonly Ruleset ruleset;
|
||||
|
||||
protected IRulesetConfigManager Config;
|
||||
|
||||
protected RulesetSettingsSubsection(Ruleset ruleset)
|
||||
{
|
||||
this.ruleset = ruleset;
|
||||
@ -25,9 +28,9 @@ namespace osu.Game.Overlays.Settings
|
||||
{
|
||||
dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||
|
||||
var config = dependencies.Get<RulesetConfigCache>().GetConfigFor(ruleset);
|
||||
if (config != null)
|
||||
dependencies.Cache(config);
|
||||
Config = dependencies.Get<RulesetConfigCache>().GetConfigFor(ruleset);
|
||||
if (Config != null)
|
||||
dependencies.Cache(Config);
|
||||
|
||||
return dependencies;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ using osu.Game.Rulesets.UI;
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public class ModAutoplay<T> : ModAutoplay, IApplicableToRulesetContainer<T>
|
||||
public abstract class ModAutoplay<T> : ModAutoplay, IApplicableToRulesetContainer<T>
|
||||
where T : HitObject
|
||||
{
|
||||
protected virtual Score CreateReplayScore(Beatmap<T> beatmap) => new Score { Replay = new Replay() };
|
||||
|
@ -84,10 +84,10 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
protected override void UpdateBeatmap(WorkingBeatmap beatmap)
|
||||
{
|
||||
base.UpdateBeatmap(beatmap);
|
||||
|
||||
beatmap.Mods.BindTo(SelectedMods);
|
||||
|
||||
base.UpdateBeatmap(beatmap);
|
||||
|
||||
BeatmapDetails.Beatmap = beatmap;
|
||||
|
||||
if (beatmap.Track != null)
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
@ -19,6 +20,7 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Menu;
|
||||
@ -67,8 +69,17 @@ namespace osu.Game.Screens.Select
|
||||
protected new readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
||||
=> dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||
{
|
||||
dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||
|
||||
dependencies.CacheAs(this);
|
||||
dependencies.CacheAs(Ruleset);
|
||||
dependencies.CacheAs<IBindable<RulesetInfo>>(Ruleset);
|
||||
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
protected SongSelect()
|
||||
{
|
||||
@ -183,11 +194,9 @@ namespace osu.Game.Screens.Select
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours)
|
||||
{
|
||||
dependencies.CacheAs(this);
|
||||
dependencies.CacheAs(Ruleset);
|
||||
dependencies.CacheAs<IBindable<RulesetInfo>>(Ruleset);
|
||||
|
||||
// manual binding to parent ruleset to allow for delayed load in the incoming direction.
|
||||
base.Ruleset.ValueChanged += r => updateSelectedBeatmap(beatmapNoDebounce);
|
||||
Ruleset.ValueChanged += r => base.Ruleset.Value = r;
|
||||
|
||||
if (Footer != null)
|
||||
{
|
||||
@ -263,7 +272,7 @@ namespace osu.Game.Screens.Select
|
||||
// If selecting new beatmap without bypassing filters failed, there's possibly a ruleset mismatch
|
||||
if (beatmap?.BeatmapInfo?.Ruleset != null && beatmap.BeatmapInfo.Ruleset != Ruleset.Value)
|
||||
{
|
||||
Ruleset.Value = beatmap.BeatmapInfo.Ruleset;
|
||||
base.Ruleset.Value = beatmap.BeatmapInfo.Ruleset;
|
||||
Carousel.SelectBeatmap(beatmap.BeatmapInfo);
|
||||
}
|
||||
}
|
||||
@ -281,16 +290,22 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
void performLoad()
|
||||
{
|
||||
WorkingBeatmap working = Beatmap.Value;
|
||||
bool preview = false;
|
||||
|
||||
// We may be arriving here due to another component changing the bindable Beatmap.
|
||||
// In these cases, the other component has already loaded the beatmap, so we don't need to do so again.
|
||||
if (beatmap?.Equals(Beatmap.Value.BeatmapInfo) != true)
|
||||
{
|
||||
bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID;
|
||||
|
||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
|
||||
ensurePlayingSelected(preview);
|
||||
preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID;
|
||||
working = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
|
||||
}
|
||||
|
||||
ensurePlayingSelected(preview);
|
||||
|
||||
working.Mods.Value = Enumerable.Empty<Mod>();
|
||||
|
||||
Beatmap.Value = working;
|
||||
Ruleset.Value = ruleset;
|
||||
|
||||
UpdateBeatmap(Beatmap.Value);
|
||||
@ -464,7 +479,8 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private void carouselBeatmapsLoaded()
|
||||
{
|
||||
if (!Beatmap.IsDefault && Beatmap.Value.BeatmapSetInfo?.DeletePending == false && Beatmap.Value.BeatmapSetInfo?.Protected == false && Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false))
|
||||
if (!Beatmap.IsDefault && Beatmap.Value.BeatmapSetInfo?.DeletePending == false && Beatmap.Value.BeatmapSetInfo?.Protected == false
|
||||
&& Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false))
|
||||
return;
|
||||
|
||||
if (Carousel.SelectedBeatmapSet == null && !Carousel.SelectNextRandom())
|
||||
|
@ -18,7 +18,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2018.629.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="0.0.6193" />
|
||||
<PackageReference Include="SharpCompress" Version="0.17.1" />
|
||||
<PackageReference Include="NUnit" Version="3.10.1" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user