2019-01-24 16:43:03 +08:00
|
|
|
|
// 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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
using System;
|
|
|
|
|
using osu.Framework.Allocation;
|
2019-02-12 12:04:46 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Edit.Components
|
|
|
|
|
{
|
|
|
|
|
public class TimeInfoContainer : BottomBarContainer
|
|
|
|
|
{
|
|
|
|
|
private readonly OsuSpriteText trackTimer;
|
|
|
|
|
|
2020-02-14 21:14:00 +08:00
|
|
|
|
[Resolved]
|
2020-05-22 15:37:28 +08:00
|
|
|
|
private EditorClock editorClock { get; set; }
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
public TimeInfoContainer()
|
|
|
|
|
{
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
trackTimer = new OsuSpriteText
|
|
|
|
|
{
|
2020-09-24 12:10:54 +08:00
|
|
|
|
Anchor = Anchor.CentreRight,
|
|
|
|
|
Origin = Anchor.CentreRight,
|
|
|
|
|
// intentionally fudged centre to avoid movement of the number portion when
|
|
|
|
|
// going negative.
|
|
|
|
|
X = -35,
|
|
|
|
|
Font = OsuFont.GetFont(size: 25, fixedWidth: true),
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
|
{
|
|
|
|
|
base.Update();
|
|
|
|
|
|
2020-09-24 12:10:54 +08:00
|
|
|
|
var timespan = TimeSpan.FromMilliseconds(editorClock.CurrentTime);
|
|
|
|
|
trackTimer.Text = $"{(timespan < TimeSpan.Zero ? "-" : string.Empty)}{timespan:mm\\:ss\\:fff}";
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|