mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 18:42:56 +08:00
Make DrawableDate adjustable
This commit is contained in:
parent
2c000a9a1d
commit
b89a6bea4c
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
|
||||||
@ -11,13 +12,27 @@ namespace osu.Game.Graphics
|
|||||||
{
|
{
|
||||||
public class DrawableDate : OsuSpriteText, IHasTooltip
|
public class DrawableDate : OsuSpriteText, IHasTooltip
|
||||||
{
|
{
|
||||||
protected readonly DateTimeOffset Date;
|
private DateTimeOffset date;
|
||||||
|
|
||||||
|
public DateTimeOffset Date
|
||||||
|
{
|
||||||
|
get => date;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (date == value)
|
||||||
|
return;
|
||||||
|
date = value.ToLocalTime();
|
||||||
|
|
||||||
|
if (LoadState >= LoadState.Ready)
|
||||||
|
updateTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public DrawableDate(DateTimeOffset date)
|
public DrawableDate(DateTimeOffset date)
|
||||||
{
|
{
|
||||||
Font = "Exo2.0-RegularItalic";
|
Font = "Exo2.0-RegularItalic";
|
||||||
|
|
||||||
Date = date.ToLocalTime();
|
Date = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
Loading…
Reference in New Issue
Block a user