Use CMC for all of multiplayer

This commit is contained in:
smoogipoo
2019-02-05 19:00:01 +09:00
parent be51ee4ed5
commit aac371ba6e
38 changed files with 652 additions and 768 deletions

View File

@ -2,6 +2,8 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
@ -24,13 +26,12 @@ namespace osu.Game.Screens.Multi.Lounge
private readonly Action<Screen> pushGameplayScreen;
private readonly ProcessingOverlay processingOverlay;
private readonly Bindable<Room> currentRoom = new Bindable<Room>();
public LoungeSubScreen(Action<Screen> pushGameplayScreen)
{
this.pushGameplayScreen = pushGameplayScreen;
RoomInspector inspector;
RoomsContainer rooms;
InternalChildren = new Drawable[]
{
Filter = new FilterControl { Depth = -1 },
@ -54,13 +55,13 @@ namespace osu.Game.Screens.Multi.Lounge
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Child = rooms = new RoomsContainer { JoinRequested = joinRequested }
Child = new RoomsContainer { JoinRequested = joinRequested }
},
},
processingOverlay = new ProcessingOverlay { Alpha = 0 }
}
},
inspector = new RoomInspector
new RoomInspector
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
@ -71,11 +72,15 @@ namespace osu.Game.Screens.Multi.Lounge
},
};
inspector.Room.BindTo(rooms.SelectedRoom);
Filter.Search.Exit += this.Exit;
}
[BackgroundDependencyLoader]
private void load(IRoomManager roomManager)
{
currentRoom.BindTo(roomManager.CurrentRoom);
}
protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();
@ -116,7 +121,7 @@ namespace osu.Game.Screens.Multi.Lounge
processingOverlay.Show();
Manager?.JoinRoom(room, r =>
{
Push(room);
Open(room);
processingOverlay.Hide();
}, _ => processingOverlay.Hide());
}
@ -124,13 +129,15 @@ namespace osu.Game.Screens.Multi.Lounge
/// <summary>
/// Push a room as a new subscreen.
/// </summary>
public void Push(Room room)
public void Open(Room room)
{
// Handles the case where a room is clicked 3 times in quick succession
if (!this.IsCurrentScreen())
return;
this.Push(new MatchSubScreen(room, s => pushGameplayScreen?.Invoke(s)));
currentRoom.Value = room;
this.Push(new MatchSubScreen(s => pushGameplayScreen?.Invoke(s)));
}
}
}