1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-01 00:53:29 +08:00
osu-lazer/osu.Game/Screens/Multi/Components/EndDateInfo.cs

33 lines
819 B
C#
Raw Normal View History

2018-12-19 14:20:23 +08:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// 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()}";
}
}
}