From 59f7c5a26e466d06070610ff0dfd14740e0914dd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 17 Jan 2019 18:44:22 +0900 Subject: [PATCH] Fix room inspector cover not resetting when no room selected --- .../Lounge/Components/ParticipantInfo.cs | 10 +++++-- osu.Game/Screens/Multi/RoomBindings.cs | 29 +++++++++---------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs b/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs index 34fc7fe886..228bacf3f3 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs @@ -93,10 +93,14 @@ namespace osu.Game.Screens.Multi.Lounge.Components Host.BindValueChanged(v => { hostText.Clear(); - hostText.AddText("hosted by "); - hostText.AddLink(v.Username, null, LinkAction.OpenUserProfile, v.Id.ToString(), "Open profile", s => s.Font = "Exo2.0-BoldItalic"); + flagContainer.Clear(); - flagContainer.Child = new DrawableFlag(v.Country) { RelativeSizeAxes = Axes.Both }; + if (v != null) + { + hostText.AddText("hosted by "); + hostText.AddLink(v.Username, null, LinkAction.OpenUserProfile, v.Id.ToString(), "Open profile", s => s.Font = "Exo2.0-BoldItalic"); + flagContainer.Child = new DrawableFlag(v.Country) { RelativeSizeAxes = Axes.Both }; + } }); ParticipantCount.BindValueChanged(v => summary.Text = $"{v:#,0}{" participant".Pluralize(v == 1)}"); diff --git a/osu.Game/Screens/Multi/RoomBindings.cs b/osu.Game/Screens/Multi/RoomBindings.cs index 30e2918b69..e7f9e323bc 100644 --- a/osu.Game/Screens/Multi/RoomBindings.cs +++ b/osu.Game/Screens/Multi/RoomBindings.cs @@ -53,23 +53,20 @@ namespace osu.Game.Screens.Multi Duration.UnbindFrom(room.Duration); } - room = value; + room = value ?? new Room(); - if (room != null) - { - RoomID.BindTo(room.RoomID); - Name.BindTo(room.Name); - Host.BindTo(room.Host); - Status.BindTo(room.Status); - Type.BindTo(room.Type); - Playlist.BindTo(room.Playlist); - Participants.BindTo(room.Participants); - ParticipantCount.BindTo(room.ParticipantCount); - MaxParticipants.BindTo(room.MaxParticipants); - EndDate.BindTo(room.EndDate); - Availability.BindTo(room.Availability); - Duration.BindTo(room.Duration); - } + RoomID.BindTo(room.RoomID); + Name.BindTo(room.Name); + Host.BindTo(room.Host); + Status.BindTo(room.Status); + Type.BindTo(room.Type); + Playlist.BindTo(room.Playlist); + Participants.BindTo(room.Participants); + ParticipantCount.BindTo(room.ParticipantCount); + MaxParticipants.BindTo(room.MaxParticipants); + EndDate.BindTo(room.EndDate); + Availability.BindTo(room.Availability); + Duration.BindTo(room.Duration); } }