mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 19:03:08 +08:00
Tidy up code, remove unnecessary string.Formats
This commit is contained in:
parent
98fec94693
commit
0ef5b8f464
@ -12,14 +12,14 @@ namespace osu.Game.Graphics
|
||||
{
|
||||
public class DrawableDate : OsuSpriteText, IHasTooltip
|
||||
{
|
||||
private readonly DateTimeOffset date;
|
||||
protected readonly DateTimeOffset Date;
|
||||
|
||||
public DrawableDate(DateTimeOffset date)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Font = "Exo2.0-RegularItalic";
|
||||
|
||||
this.date = date.ToLocalTime();
|
||||
this.Date = date.ToLocalTime();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -38,7 +38,7 @@ namespace osu.Game.Graphics
|
||||
{
|
||||
updateTime();
|
||||
|
||||
var diffToNow = DateTimeOffset.Now.Subtract(date);
|
||||
var diffToNow = DateTimeOffset.Now.Subtract(Date);
|
||||
|
||||
double timeUntilNextUpdate = 1000;
|
||||
if (diffToNow.TotalSeconds > 60)
|
||||
@ -58,10 +58,10 @@ namespace osu.Game.Graphics
|
||||
|
||||
public override bool HandleMouseInput => true;
|
||||
|
||||
protected virtual string Format() => date.Humanize();
|
||||
protected virtual string Format() => Date.Humanize();
|
||||
|
||||
private void updateTime() => Text = Format();
|
||||
|
||||
public virtual string TooltipText => string.Format($"{date:MMMM d, yyyy h:mm tt \"UTC\"z}");
|
||||
public virtual string TooltipText => string.Format($"{Date:MMMM d, yyyy h:mm tt \"UTC\"z}");
|
||||
}
|
||||
}
|
||||
|
@ -7,17 +7,13 @@ namespace osu.Game.Graphics
|
||||
{
|
||||
public class DrawableJoinDate : DrawableDate
|
||||
{
|
||||
private readonly DateTimeOffset date;
|
||||
|
||||
public DrawableJoinDate(DateTimeOffset date) : base(date)
|
||||
public DrawableJoinDate(DateTimeOffset date)
|
||||
: base(date)
|
||||
{
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
protected override string Format() => Text = date.ToUniversalTime().Year < 2008 ?
|
||||
"Here since the beginning" :
|
||||
string.Format($"{date:MMMM yyyy}");
|
||||
protected override string Format() => Text = Date.ToUniversalTime().Year < 2008 ? "Here since the beginning" : $"{Date:MMMM yyyy}";
|
||||
|
||||
public override string TooltipText => string.Format($"{date:MMMM d, yyyy}");
|
||||
public override string TooltipText => $"{Date:MMMM d, yyyy}";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user