mirror of
https://github.com/ppy/osu.git
synced 2025-02-06 23:12:54 +08:00
Minimal clean-up to get things bearable
I plan to do a full refactor of `RoomSubScreen` at first opportunity.
This commit is contained in:
parent
e8d0d2a1d9
commit
bc930e8fd3
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
@ -49,18 +50,18 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
/// A container that provides controls for selection of user mods.
|
||||
/// This will be shown/hidden automatically when applicable.
|
||||
/// </summary>
|
||||
protected Drawable? UserModsSection;
|
||||
protected Drawable UserModsSection = null!;
|
||||
|
||||
/// <summary>
|
||||
/// A container that provides controls for selection of the user style.
|
||||
/// This will be shown/hidden automatically when applicable.
|
||||
/// </summary>
|
||||
protected Drawable? UserStyleSection;
|
||||
protected Drawable UserStyleSection = null!;
|
||||
|
||||
/// <summary>
|
||||
/// A container that will display the user's style.
|
||||
/// </summary>
|
||||
protected Container<DrawableRoomPlaylistItem>? UserStyleDisplayContainer;
|
||||
protected Container<DrawableRoomPlaylistItem> UserStyleDisplayContainer = null!;
|
||||
|
||||
private Sample? sampleStart;
|
||||
|
||||
@ -448,24 +449,29 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
Mods.Value = GetGameplayMods().Select(m => m.ToMod(rulesetInstance)).ToArray();
|
||||
Ruleset.Value = GetGameplayRuleset();
|
||||
|
||||
if (!item.AllowedMods.Any())
|
||||
bool freeMod = item.AllowedMods.Any();
|
||||
bool freeStyle = item.FreeStyle;
|
||||
|
||||
// For now, the game can never be in a state where freemod and freestyle are on at the same time.
|
||||
// This will change, but due to the current implementation if this was to occur drawables will overlap so let's assert.
|
||||
Debug.Assert(!freeMod || !freeStyle);
|
||||
|
||||
if (freeMod)
|
||||
{
|
||||
UserModsSection?.Hide();
|
||||
UserModsSelectOverlay.Hide();
|
||||
UserModsSelectOverlay.IsValidMod = _ => false;
|
||||
UserModsSection.Show();
|
||||
UserModsSelectOverlay.IsValidMod = m => allowedMods.Any(a => a.GetType() == m.GetType());
|
||||
}
|
||||
else
|
||||
{
|
||||
UserModsSection?.Show();
|
||||
UserModsSelectOverlay.IsValidMod = m => allowedMods.Any(a => a.GetType() == m.GetType());
|
||||
UserModsSection.Hide();
|
||||
UserModsSelectOverlay.Hide();
|
||||
UserModsSelectOverlay.IsValidMod = _ => false;
|
||||
}
|
||||
|
||||
if (item.FreeStyle)
|
||||
if (freeStyle)
|
||||
{
|
||||
UserStyleSection?.Show();
|
||||
UserStyleSection.Show();
|
||||
|
||||
if (UserStyleDisplayContainer != null)
|
||||
{
|
||||
PlaylistItem gameplayItem = SelectedItem.Value.With(ruleset: GetGameplayRuleset().OnlineID, beatmap: new Optional<IBeatmapInfo>(GetGameplayBeatmap()));
|
||||
PlaylistItem? currentItem = UserStyleDisplayContainer.SingleOrDefault()?.Item;
|
||||
|
||||
@ -475,13 +481,12 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
UserStyleDisplayContainer.Child = new DrawableRoomPlaylistItem(gameplayItem, true)
|
||||
{
|
||||
AllowReordering = false,
|
||||
AllowEditing = item.FreeStyle,
|
||||
AllowEditing = freeStyle,
|
||||
RequestEdit = _ => OpenStyleSelection()
|
||||
};
|
||||
}
|
||||
}
|
||||
else
|
||||
UserStyleSection?.Hide();
|
||||
UserStyleSection.Hide();
|
||||
});
|
||||
|
||||
protected virtual APIMod[] GetGameplayMods() => UserMods.Value.Select(m => new APIMod(m)).Concat(SelectedItem.Value!.RequiredMods).ToArray();
|
||||
|
Loading…
Reference in New Issue
Block a user