mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 09:42:54 +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(@"Collapse", () => expandingBar.Collapse());
|
||||||
AddStep(@"Uncollapse", () => expandingBar.Expand());
|
AddStep(@"Expand", () => expandingBar.Expand());
|
||||||
AddSliderStep(@"Resize container", 1, 300, 150, value => container.ResizeTo(value));
|
AddSliderStep(@"Resize container", 1, 300, 150, value => container.ResizeTo(value));
|
||||||
AddStep(@"Horizontal", () => expandingBar.RelativeSizeAxes = Axes.X);
|
AddStep(@"Horizontal", () => expandingBar.RelativeSizeAxes = Axes.X);
|
||||||
AddStep(@"Anchor top", () => expandingBar.Anchor = Anchor.TopCentre);
|
AddStep(@"Anchor top", () => expandingBar.Anchor = Anchor.TopCentre);
|
||||||
|
@ -28,6 +28,7 @@ namespace osu.Game.Audio
|
|||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
track = GetTrack();
|
track = GetTrack();
|
||||||
|
if (track != null)
|
||||||
track.Completed += () => Schedule(Stop);
|
track.Completed += () => Schedule(Stop);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,11 +57,14 @@ namespace osu.Game.Audio
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Starts playing this <see cref="PreviewTrack"/>.
|
/// Starts playing this <see cref="PreviewTrack"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Start() => startDelegate = Schedule(() =>
|
/// <returns>Whether the track is started or already playing.</returns>
|
||||||
|
public bool Start()
|
||||||
{
|
{
|
||||||
if (track == null)
|
if (track == null)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
|
startDelegate = Schedule(() =>
|
||||||
|
{
|
||||||
if (hasStarted)
|
if (hasStarted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -70,6 +74,9 @@ namespace osu.Game.Audio
|
|||||||
Started?.Invoke();
|
Started?.Invoke();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stops playing this <see cref="PreviewTrack"/>.
|
/// Stops playing this <see cref="PreviewTrack"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -129,7 +129,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
|
|
||||||
if (Preview != null)
|
if (Preview != null)
|
||||||
{
|
{
|
||||||
Preview.Start();
|
attemptStart();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
|
|
||||||
// user may have changed their mind.
|
// user may have changed their mind.
|
||||||
if (Playing.Value)
|
if (Playing.Value)
|
||||||
preview.Start();
|
attemptStart();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
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)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
|
Loading…
Reference in New Issue
Block a user