This repository has been archived by the owner on Jun 11, 2023. It is now read-only.
forked from ppy/osu
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e323e64
commit 095e1cc
Showing
28 changed files
with
451 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 2 additions & 133 deletions
135
osu.Game.Tests/Visual/Editor/TestSceneTimelineBlueprintContainer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,146 +1,15 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Audio; | ||
using osu.Framework.Bindables; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Framework.Graphics.Shapes; | ||
using osu.Framework.Timing; | ||
using osu.Game.Beatmaps; | ||
using osu.Game.Graphics.UserInterface; | ||
using osu.Game.Rulesets.Edit; | ||
using osu.Game.Rulesets.Objects; | ||
using osu.Game.Screens.Edit; | ||
using osu.Game.Screens.Edit.Compose.Components.Timeline; | ||
using osuTK; | ||
using osuTK.Graphics; | ||
|
||
namespace osu.Game.Tests.Visual.Editor | ||
{ | ||
[TestFixture] | ||
public class TestSceneTimelineBlueprintContainer : EditorClockTestScene | ||
public class TestSceneTimelineBlueprintContainer : TimelineTestScene | ||
{ | ||
public override IReadOnlyList<Type> RequiredTypes => new[] | ||
{ | ||
typeof(TimelineArea), | ||
typeof(Timeline), | ||
typeof(TimelineButton), | ||
typeof(CentreMarker) | ||
}; | ||
|
||
[BackgroundDependencyLoader] | ||
private void load(AudioManager audio) | ||
{ | ||
Beatmap.Value = new WaveformTestBeatmap(audio); | ||
|
||
var editorBeatmap = new EditorBeatmap((Beatmap<HitObject>)Beatmap.Value.Beatmap, BeatDivisor); | ||
|
||
Dependencies.Cache(editorBeatmap); | ||
Dependencies.CacheAs<IBeatSnapProvider>(editorBeatmap); | ||
|
||
Children = new Drawable[] | ||
{ | ||
new FillFlowContainer | ||
{ | ||
AutoSizeAxes = Axes.Both, | ||
Direction = FillDirection.Vertical, | ||
Spacing = new Vector2(0, 5), | ||
Children = new Drawable[] | ||
{ | ||
new StartStopButton(), | ||
new AudioVisualiser(), | ||
} | ||
}, | ||
new TimelineArea | ||
{ | ||
Child = new TimelineBlueprintContainer(), | ||
Anchor = Anchor.Centre, | ||
Origin = Anchor.Centre, | ||
RelativeSizeAxes = Axes.X, | ||
Size = new Vector2(0.8f, 100) | ||
} | ||
}; | ||
} | ||
|
||
private class AudioVisualiser : CompositeDrawable | ||
{ | ||
private readonly Drawable marker; | ||
|
||
[Resolved] | ||
private IBindable<WorkingBeatmap> beatmap { get; set; } | ||
|
||
[Resolved] | ||
private IAdjustableClock adjustableClock { get; set; } | ||
|
||
public AudioVisualiser() | ||
{ | ||
Size = new Vector2(250, 25); | ||
|
||
InternalChildren = new[] | ||
{ | ||
new Box | ||
{ | ||
RelativeSizeAxes = Axes.Both, | ||
Alpha = 0.25f, | ||
}, | ||
marker = new Box | ||
{ | ||
RelativePositionAxes = Axes.X, | ||
RelativeSizeAxes = Axes.Y, | ||
Width = 2, | ||
} | ||
}; | ||
} | ||
|
||
protected override void Update() | ||
{ | ||
base.Update(); | ||
|
||
if (beatmap.Value.Track.IsLoaded) | ||
marker.X = (float)(adjustableClock.CurrentTime / beatmap.Value.Track.Length); | ||
} | ||
} | ||
|
||
private class StartStopButton : OsuButton | ||
{ | ||
private IAdjustableClock adjustableClock; | ||
private bool started; | ||
|
||
public StartStopButton() | ||
{ | ||
BackgroundColour = Color4.SlateGray; | ||
Size = new Vector2(100, 50); | ||
Text = "Start"; | ||
|
||
Action = onClick; | ||
} | ||
|
||
[BackgroundDependencyLoader] | ||
private void load(IAdjustableClock adjustableClock) | ||
{ | ||
this.adjustableClock = adjustableClock; | ||
} | ||
|
||
private void onClick() | ||
{ | ||
if (started) | ||
{ | ||
adjustableClock.Stop(); | ||
Text = "Start"; | ||
} | ||
else | ||
{ | ||
adjustableClock.Start(); | ||
Text = "Stop"; | ||
} | ||
|
||
started = !started; | ||
} | ||
} | ||
public override Drawable CreateTestComponent() => new TimelineBlueprintContainer(); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
osu.Game.Tests/Visual/Editor/TestSceneTimelineTickDisplay.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using NUnit.Framework; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics; | ||
using osu.Game.Screens.Edit.Compose.Components; | ||
using osu.Game.Screens.Edit.Compose.Components.Timeline; | ||
using osuTK; | ||
|
||
namespace osu.Game.Tests.Visual.Editor | ||
{ | ||
[TestFixture] | ||
public class TestSceneTimelineTickDisplay : TimelineTestScene | ||
{ | ||
public override Drawable CreateTestComponent() => new TimelineTickDisplay(); | ||
|
||
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
BeatDivisor.Value = 4; | ||
|
||
Add(new BeatDivisorControl(BeatDivisor) | ||
{ | ||
Anchor = Anchor.TopRight, | ||
Origin = Anchor.TopRight, | ||
Margin = new MarginPadding(30), | ||
Size = new Vector2(90) | ||
}); | ||
} | ||
} | ||
} |
Oops, something went wrong.