Update match start text prefix in real time

This commit is contained in:
Bartłomiej Dach 2021-01-23 17:16:13 +01:00
parent 899942611f
commit a8fa09103c
1 changed files with 13 additions and 6 deletions

View File

@ -192,12 +192,7 @@ private void matchChanged(ValueChangedEvent<TournamentMatch> match)
Origin = Anchor.CentreLeft,
Children = new Drawable[]
{
new TournamentSpriteText
{
Text = match.NewValue.Date.Value.CompareTo(DateTimeOffset.Now) > 0 ? "Starting " : "Started ",
Font = OsuFont.Torus.With(size: 24, weight: FontWeight.Regular)
},
new DrawableDate(match.NewValue.Date.Value)
new ScheduleMatchDate(match.NewValue.Date.Value)
{
Font = OsuFont.Torus.With(size: 24, weight: FontWeight.Regular)
}
@ -251,6 +246,18 @@ public ScheduleMatch(TournamentMatch match, bool showTimestamp = true)
}
}
public class ScheduleMatchDate : DrawableDate
{
public ScheduleMatchDate(DateTimeOffset date, float textSize = OsuFont.DEFAULT_FONT_SIZE, bool italic = true)
: base(date, textSize, italic)
{
}
protected override string Format() => Date < DateTimeOffset.Now
? $"Started {base.Format()}"
: $"Starting {base.Format()}";
}
public class ScheduleContainer : Container
{
protected override Container<Drawable> Content => content;