mirror of
https://github.com/ppy/osu.git
synced 2025-01-30 21:25:36 +08:00
Merge pull request #11576 from yhsphd/tournament-schedule-starting-started
Fix tense mismatch in tournament schedule view
This commit is contained in:
commit
704c76ba04
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Tournament.Components;
|
using osu.Game.Tournament.Components;
|
||||||
@ -16,5 +18,23 @@ namespace osu.Game.Tournament.Tests.Screens
|
|||||||
Add(new TourneyVideo("main") { RelativeSizeAxes = Axes.Both });
|
Add(new TourneyVideo("main") { RelativeSizeAxes = Axes.Both });
|
||||||
Add(new ScheduleScreen());
|
Add(new ScheduleScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestCurrentMatchTime()
|
||||||
|
{
|
||||||
|
setMatchDate(TimeSpan.FromDays(-1));
|
||||||
|
setMatchDate(TimeSpan.FromSeconds(5));
|
||||||
|
setMatchDate(TimeSpan.FromMinutes(4));
|
||||||
|
setMatchDate(TimeSpan.FromHours(3));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setMatchDate(TimeSpan relativeTime)
|
||||||
|
// Humanizer cannot handle negative timespans.
|
||||||
|
=> AddStep($"start time is {relativeTime}", () =>
|
||||||
|
{
|
||||||
|
var match = CreateSampleMatch();
|
||||||
|
match.Date.Value = DateTimeOffset.Now + relativeTime;
|
||||||
|
Ladder.CurrentMatch.Value = match;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,12 +192,7 @@ namespace osu.Game.Tournament.Screens.Schedule
|
|||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new TournamentSpriteText
|
new ScheduleMatchDate(match.NewValue.Date.Value)
|
||||||
{
|
|
||||||
Text = "Starting ",
|
|
||||||
Font = OsuFont.Torus.With(size: 24, weight: FontWeight.Regular)
|
|
||||||
},
|
|
||||||
new DrawableDate(match.NewValue.Date.Value)
|
|
||||||
{
|
{
|
||||||
Font = OsuFont.Torus.With(size: 24, weight: FontWeight.Regular)
|
Font = OsuFont.Torus.With(size: 24, weight: FontWeight.Regular)
|
||||||
}
|
}
|
||||||
@ -251,6 +246,18 @@ namespace osu.Game.Tournament.Screens.Schedule
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
public class ScheduleContainer : Container
|
||||||
{
|
{
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
Loading…
Reference in New Issue
Block a user