Use new free mod select design in room creation flow

This commit is contained in:
Bartłomiej Dach 2022-05-04 22:25:13 +02:00
parent ac08498f35
commit 4eefbd5bc2
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
2 changed files with 16 additions and 5 deletions

View File

@ -46,7 +46,6 @@ namespace osu.Game.Screens.OnlinePlay
protected readonly Bindable<IReadOnlyList<Mod>> FreeMods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
private readonly FreeModSelectOverlay freeModSelectOverlay;
private readonly Room room;
private WorkingBeatmap initialBeatmap;
@ -54,13 +53,16 @@ namespace osu.Game.Screens.OnlinePlay
private IReadOnlyList<Mod> initialMods;
private bool itemSelected;
private FreeModSelectScreen freeModSelectOverlay;
private IDisposable freeModSelectOverlayRegistration;
protected OnlinePlaySongSelect(Room room)
{
this.room = room;
Padding = new MarginPadding { Horizontal = HORIZONTAL_OVERFLOW_PADDING };
freeModSelectOverlay = new FreeModSelectOverlay
freeModSelectOverlay = new FreeModSelectScreen
{
SelectedMods = { BindTarget = FreeMods },
IsValidMod = IsValidFreeMod,
@ -76,7 +78,7 @@ namespace osu.Game.Screens.OnlinePlay
initialRuleset = Ruleset.Value;
initialMods = Mods.Value.ToList();
FooterPanels.Add(freeModSelectOverlay);
LoadComponent(freeModSelectOverlay);
}
protected override void LoadComplete()
@ -95,6 +97,8 @@ namespace osu.Game.Screens.OnlinePlay
Mods.BindValueChanged(onModsChanged);
Ruleset.BindValueChanged(onRulesetChanged);
freeModSelectOverlayRegistration = Game?.RegisterBlockingOverlay(freeModSelectOverlay);
}
private void onModsChanged(ValueChangedEvent<IReadOnlyList<Mod>> mods)
@ -183,5 +187,12 @@ namespace osu.Game.Screens.OnlinePlay
private bool checkCompatibleFreeMod(Mod mod)
=> Mods.Value.All(m => m.Acronym != mod.Acronym) // Mod must not be contained in the required mods.
&& ModUtils.CheckCompatibleSet(Mods.Value.Append(mod).ToArray()); // Mod must be compatible with all the required mods.
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
freeModSelectOverlayRegistration?.Dispose();
}
}
}

View File

@ -124,7 +124,7 @@ namespace osu.Game.Screens.Select
private MusicController music { get; set; }
[Resolved(CanBeNull = true)]
private OsuGame game { get; set; }
protected new OsuGame Game { get; private set; }
[BackgroundDependencyLoader(true)]
private void load(AudioManager audio, IDialogOverlay dialog, OsuColour colours, ManageCollectionsDialog manageCollectionsDialog, DifficultyRecommender recommender)
@ -315,7 +315,7 @@ namespace osu.Game.Screens.Select
{
base.LoadComplete();
modSelectOverlayRegistration = game?.RegisterBlockingOverlay(ModSelect);
modSelectOverlayRegistration = Game?.RegisterBlockingOverlay(ModSelect);
}
/// <summary>