Fix multiplayer mod select showing autoplay as a choice

This commit is contained in:
Dean Herbert 2021-01-18 17:50:32 +09:00
parent 30f3e72c42
commit 0b165dce4b
4 changed files with 14 additions and 7 deletions

View File

@ -327,6 +327,7 @@ namespace osu.Game
if (!SelectedMods.Disabled)
SelectedMods.Value = Array.Empty<Mod>();
AvailableMods.Value = dict;
}

View File

@ -30,6 +30,7 @@ namespace osu.Game.Overlays.Mods
{
public class ModSelectOverlay : WaveOverlayContainer
{
private readonly Func<Mod, bool> isValidMod;
public const float HEIGHT = 510;
protected readonly TriangleButton DeselectAllButton;
@ -60,8 +61,10 @@ namespace osu.Game.Overlays.Mods
private SampleChannel sampleOn, sampleOff;
public ModSelectOverlay()
public ModSelectOverlay(Func<Mod, bool> isValidMod = null)
{
this.isValidMod = isValidMod ?? (m => true);
Waves.FirstWaveColour = Color4Extensions.FromHex(@"19b0e2");
Waves.SecondWaveColour = Color4Extensions.FromHex(@"2280a2");
Waves.ThirdWaveColour = Color4Extensions.FromHex(@"005774");
@ -403,7 +406,7 @@ namespace osu.Game.Overlays.Mods
if (mods.NewValue == null) return;
foreach (var section in ModSectionsContainer.Children)
section.Mods = mods.NewValue[section.ModType];
section.Mods = mods.NewValue[section.ModType].Where(isValidMod);
}
private void selectedModsChanged(ValueChangedEvent<IReadOnlyList<Mod>> mods)

View File

@ -13,6 +13,7 @@ using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Rooms;
using osu.Game.Overlays.Mods;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Select;
@ -109,5 +110,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
}
protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea();
protected override ModSelectOverlay CreateModSelectOverlay() => new ModSelectOverlay(isValidMod);
private bool isValidMod(Mod mod) => !(mod is ModAutoplay) && (mod as MultiMod)?.Mods.Any(mm => mm is ModAutoplay) != true;
}
}

View File

@ -251,11 +251,7 @@ namespace osu.Game.Screens.Select
Children = new Drawable[]
{
BeatmapOptions = new BeatmapOptionsOverlay(),
ModSelect = new ModSelectOverlay
{
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre,
}
ModSelect = CreateModSelectOverlay()
}
}
}
@ -305,6 +301,8 @@ namespace osu.Game.Screens.Select
}
}
protected virtual ModSelectOverlay CreateModSelectOverlay() => new ModSelectOverlay();
protected virtual void ApplyFilterToCarousel(FilterCriteria criteria)
{
// if not the current screen, we want to get carousel in a good presentation state before displaying (resume or enter).