mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 21:02:55 +08:00
Fix playlist issues with room creation
This commit is contained in:
parent
42cd55e0d7
commit
43240ea85e
@ -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,6 +26,9 @@ namespace osu.Game.Screens.Multi.Lounge
|
||||
private readonly Action<Screen> pushGameplayScreen;
|
||||
private readonly ProcessingOverlay processingOverlay;
|
||||
|
||||
[Resolved]
|
||||
private Bindable<Room> currentRoom { get; set; }
|
||||
|
||||
public LoungeSubScreen(Action<Screen> pushGameplayScreen)
|
||||
{
|
||||
this.pushGameplayScreen = pushGameplayScreen;
|
||||
@ -125,6 +130,8 @@ namespace osu.Game.Screens.Multi.Lounge
|
||||
if (!this.IsCurrentScreen())
|
||||
return;
|
||||
|
||||
currentRoom.Value = room;
|
||||
|
||||
this.Push(new MatchSubScreen(room, s => pushGameplayScreen?.Invoke(s)));
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using Humanizer;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -65,6 +66,9 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
[Resolved(CanBeNull = true)]
|
||||
private IRoomManager manager { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private Bindable<Room> currentRoom { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
@ -293,7 +297,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
|
||||
Duration.Value = DurationField.Current.Value;
|
||||
|
||||
manager?.CreateRoom(Room, onSuccess, onError);
|
||||
manager?.CreateRoom(currentRoom, onSuccess, onError);
|
||||
|
||||
processingOverlay.Show();
|
||||
}
|
||||
|
@ -17,9 +17,6 @@ namespace osu.Game.Screens.Multi
|
||||
{
|
||||
public class MultiplayerComposite : CompositeDrawable
|
||||
{
|
||||
[Resolved]
|
||||
protected Room Room { get; private set; }
|
||||
|
||||
[Resolved(typeof(Room))]
|
||||
protected Bindable<int?> RoomID { get; private set; }
|
||||
|
||||
|
@ -61,20 +61,17 @@ namespace osu.Game.Screens.Multi
|
||||
{
|
||||
room.Host.Value = api.LocalUser;
|
||||
|
||||
addRoom(room);
|
||||
joinRoom(room);
|
||||
|
||||
RoomsUpdated?.Invoke();
|
||||
|
||||
onSuccess?.Invoke(room);
|
||||
|
||||
return;
|
||||
|
||||
var req = new CreateRoomRequest(room);
|
||||
|
||||
req.Success += result =>
|
||||
{
|
||||
joinedRoom = room;
|
||||
|
||||
update(room, result);
|
||||
addRoom(room);
|
||||
|
||||
RoomsUpdated?.Invoke();
|
||||
onSuccess?.Invoke(room);
|
||||
};
|
||||
|
||||
req.Failure += exception =>
|
||||
@ -98,7 +95,7 @@ namespace osu.Game.Screens.Multi
|
||||
currentJoinRoomRequest = new JoinRoomRequest(room, api.LocalUser.Value);
|
||||
currentJoinRoomRequest.Success += () =>
|
||||
{
|
||||
joinRoom(room);
|
||||
joinedRoom = room;
|
||||
onSuccess?.Invoke(room);
|
||||
};
|
||||
|
||||
@ -111,12 +108,6 @@ namespace osu.Game.Screens.Multi
|
||||
api.Queue(currentJoinRoomRequest);
|
||||
}
|
||||
|
||||
private void joinRoom(Room room)
|
||||
{
|
||||
currentRoom.Value = room;
|
||||
joinedRoom = room;
|
||||
}
|
||||
|
||||
public void PartRoom()
|
||||
{
|
||||
if (joinedRoom == null)
|
||||
|
Loading…
Reference in New Issue
Block a user