mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 17:52:56 +08:00
Simplify by reusing same room panel
This commit is contained in:
parent
704af94d39
commit
c5268c9a99
@ -12,9 +12,9 @@ using osu.Game.Screens.OnlinePlay.Match.Components;
|
||||
using osu.Game.Users;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
||||
namespace osu.Game.Screens.OnlinePlay.Match
|
||||
{
|
||||
public class DrawableMultiplayerRoom : DrawableRoom
|
||||
public class DrawableMatchRoom : DrawableRoom
|
||||
{
|
||||
public Action OnEdit;
|
||||
|
||||
@ -25,7 +25,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
||||
|
||||
private Drawable editButton;
|
||||
|
||||
public DrawableMultiplayerRoom(Room room)
|
||||
public DrawableMatchRoom(Room room)
|
||||
: base(room)
|
||||
{
|
||||
host.BindTo(room.Host);
|
@ -19,7 +19,6 @@ using osu.Game.Online.Rooms;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Mods;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Screens.OnlinePlay.Lounge.Components;
|
||||
using osu.Game.Screens.OnlinePlay.Match.Components;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Match
|
||||
@ -64,7 +63,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
private readonly Room room;
|
||||
|
||||
private ModSelectOverlay userModsSelectOverlay;
|
||||
protected RoomSettingsOverlay SettingsOverlay { get; private set; }
|
||||
private RoomSettingsOverlay settingsOverlay;
|
||||
|
||||
protected RoomSubScreen(Room room)
|
||||
{
|
||||
@ -123,7 +122,11 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
CreateDrawableRoom(room).With(d => d.MatchingFilter = true),
|
||||
new DrawableMatchRoom(room)
|
||||
{
|
||||
MatchingFilter = true,
|
||||
OnEdit = () => settingsOverlay.Show()
|
||||
}
|
||||
},
|
||||
null,
|
||||
new Drawable[]
|
||||
@ -162,7 +165,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
}
|
||||
}
|
||||
},
|
||||
SettingsOverlay = CreateRoomSettingsOverlay().With(s =>
|
||||
settingsOverlay = CreateRoomSettingsOverlay().With(s =>
|
||||
{
|
||||
s.State.Value = room.RoomID.Value == null ? Visibility.Visible : Visibility.Hidden;
|
||||
})
|
||||
@ -184,7 +187,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
// The main content should be hidden until the settings overlay is hidden, signaling the room is ready to be displayed.
|
||||
mainContent.Hide();
|
||||
|
||||
SettingsOverlay.State.BindValueChanged(visibility =>
|
||||
settingsOverlay.State.BindValueChanged(visibility =>
|
||||
{
|
||||
if (visibility.NewValue == Visibility.Hidden)
|
||||
mainContent.Show();
|
||||
@ -218,9 +221,9 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
return true;
|
||||
}
|
||||
|
||||
if (SettingsOverlay.State.Value == Visibility.Visible)
|
||||
if (settingsOverlay.State.Value == Visibility.Visible)
|
||||
{
|
||||
SettingsOverlay.Hide();
|
||||
settingsOverlay.Hide();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -358,8 +361,6 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
track.Looping = false;
|
||||
}
|
||||
|
||||
protected abstract DrawableRoom CreateDrawableRoom(Room room);
|
||||
|
||||
protected abstract Drawable CreateMainContent();
|
||||
|
||||
protected abstract Drawable CreateFooter();
|
||||
|
@ -22,7 +22,6 @@ using osu.Game.Overlays.Dialog;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Screens.OnlinePlay.Components;
|
||||
using osu.Game.Screens.OnlinePlay.Lounge.Components;
|
||||
using osu.Game.Screens.OnlinePlay.Match;
|
||||
using osu.Game.Screens.OnlinePlay.Match.Components;
|
||||
using osu.Game.Screens.OnlinePlay.Multiplayer.Match;
|
||||
@ -110,11 +109,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
Mods.Value = client.LocalUser.Mods.Select(m => m.ToMod(ruleset)).Concat(SelectedItem.Value.RequiredMods).ToList();
|
||||
}
|
||||
|
||||
protected override DrawableRoom CreateDrawableRoom(Room room) => new DrawableMultiplayerRoom(room)
|
||||
{
|
||||
OnEdit = () => SettingsOverlay.Show()
|
||||
};
|
||||
|
||||
protected override Drawable CreateMainContent() => new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
@ -14,7 +14,6 @@ using osu.Game.Input;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Screens.OnlinePlay.Components;
|
||||
using osu.Game.Screens.OnlinePlay.Lounge.Components;
|
||||
using osu.Game.Screens.OnlinePlay.Match;
|
||||
using osu.Game.Screens.OnlinePlay.Match.Components;
|
||||
using osu.Game.Screens.Play;
|
||||
@ -298,8 +297,6 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||
Exited = () => leaderboard.RefreshScores()
|
||||
});
|
||||
|
||||
protected override DrawableRoom CreateDrawableRoom(Room room) => new DrawableRoom(room);
|
||||
|
||||
protected override Drawable CreateMainContent() => Empty();
|
||||
|
||||
protected override Drawable CreateFooter() => Empty();
|
||||
|
Loading…
Reference in New Issue
Block a user