1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 01:27:29 +08:00

Renames and xmldoc

This commit is contained in:
Dean Herbert 2019-10-24 13:10:17 +09:00
parent 901aa60bdd
commit 967551fec0
3 changed files with 15 additions and 12 deletions

View File

@ -46,11 +46,11 @@ namespace osu.Game.Tests.Visual.UserInterface
}); });
AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000)); AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000));
AddStep(@"Call PrevTrack", () => musicController.PrevTrack()); AddStep(@"Call PrevTrack", () => musicController.PreviousTrack());
AddAssert(@"Check if it restarted", () => currentTrack == Beatmap.Value); AddAssert(@"Check if it restarted", () => currentTrack == Beatmap.Value);
AddStep(@"Seek track to 2 second", () => musicController.SeekTo(2000)); AddStep(@"Seek track to 2 second", () => musicController.SeekTo(2000));
AddStep(@"Call PrevTrack", () => musicController.PrevTrack()); AddStep(@"Call PrevTrack", () => musicController.PreviousTrack());
// If the track isn't changing, check the current track's time instead // If the track isn't changing, check the current track's time instead
AddAssert(@"Check if it changed to prev track'", () => currentTrack != Beatmap.Value || currentTrack.Track.CurrentTime < 2000); AddAssert(@"Check if it changed to prev track'", () => currentTrack != Beatmap.Value || currentTrack.Track.CurrentTime < 2000);
} }

View File

@ -27,6 +27,9 @@ namespace osu.Game.Overlays
public IBindableList<BeatmapSetInfo> BeatmapSets => beatmapSets; public IBindableList<BeatmapSetInfo> BeatmapSets => beatmapSets;
/// <summary>
/// Point in time after which the current track will be restarted on triggering a "previous track" action.
/// </summary>
private const double restart_cutoff_point = 5000; private const double restart_cutoff_point = 5000;
private readonly BindableList<BeatmapSetInfo> beatmapSets = new BindableList<BeatmapSetInfo>(); private readonly BindableList<BeatmapSetInfo> beatmapSets = new BindableList<BeatmapSetInfo>();
@ -155,15 +158,15 @@ namespace osu.Game.Overlays
/// <summary> /// <summary>
/// Play the previous track or restart the current track if it's current time below <see cref="restart_cutoff_point"/> /// Play the previous track or restart the current track if it's current time below <see cref="restart_cutoff_point"/>
/// </summary> /// </summary>
/// <returns>The <see cref="PreviousButtonAction"/> that indicate the decided action</returns> /// <returns>The <see cref="PreviousTrackResult"/> that indicate the decided action</returns>
public PreviousButtonAction PrevTrack() public PreviousTrackResult PreviousTrack()
{ {
var currentTrackPosition = current?.Track.CurrentTime; var currentTrackPosition = current?.Track.CurrentTime;
if (currentTrackPosition >= restart_cutoff_point) if (currentTrackPosition >= restart_cutoff_point)
{ {
SeekTo(0); SeekTo(0);
return PreviousButtonAction.Restart; return PreviousTrackResult.Restart;
} }
queuedDirection = TrackChangeDirection.Prev; queuedDirection = TrackChangeDirection.Prev;
@ -176,10 +179,10 @@ namespace osu.Game.Overlays
working.Value = beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmap.Value); working.Value = beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmap.Value);
beatmap.Value.Track.Restart(); beatmap.Value.Track.Restart();
return PreviousButtonAction.Previous; return PreviousTrackResult.Previous;
} }
return PreviousButtonAction.None; return PreviousTrackResult.None;
} }
/// <summary> /// <summary>
@ -285,13 +288,13 @@ namespace osu.Game.Overlays
return true; return true;
case GlobalAction.MusicPrev: case GlobalAction.MusicPrev:
switch (PrevTrack()) switch (PreviousTrack())
{ {
case PreviousButtonAction.Restart: case PreviousTrackResult.Restart:
onScreenDisplay?.Display(new MusicControllerToast("Restart track")); onScreenDisplay?.Display(new MusicControllerToast("Restart track"));
break; break;
case PreviousButtonAction.Previous: case PreviousTrackResult.Previous:
onScreenDisplay?.Display(new MusicControllerToast("Previous track")); onScreenDisplay?.Display(new MusicControllerToast("Previous track"));
break; break;
} }
@ -320,7 +323,7 @@ namespace osu.Game.Overlays
Prev Prev
} }
public enum PreviousButtonAction public enum PreviousTrackResult
{ {
None, None,
Restart, Restart,

View File

@ -137,7 +137,7 @@ namespace osu.Game.Overlays
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Action = () => musicController.PrevTrack(), Action = () => musicController.PreviousTrack(),
Icon = FontAwesome.Solid.StepBackward, Icon = FontAwesome.Solid.StepBackward,
}, },
playButton = new MusicIconButton playButton = new MusicIconButton