mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 20:22:55 +08:00
Update TestSceneStoryboardWithOutro.cs
- Construct storyboard in CreateWorkingBeatmap() - Use GameplayClockContainer.GameplayClock.CurrentTime - Remove unnecessary lines
This commit is contained in:
parent
5a015290b9
commit
7f5b1e84a1
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
@ -13,7 +12,6 @@ using osu.Game.Rulesets;
|
|||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.Play;
|
|
||||||
using osu.Game.Screens.Ranking;
|
using osu.Game.Screens.Ranking;
|
||||||
using osu.Game.Storyboards;
|
using osu.Game.Storyboards;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -24,28 +22,14 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
protected new OutroPlayer Player => (OutroPlayer)base.Player;
|
protected new OutroPlayer Player => (OutroPlayer)base.Player;
|
||||||
|
|
||||||
private Storyboard storyboard;
|
|
||||||
|
|
||||||
private const double storyboard_duration = 2000;
|
private const double storyboard_duration = 2000;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuConfigManager config)
|
|
||||||
{
|
|
||||||
config.SetValue(OsuSetting.ShowStoryboard, true);
|
|
||||||
storyboard = new Storyboard();
|
|
||||||
var sprite = new StoryboardSprite("unknown", Anchor.TopLeft, Vector2.Zero);
|
|
||||||
sprite.TimelineGroup.Alpha.Add(Easing.None, 0, storyboard_duration, 1, 0);
|
|
||||||
storyboard.GetLayer("Background").Add(sprite);
|
|
||||||
}
|
|
||||||
|
|
||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
public override void SetUpSteps()
|
public override void SetUpSteps()
|
||||||
{
|
{
|
||||||
base.SetUpSteps();
|
base.SetUpSteps();
|
||||||
AddStep("ignore user settings", () =>
|
AddStep("enable storyboard", () => LocalConfig.SetValue(OsuSetting.ShowStoryboard, true));
|
||||||
{
|
AddStep("set dim level to 0", () => LocalConfig.SetValue<double>(OsuSetting.DimLevel, 0));
|
||||||
Player.DimmableStoryboard.IgnoreUserSettings.Value = true;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -61,7 +45,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
public void TestStoryboardNoSkipOutro()
|
public void TestStoryboardNoSkipOutro()
|
||||||
{
|
{
|
||||||
AddUntilStep("storyboard loaded", () => Player.Beatmap.Value.StoryboardLoaded);
|
AddUntilStep("storyboard loaded", () => Player.Beatmap.Value.StoryboardLoaded);
|
||||||
AddUntilStep("storyboard ends", () => Player.HUDOverlay.Progress.ReferenceClock.CurrentTime >= storyboard_duration);
|
AddUntilStep("storyboard ends", () => Player.GameplayClockContainer.GameplayClock.CurrentTime >= storyboard_duration);
|
||||||
AddUntilStep("wait for score shown", () => Player.IsScoreShown);
|
AddUntilStep("wait for score shown", () => Player.IsScoreShown);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,8 +71,18 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
return beatmap;
|
return beatmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null) =>
|
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
|
||||||
new ClockBackedTestWorkingBeatmap(beatmap, storyboard ?? this.storyboard, Clock, Audio);
|
{
|
||||||
|
if (storyboard == null)
|
||||||
|
{
|
||||||
|
storyboard = new Storyboard();
|
||||||
|
var sprite = new StoryboardSprite("unknown", Anchor.TopLeft, Vector2.Zero);
|
||||||
|
sprite.TimelineGroup.Alpha.Add(Easing.None, 0, storyboard_duration, 1, 0);
|
||||||
|
storyboard.GetLayer("Background").Add(sprite);
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.CreateWorkingBeatmap(beatmap, storyboard);
|
||||||
|
}
|
||||||
|
|
||||||
protected class OutroPlayer : TestPlayer
|
protected class OutroPlayer : TestPlayer
|
||||||
{
|
{
|
||||||
@ -96,8 +90,6 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
public bool IsScoreShown => !this.IsCurrentScreen() && this.GetChildScreen() is ResultsScreen;
|
public bool IsScoreShown => !this.IsCurrentScreen() && this.GetChildScreen() is ResultsScreen;
|
||||||
|
|
||||||
public new DimmableStoryboard DimmableStoryboard => base.DimmableStoryboard;
|
|
||||||
|
|
||||||
public OutroPlayer()
|
public OutroPlayer()
|
||||||
: base(false)
|
: base(false)
|
||||||
{
|
{
|
||||||
@ -105,7 +97,6 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
protected override Task ImportScore(Score score)
|
protected override Task ImportScore(Score score)
|
||||||
{
|
{
|
||||||
// avoid database errors from trying to store the score
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user