mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 14:12:55 +08:00
Apply suggestions
This commit is contained in:
parent
0d1b5ae44f
commit
41498ffad3
@ -17,8 +17,6 @@ namespace osu.Game.Screens.Edit.Components
|
||||
{
|
||||
private readonly IconButton playButton;
|
||||
|
||||
private bool lastTrackState;
|
||||
|
||||
public PlaybackContainer()
|
||||
{
|
||||
PlaybackTabControl tabs;
|
||||
@ -32,7 +30,7 @@ namespace osu.Game.Screens.Edit.Components
|
||||
Scale = new Vector2(1.4f),
|
||||
IconScale = new Vector2(1.4f),
|
||||
Icon = FontAwesome.fa_play_circle_o,
|
||||
Action = play,
|
||||
Action = playPause,
|
||||
Padding = new MarginPadding { Left = 20 }
|
||||
},
|
||||
new OsuSpriteText
|
||||
@ -61,7 +59,7 @@ namespace osu.Game.Screens.Edit.Components
|
||||
tabs.Current.ValueChanged += newValue => Track.Tempo.Value = newValue;
|
||||
}
|
||||
|
||||
private void play()
|
||||
private void playPause()
|
||||
{
|
||||
if (Track.IsRunning)
|
||||
Track.Stop();
|
||||
@ -73,13 +71,7 @@ namespace osu.Game.Screens.Edit.Components
|
||||
{
|
||||
base.Update();
|
||||
|
||||
var currentTrackState = Track.IsRunning;
|
||||
if (currentTrackState == lastTrackState)
|
||||
return;
|
||||
|
||||
playButton.Icon = currentTrackState ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o;
|
||||
|
||||
lastTrackState = currentTrackState;
|
||||
playButton.Icon = Track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o;
|
||||
}
|
||||
|
||||
private class PlaybackTabControl : OsuTabControl<double>
|
||||
|
@ -12,7 +12,6 @@ namespace osu.Game.Screens.Edit.Components
|
||||
private const int count_duration = 150;
|
||||
|
||||
private readonly OsuSpriteText trackTimer;
|
||||
private double savedTime;
|
||||
|
||||
public TimeInfoContainer()
|
||||
{
|
||||
@ -33,13 +32,7 @@ namespace osu.Game.Screens.Edit.Components
|
||||
{
|
||||
base.Update();
|
||||
|
||||
var currentTime = Track.CurrentTime;
|
||||
|
||||
if (savedTime == currentTime)
|
||||
return;
|
||||
|
||||
trackTimer.Text = TimeSpan.FromMilliseconds(currentTime).ToString(@"mm\:ss\:fff");
|
||||
savedTime = currentTime;
|
||||
trackTimer.Text = TimeSpan.FromMilliseconds(Track.CurrentTime).ToString(@"mm\:ss\:fff");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user