mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Add track timer
This commit is contained in:
@ -1,9 +1,45 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Components
|
||||
{
|
||||
public class TimeInfoContainer : BottomBarContainer
|
||||
{
|
||||
private const int count_duration = 150;
|
||||
|
||||
private readonly OsuSpriteText trackTimer;
|
||||
private double savedTime;
|
||||
|
||||
public TimeInfoContainer()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
trackTimer = new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativePositionAxes = Axes.Y,
|
||||
TextSize = 22,
|
||||
FixedWidth = true,
|
||||
Y = 0.5f,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
var currentTime = Track.CurrentTime;
|
||||
|
||||
if (savedTime == currentTime)
|
||||
return;
|
||||
|
||||
trackTimer.Text = TimeSpan.FromMilliseconds(currentTime).ToString(@"mm\:ss\:fff");
|
||||
savedTime = currentTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user