mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Apply suggestions
This commit is contained in:
@ -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>
|
||||||
|
@ -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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user