1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:20:04 +08:00

Remove "multiplayer" references from subclass and move to appropriate place

This commit is contained in:
Salman Ahmed 2024-02-23 16:42:58 +03:00
parent ed028e8d26
commit ae9c58be30
2 changed files with 14 additions and 12 deletions

View File

@ -1,4 +1,4 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// 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;
@ -6,26 +6,28 @@ using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Rulesets;
using osu.Game.Online.Rooms;
using osu.Game.Overlays;
using osu.Game.Overlays.Mods;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Overlays.Mods
namespace osu.Game.Screens.OnlinePlay.Match
{
public partial class MultiplayerModSelectOverlay : UserModSelectOverlay
public partial class RoomModSelectOverlay : UserModSelectOverlay
{
public MultiplayerModSelectOverlay(OverlayColourScheme colourScheme = OverlayColourScheme.Plum)
public RoomModSelectOverlay(OverlayColourScheme colourScheme = OverlayColourScheme.Plum)
: base(colourScheme)
{
}
[Resolved(CanBeNull = true)]
private IBindable<PlaylistItem>? multiplayerRoomItem { get; set; }
private IBindable<PlaylistItem>? selectedItem { get; set; }
[Resolved]
private OsuGameBase game { get; set; } = null!;
protected override BeatmapAttributesDisplay GetBeatmapAttributesDisplay => new MultiplayerBeatmapAttributesDisplay
protected override BeatmapAttributesDisplay GetBeatmapAttributesDisplay => new RoomBeatmapAttributesDisplay
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
@ -35,7 +37,7 @@ namespace osu.Game.Overlays.Mods
protected override void LoadComplete()
{
base.LoadComplete();
multiplayerRoomItem?.BindValueChanged(_ => SelectedMods.TriggerChange());
selectedItem?.BindValueChanged(_ => SelectedMods.TriggerChange());
}
protected override IEnumerable<Mod> AllSelectedMods
@ -44,10 +46,10 @@ namespace osu.Game.Overlays.Mods
{
IEnumerable<Mod> allMods = SelectedMods.Value;
if (multiplayerRoomItem?.Value != null)
if (selectedItem?.Value != null)
{
Ruleset ruleset = game.Ruleset.Value.CreateInstance();
var multiplayerRoomMods = multiplayerRoomItem.Value.RequiredMods.Select(m => m.ToMod(ruleset));
var multiplayerRoomMods = selectedItem.Value.RequiredMods.Select(m => m.ToMod(ruleset));
allMods = allMods.Concat(multiplayerRoomMods);
}
@ -56,7 +58,7 @@ namespace osu.Game.Overlays.Mods
}
}
public partial class MultiplayerBeatmapAttributesDisplay : BeatmapAttributesDisplay
public partial class RoomBeatmapAttributesDisplay : BeatmapAttributesDisplay
{
[Resolved(CanBeNull = true)]
private IBindable<PlaylistItem>? multiplayerRoomItem { get; set; }

View File

@ -241,7 +241,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
}
};
LoadComponent(UserModsSelectOverlay = new MultiplayerModSelectOverlay
LoadComponent(UserModsSelectOverlay = new RoomModSelectOverlay
{
SelectedMods = { BindTarget = UserMods },
IsValidMod = _ => false