1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 14:43:02 +08:00

Merge remote-tracking branch 'refs/remotes/ppy/master' into vote-pill-fix

This commit is contained in:
Andrei Zavatski 2019-11-06 18:15:49 +03:00
commit c01f3a58cb
5 changed files with 33 additions and 2 deletions

View File

@ -34,6 +34,7 @@ namespace osu.Game.Tests.Visual.Components
PreviewTrack track = null; PreviewTrack track = null;
AddStep("get track", () => track = getOwnedTrack()); AddStep("get track", () => track = getOwnedTrack());
AddUntilStep("wait loaded", () => track.IsLoaded);
AddStep("start", () => track.Start()); AddStep("start", () => track.Start());
AddAssert("started", () => track.IsRunning); AddAssert("started", () => track.IsRunning);
AddStep("stop", () => track.Stop()); AddStep("stop", () => track.Stop());
@ -52,6 +53,8 @@ namespace osu.Game.Tests.Visual.Components
track2 = getOwnedTrack(); track2 = getOwnedTrack();
}); });
AddUntilStep("wait loaded", () => track1.IsLoaded && track2.IsLoaded);
AddStep("start track 1", () => track1.Start()); AddStep("start track 1", () => track1.Start());
AddStep("start track 2", () => track2.Start()); AddStep("start track 2", () => track2.Start());
AddAssert("track 1 stopped", () => !track1.IsRunning); AddAssert("track 1 stopped", () => !track1.IsRunning);
@ -64,6 +67,7 @@ namespace osu.Game.Tests.Visual.Components
PreviewTrack track = null; PreviewTrack track = null;
AddStep("get track", () => track = getOwnedTrack()); AddStep("get track", () => track = getOwnedTrack());
AddUntilStep("wait loaded", () => track.IsLoaded);
AddStep("start", () => track.Start()); AddStep("start", () => track.Start());
AddStep("stop by owner", () => trackManager.StopAnyPlaying(this)); AddStep("stop by owner", () => trackManager.StopAnyPlaying(this));
AddAssert("stopped", () => !track.IsRunning); AddAssert("stopped", () => !track.IsRunning);
@ -76,6 +80,7 @@ namespace osu.Game.Tests.Visual.Components
PreviewTrack track = null; PreviewTrack track = null;
AddStep("get track", () => Add(owner = new TestTrackOwner(track = getTrack()))); AddStep("get track", () => Add(owner = new TestTrackOwner(track = getTrack())));
AddUntilStep("wait loaded", () => track.IsLoaded);
AddStep("start", () => track.Start()); AddStep("start", () => track.Start());
AddStep("attempt stop", () => trackManager.StopAnyPlaying(this)); AddStep("attempt stop", () => trackManager.StopAnyPlaying(this));
AddAssert("not stopped", () => track.IsRunning); AddAssert("not stopped", () => track.IsRunning);
@ -89,16 +94,24 @@ namespace osu.Game.Tests.Visual.Components
{ {
var track = getTrack(); var track = getTrack();
Add(track); LoadComponentAsync(track, Add);
return track; return track;
} }
private class TestTrackOwner : CompositeDrawable, IPreviewTrackOwner private class TestTrackOwner : CompositeDrawable, IPreviewTrackOwner
{ {
private readonly PreviewTrack track;
public TestTrackOwner(PreviewTrack track) public TestTrackOwner(PreviewTrack track)
{ {
AddInternal(track); this.track = track;
}
[BackgroundDependencyLoader]
private void load()
{
LoadComponentAsync(track, AddInternal);
} }
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)

View File

@ -9,6 +9,7 @@ using osu.Framework.Threading;
namespace osu.Game.Audio namespace osu.Game.Audio
{ {
[LongRunningLoad]
public abstract class PreviewTrack : Component public abstract class PreviewTrack : Component
{ {
/// <summary> /// <summary>

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Textures;
namespace osu.Game.Beatmaps.Drawables namespace osu.Game.Beatmaps.Drawables
{ {
[LongRunningLoad]
public class BeatmapSetCover : Sprite public class BeatmapSetCover : Sprite
{ {
private readonly BeatmapSetInfo set; private readonly BeatmapSetInfo set;

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Timing;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Edit.Tools;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
@ -30,6 +31,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
private SelectionHandler selectionHandler; private SelectionHandler selectionHandler;
private InputManager inputManager; private InputManager inputManager;
[Resolved]
private IAdjustableClock adjustableClock { get; set; }
[Resolved] [Resolved]
private HitObjectComposer composer { get; set; } private HitObjectComposer composer { get; set; }
@ -106,6 +110,17 @@ namespace osu.Game.Screens.Edit.Compose.Components
return true; return true;
} }
protected override bool OnDoubleClick(DoubleClickEvent e)
{
SelectionBlueprint clickedBlueprint = selectionHandler.SelectedBlueprints.FirstOrDefault(b => b.IsHovered);
if (clickedBlueprint == null)
return false;
adjustableClock?.Seek(clickedBlueprint.DrawableObject.HitObject.StartTime);
return true;
}
protected override bool OnMouseUp(MouseUpEvent e) protected override bool OnMouseUp(MouseUpEvent e)
{ {
// Special case for when a drag happened instead of a click // Special case for when a drag happened instead of a click

View File

@ -13,6 +13,7 @@ using osu.Game.Graphics.Containers;
namespace osu.Game.Users.Drawables namespace osu.Game.Users.Drawables
{ {
[LongRunningLoad]
public class DrawableAvatar : Container public class DrawableAvatar : Container
{ {
/// <summary> /// <summary>