diff --git a/osu.Game/Screens/Multi/Components/EndDateInfo.cs b/osu.Game/Screens/Multi/Components/EndDateInfo.cs new file mode 100644 index 0000000000..c71ec04d33 --- /dev/null +++ b/osu.Game/Screens/Multi/Components/EndDateInfo.cs @@ -0,0 +1,32 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Game.Graphics; + +namespace osu.Game.Screens.Multi.Components +{ + public class EndDateInfo : DrawableDate + { + public EndDateInfo() + : base(DateTimeOffset.UtcNow) + { + } + + protected override string Format() + { + var diffToNow = Date.Subtract(DateTimeOffset.Now); + + if (diffToNow.TotalSeconds < -5) + return $"Closed {base.Format()}"; + + if (diffToNow.TotalSeconds < 0) + return "Closed"; + + if (diffToNow.TotalSeconds < 5) + return "Closing soon"; + + return $"Closing {base.Format()}"; + } + } +} diff --git a/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs b/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs index 5cf11e5c98..adcb088f4e 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs @@ -31,7 +31,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components private const float corner_radius = 5; private const float transition_duration = 60; private const float content_padding = 10; - private const float height = 100; + private const float height = 110; private const float side_strip_width = 5; private const float cover_width = 145; @@ -45,6 +45,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components private readonly Bindable typeBind = new Bindable(); private readonly Bindable> participantsBind = new Bindable>(); private readonly IBindableCollection playlistBind = new BindableCollection(); + private readonly IBindable endDateBind = new Bindable(); private readonly Bindable beatmap = new Bindable(); @@ -111,8 +112,8 @@ namespace osu.Game.Screens.Multi.Lounge.Components Box sideStrip; OsuSpriteText status; ParticipantInfo participantInfo; - OsuSpriteText name; + EndDateInfo endDate; Children = new Drawable[] { @@ -189,11 +190,25 @@ namespace osu.Game.Screens.Multi.Lounge.Components TextSize = 14, Font = @"Exo2.0-Bold", }, - beatmapTitle = new BeatmapTitle + new FillFlowContainer { - TextSize = 14, - Colour = colours.Gray9 - }, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 5), + Children = new Drawable[] + { + endDate = new EndDateInfo + { + TextSize = 14, + }, + beatmapTitle = new BeatmapTitle + { + TextSize = 14, + Colour = colours.Gray9 + }, + } + } }, }, modeTypeInfo = new ModeTypeInfo @@ -224,6 +239,9 @@ namespace osu.Game.Screens.Multi.Lounge.Components typeBind.BindTo(Room.Type); playlistBind.BindTo(Room.Playlist); participantsBind.BindTo(Room.Participants); + endDateBind.BindTo(Room.EndDate); + + endDateBind.BindValueChanged(d => endDate.Date = d, true); modeTypeInfo.Type.BindTo(typeBind); diff --git a/osu.Game/Screens/Multi/Match/Components/Info.cs b/osu.Game/Screens/Multi/Match/Components/Info.cs index 9710f4b2fd..f63135fc2d 100644 --- a/osu.Game/Screens/Multi/Match/Components/Info.cs +++ b/osu.Game/Screens/Multi/Match/Components/Info.cs @@ -47,7 +47,7 @@ namespace osu.Game.Screens.Multi.Match.Components BeatmapTypeInfo beatmapTypeInfo; OsuSpriteText name; ModDisplay modDisplay; - DrawableDate date; + EndDateInfo endDate; Children = new Drawable[] { @@ -79,7 +79,7 @@ namespace osu.Game.Screens.Multi.Match.Components { name = new OsuSpriteText { TextSize = 30 }, availabilityStatus = new OsuSpriteText { TextSize = 14 }, - date = new MatchDate { TextSize = 14 } + endDate = new EndDateInfo { TextSize = 14 } } }, new FillFlowContainer @@ -129,7 +129,7 @@ namespace osu.Game.Screens.Multi.Match.Components Availability.BindValueChanged(_ => updateAvailabilityStatus()); Status.BindValueChanged(_ => updateAvailabilityStatus()); Name.BindValueChanged(n => name.Text = n); - EndDate.BindValueChanged(d => date.Date = d); + EndDate.BindValueChanged(d => endDate.Date = d); } [BackgroundDependencyLoader] @@ -156,29 +156,5 @@ namespace osu.Game.Screens.Multi.Match.Components availabilityStatus.Text = $"{Availability.Value.GetDescription()}, {Status.Value.Message}"; } } - - private class MatchDate : DrawableDate - { - public MatchDate() - : base(DateTimeOffset.UtcNow) - { - } - - protected override string Format() - { - var diffToNow = Date.Subtract(DateTimeOffset.Now); - - if (diffToNow.TotalSeconds < -5) - return $"Closed {base.Format()}"; - - if (diffToNow.TotalSeconds < 0) - return "Closed"; - - if (diffToNow.TotalSeconds < 5) - return "Closing soon"; - - return $"Closing {base.Format()}"; - } - } } }