Apply suggestions

This commit is contained in:
EVAST9919
2017-11-21 12:22:19 +03:00
parent 0d1b5ae44f
commit 41498ffad3
2 changed files with 4 additions and 19 deletions

View File

@ -17,8 +17,6 @@ namespace osu.Game.Screens.Edit.Components
{ {
private readonly IconButton playButton; private readonly IconButton playButton;
private bool lastTrackState;
public PlaybackContainer() public PlaybackContainer()
{ {
PlaybackTabControl tabs; PlaybackTabControl tabs;
@ -32,7 +30,7 @@ namespace osu.Game.Screens.Edit.Components
Scale = new Vector2(1.4f), Scale = new Vector2(1.4f),
IconScale = new Vector2(1.4f), IconScale = new Vector2(1.4f),
Icon = FontAwesome.fa_play_circle_o, Icon = FontAwesome.fa_play_circle_o,
Action = play, Action = playPause,
Padding = new MarginPadding { Left = 20 } Padding = new MarginPadding { Left = 20 }
}, },
new OsuSpriteText new OsuSpriteText
@ -61,7 +59,7 @@ namespace osu.Game.Screens.Edit.Components
tabs.Current.ValueChanged += newValue => Track.Tempo.Value = newValue; tabs.Current.ValueChanged += newValue => Track.Tempo.Value = newValue;
} }
private void play() private void playPause()
{ {
if (Track.IsRunning) if (Track.IsRunning)
Track.Stop(); Track.Stop();
@ -73,13 +71,7 @@ namespace osu.Game.Screens.Edit.Components
{ {
base.Update(); base.Update();
var currentTrackState = Track.IsRunning; playButton.Icon = Track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o;
if (currentTrackState == lastTrackState)
return;
playButton.Icon = currentTrackState ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o;
lastTrackState = currentTrackState;
} }
private class PlaybackTabControl : OsuTabControl<double> private class PlaybackTabControl : OsuTabControl<double>

View File

@ -12,7 +12,6 @@ namespace osu.Game.Screens.Edit.Components
private const int count_duration = 150; private const int count_duration = 150;
private readonly OsuSpriteText trackTimer; private readonly OsuSpriteText trackTimer;
private double savedTime;
public TimeInfoContainer() public TimeInfoContainer()
{ {
@ -33,13 +32,7 @@ namespace osu.Game.Screens.Edit.Components
{ {
base.Update(); base.Update();
var currentTime = Track.CurrentTime; trackTimer.Text = TimeSpan.FromMilliseconds(Track.CurrentTime).ToString(@"mm\:ss\:fff");
if (savedTime == currentTime)
return;
trackTimer.Text = TimeSpan.FromMilliseconds(currentTime).ToString(@"mm\:ss\:fff");
savedTime = currentTime;
} }
} }
} }