1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 02:02:53 +08:00

Lease selected room while in match screen to avoid lounge potentially changing it

This commit is contained in:
Dean Herbert 2021-08-12 14:56:58 +09:00
parent 054e0e8eed
commit 4d6101f4e5
2 changed files with 15 additions and 2 deletions

View File

@ -137,7 +137,9 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
roomFlow.Remove(toRemove);
selectedRoom.Value = null;
// selection may have a lease due to being in a sub screen.
if (!selectedRoom.Disabled)
selectedRoom.Value = null;
}
}

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Diagnostics;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Allocation;
@ -49,6 +50,9 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
private RoomsContainer roomsContainer;
[CanBeNull]
private LeasedBindable<Room> selectionLease;
[BackgroundDependencyLoader]
private void load()
{
@ -144,6 +148,11 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
{
base.OnResuming(last);
Debug.Assert(selectionLease != null);
selectionLease.Return();
selectionLease = null;
if (selectedRoom.Value?.RoomID.Value == null)
selectedRoom.Value = new Room();
@ -210,7 +219,9 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
protected virtual void OpenNewRoom(Room room)
{
selectedRoom.Value = room;
selectionLease = selectedRoom.BeginLease(false);
Debug.Assert(selectionLease != null);
selectionLease.Value = room;
this.Push(CreateRoomSubScreen(room));
}