mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 12:53:11 +08:00
Expose track change results on the methods
This commit is contained in:
parent
54013790fc
commit
42895e27b6
@ -207,7 +207,18 @@ 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>
|
||||||
public void PreviousTrack() => Schedule(() => prev());
|
/// <param name="onSuccess">
|
||||||
|
/// Invoked when the operation has been performed successfully.
|
||||||
|
/// The result isn't returned directly to the caller because
|
||||||
|
/// the operation is scheduled and isn't performed immediately.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>A <see cref="ScheduledDelegate"/> of the operation.</returns>
|
||||||
|
public ScheduledDelegate PreviousTrack(Action<PreviousTrackResult> onSuccess = null) => Schedule(() =>
|
||||||
|
{
|
||||||
|
PreviousTrackResult res = prev();
|
||||||
|
if (res != PreviousTrackResult.None)
|
||||||
|
onSuccess?.Invoke(res);
|
||||||
|
});
|
||||||
|
|
||||||
/// <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"/>.
|
||||||
@ -243,7 +254,18 @@ namespace osu.Game.Overlays
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Play the next random or playlist track.
|
/// Play the next random or playlist track.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void NextTrack() => Schedule(() => next());
|
/// <param name="onSuccess">
|
||||||
|
/// Invoked when the operation has been performed successfully.
|
||||||
|
/// The result isn't returned directly to the caller because
|
||||||
|
/// the operation is scheduled and isn't performed immediately.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>A <see cref="ScheduledDelegate"/> of the operation.</returns>
|
||||||
|
public ScheduledDelegate NextTrack(Action onSuccess = null) => Schedule(() =>
|
||||||
|
{
|
||||||
|
bool res = next();
|
||||||
|
if (res)
|
||||||
|
onSuccess?.Invoke();
|
||||||
|
});
|
||||||
|
|
||||||
private bool next()
|
private bool next()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user