diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index 20e65323f8..2c43876fb2 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -200,7 +200,7 @@ namespace osu.Game.Graphics /// public Color4 ForRoomStatus(Room room) { - if (DateTimeOffset.Now >= room.EndDate) + if (room.HasEnded) return YellowDarker; switch (room.Status) diff --git a/osu.Game/Online/Rooms/Room.cs b/osu.Game/Online/Rooms/Room.cs index 6e073bdcd7..897ba6bd70 100644 --- a/osu.Game/Online/Rooms/Room.cs +++ b/osu.Game/Online/Rooms/Room.cs @@ -374,6 +374,15 @@ namespace osu.Game.Online.Rooms RecentParticipants = other.RecentParticipants; } + /// + /// Whether the room is no longer available. + /// + /// + /// This property does not update in real-time and needs to be queried periodically. + /// Subscribe to to be notified of any immediate changes. + /// + public bool HasEnded => DateTimeOffset.Now >= EndDate; + [JsonObject(MemberSerialization.OptIn)] public class RoomPlaylistItemStats { diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomStatusPill.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomStatusPill.cs index 5d2c4b28e6..32d0add5fd 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomStatusPill.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomStatusPill.cs @@ -59,7 +59,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components { Pill.Background.FadeColour(colours.ForRoomStatus(room), 100); - if (DateTimeOffset.Now >= room.EndDate) + if (room.HasEnded) TextFlow.Text = RoomStatusPillStrings.Ended; else { diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerRoomManager.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerRoomManager.cs index b6f4b0e8d9..7f09c9cbe9 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerRoomManager.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerRoomManager.cs @@ -30,7 +30,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer // this is done here as a pre-check to avoid clicking on already closed rooms in the lounge from triggering a server join. // should probably be done at a higher level, but due to the current structure of things this is the easiest place for now. - if (DateTimeOffset.Now >= room.EndDate) + if (room.HasEnded) { onError?.Invoke("Cannot join an ended room."); return;