Set room host when the room is refreshed

This commit is contained in:
smoogipoo
2018-12-04 18:18:17 +09:00
parent a7ac544e12
commit c469d12d63
3 changed files with 20 additions and 7 deletions

View File

@ -3,6 +3,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.Multiplayer;
namespace osu.Game.Screens.Multi.Components namespace osu.Game.Screens.Multi.Components
{ {
@ -16,5 +17,17 @@ namespace osu.Game.Screens.Multi.Components
{ {
Room.Host.Value = api.LocalUser; Room.Host.Value = api.LocalUser;
} }
public override Room Room
{
get => base.Room;
set
{
base.Room = value;
if (api != null && value != null)
value.Host.Value = api.LocalUser;
}
}
} }
} }

View File

@ -163,7 +163,7 @@ namespace osu.Game.Screens.Multi.Components
/// <summary> /// <summary>
/// The room which settings are being applied to. /// The room which settings are being applied to.
/// </summary> /// </summary>
public Room Room public virtual Room Room
{ {
get => room; get => room;
set set

View File

@ -19,7 +19,7 @@ namespace osu.Game.Screens.Multi.Screens.Lounge
{ {
private readonly Container content; private readonly Container content;
private readonly SearchContainer search; private readonly SearchContainer search;
private readonly RoomSettingsOverlay settings; private readonly CreateRoomOverlay createRoomOverlay;
protected readonly FilterControl Filter; protected readonly FilterControl Filter;
protected readonly FillFlowContainer<DrawableRoom> RoomsContainer; protected readonly FillFlowContainer<DrawableRoom> RoomsContainer;
@ -71,7 +71,7 @@ namespace osu.Game.Screens.Multi.Screens.Lounge
new Container new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Child = settings = new CreateRoomOverlay Child = createRoomOverlay = new CreateRoomOverlay
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Height = 0.9f, Height = 0.9f,
@ -86,7 +86,7 @@ namespace osu.Game.Screens.Multi.Screens.Lounge
Filter.Tabs.Current.ValueChanged += t => filterRooms(); Filter.Tabs.Current.ValueChanged += t => filterRooms();
Filter.Search.Exit += Exit; Filter.Search.Exit += Exit;
settings.Applied = () => createRoom(settings.Room); createRoomOverlay.Applied = () => createRoom(createRoomOverlay.Room);
} }
protected override void UpdateAfterChildren() protected override void UpdateAfterChildren()
@ -147,7 +147,7 @@ namespace osu.Game.Screens.Multi.Screens.Lounge
{ {
base.OnResuming(last); base.OnResuming(last);
settings.Room = new Room(); createRoomOverlay.Room = new Room();
Filter.Search.HoldFocus = true; Filter.Search.HoldFocus = true;
} }
@ -161,9 +161,9 @@ namespace osu.Game.Screens.Multi.Screens.Lounge
private void filterRooms() private void filterRooms()
{ {
if (Filter.Tabs.Current.Value == LoungeTab.Create) if (Filter.Tabs.Current.Value == LoungeTab.Create)
settings.Show(); createRoomOverlay.Show();
else else
settings.Hide(); createRoomOverlay.Hide();
search.SearchTerm = Filter.Search.Current.Value ?? string.Empty; search.SearchTerm = Filter.Search.Current.Value ?? string.Empty;