mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 15:33:05 +08:00
Merge remote-tracking branch 'upstream/master' into HoutarouOreki-changelog-overlay
This commit is contained in:
commit
0bce7241d2
@ -39,7 +39,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
});
|
||||
|
||||
AddStep(@"Collapse", () => expandingBar.Collapse());
|
||||
AddStep(@"Uncollapse", () => expandingBar.Expand());
|
||||
AddStep(@"Expand", () => expandingBar.Expand());
|
||||
AddSliderStep(@"Resize container", 1, 300, 150, value => container.ResizeTo(value));
|
||||
AddStep(@"Horizontal", () => expandingBar.RelativeSizeAxes = Axes.X);
|
||||
AddStep(@"Anchor top", () => expandingBar.Anchor = Anchor.TopCentre);
|
||||
|
@ -28,7 +28,8 @@ namespace osu.Game.Audio
|
||||
private void load()
|
||||
{
|
||||
track = GetTrack();
|
||||
track.Completed += () => Schedule(Stop);
|
||||
if (track != null)
|
||||
track.Completed += () => Schedule(Stop);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -56,19 +57,25 @@ namespace osu.Game.Audio
|
||||
/// <summary>
|
||||
/// Starts playing this <see cref="PreviewTrack"/>.
|
||||
/// </summary>
|
||||
public void Start() => startDelegate = Schedule(() =>
|
||||
/// <returns>Whether the track is started or already playing.</returns>
|
||||
public bool Start()
|
||||
{
|
||||
if (track == null)
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (hasStarted)
|
||||
return;
|
||||
startDelegate = Schedule(() =>
|
||||
{
|
||||
if (hasStarted)
|
||||
return;
|
||||
|
||||
hasStarted = true;
|
||||
hasStarted = true;
|
||||
|
||||
track.Restart();
|
||||
Started?.Invoke();
|
||||
});
|
||||
track.Restart();
|
||||
Started?.Invoke();
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops playing this <see cref="PreviewTrack"/>.
|
||||
|
@ -129,7 +129,7 @@ namespace osu.Game.Overlays.Direct
|
||||
|
||||
if (Preview != null)
|
||||
{
|
||||
Preview.Start();
|
||||
attemptStart();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ namespace osu.Game.Overlays.Direct
|
||||
|
||||
// user may have changed their mind.
|
||||
if (Playing.Value)
|
||||
preview.Start();
|
||||
attemptStart();
|
||||
});
|
||||
}
|
||||
else
|
||||
@ -157,6 +157,12 @@ namespace osu.Game.Overlays.Direct
|
||||
}
|
||||
}
|
||||
|
||||
private void attemptStart()
|
||||
{
|
||||
if (Preview?.Start() != true)
|
||||
Playing.Value = false;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
Loading…
Reference in New Issue
Block a user