mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 06:52:56 +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,7 +28,8 @@ namespace osu.Game.Audio
|
|||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
track = GetTrack();
|
track = GetTrack();
|
||||||
track.Completed += () => Schedule(Stop);
|
if (track != null)
|
||||||
|
track.Completed += () => Schedule(Stop);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -56,19 +57,25 @@ 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;
|
||||||
|
|
||||||
if (hasStarted)
|
startDelegate = Schedule(() =>
|
||||||
return;
|
{
|
||||||
|
if (hasStarted)
|
||||||
|
return;
|
||||||
|
|
||||||
hasStarted = true;
|
hasStarted = true;
|
||||||
|
|
||||||
track.Restart();
|
track.Restart();
|
||||||
Started?.Invoke();
|
Started?.Invoke();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stops playing this <see cref="PreviewTrack"/>.
|
/// Stops playing this <see cref="PreviewTrack"/>.
|
||||||
|
@ -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