mirror of
https://github.com/osukey/osukey.git
synced 2025-06-09 05:19:11 +09:00
Merge pull request #17059 from frenzibyte/fix-storyboard-sample-rate
Fix storyboard samples rate not adjusted from actual gameplay mods
This commit is contained in:
commit
3e73b8c78a
@ -1,29 +1,23 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Graphics.Audio;
|
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Utils;
|
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Mods;
|
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
@ -118,59 +112,6 @@ namespace osu.Game.Tests.Gameplay
|
|||||||
AddUntilStep("sample has lifetime end", () => sample.LifetimeEnd < double.MaxValue);
|
AddUntilStep("sample has lifetime end", () => sample.LifetimeEnd < double.MaxValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase(typeof(OsuModDoubleTime), 1.5)]
|
|
||||||
[TestCase(typeof(OsuModHalfTime), 0.75)]
|
|
||||||
[TestCase(typeof(ModWindUp), 1.5)]
|
|
||||||
[TestCase(typeof(ModWindDown), 0.75)]
|
|
||||||
[TestCase(typeof(OsuModDoubleTime), 2)]
|
|
||||||
[TestCase(typeof(OsuModHalfTime), 0.5)]
|
|
||||||
[TestCase(typeof(ModWindUp), 2)]
|
|
||||||
[TestCase(typeof(ModWindDown), 0.5)]
|
|
||||||
public void TestSamplePlaybackWithRateMods(Type expectedMod, double expectedRate)
|
|
||||||
{
|
|
||||||
GameplayClockContainer gameplayContainer = null;
|
|
||||||
StoryboardSampleInfo sampleInfo = null;
|
|
||||||
TestDrawableStoryboardSample sample = null;
|
|
||||||
|
|
||||||
Mod testedMod = Activator.CreateInstance(expectedMod) as Mod;
|
|
||||||
|
|
||||||
switch (testedMod)
|
|
||||||
{
|
|
||||||
case ModRateAdjust m:
|
|
||||||
m.SpeedChange.Value = expectedRate;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ModTimeRamp m:
|
|
||||||
m.FinalRate.Value = m.InitialRate.Value = expectedRate;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddStep("setup storyboard sample", () =>
|
|
||||||
{
|
|
||||||
Beatmap.Value = new TestCustomSkinWorkingBeatmap(new OsuRuleset().RulesetInfo, this);
|
|
||||||
SelectedMods.Value = new[] { testedMod };
|
|
||||||
|
|
||||||
var beatmapSkinSourceContainer = new BeatmapSkinProvidingContainer(Beatmap.Value.Skin);
|
|
||||||
|
|
||||||
Add(gameplayContainer = new MasterGameplayClockContainer(Beatmap.Value, 0)
|
|
||||||
{
|
|
||||||
Child = beatmapSkinSourceContainer
|
|
||||||
});
|
|
||||||
|
|
||||||
beatmapSkinSourceContainer.Add(sample = new TestDrawableStoryboardSample(sampleInfo = new StoryboardSampleInfo("test-sample", 1, 1))
|
|
||||||
{
|
|
||||||
Clock = gameplayContainer.GameplayClock
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
AddStep("start", () => gameplayContainer.Start());
|
|
||||||
|
|
||||||
AddAssert("sample playback rate matches mod rates", () =>
|
|
||||||
testedMod != null && Precision.AlmostEquals(
|
|
||||||
sample.ChildrenOfType<DrawableSample>().First().AggregateFrequency.Value,
|
|
||||||
((IApplicableToRate)testedMod).ApplyToRate(sampleInfo.StartTime)));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestSamplePlaybackWithBeatmapHitsoundsOff()
|
public void TestSamplePlaybackWithBeatmapHitsoundsOff()
|
||||||
{
|
{
|
||||||
|
@ -94,7 +94,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
var decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = true };
|
var decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = true };
|
||||||
storyboardContainer.Clock = decoupledClock;
|
storyboardContainer.Clock = decoupledClock;
|
||||||
|
|
||||||
storyboard = working.Storyboard.CreateDrawable(Beatmap.Value);
|
storyboard = working.Storyboard.CreateDrawable(SelectedMods.Value);
|
||||||
storyboard.Passing = false;
|
storyboard.Passing = false;
|
||||||
|
|
||||||
storyboardContainer.Add(storyboard);
|
storyboardContainer.Add(storyboard);
|
||||||
@ -118,7 +118,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
sb = decoder.Decode(bfr);
|
sb = decoder.Decode(bfr);
|
||||||
}
|
}
|
||||||
|
|
||||||
storyboard = sb.CreateDrawable(Beatmap.Value);
|
storyboard = sb.CreateDrawable(SelectedMods.Value);
|
||||||
|
|
||||||
storyboardContainer.Add(storyboard);
|
storyboardContainer.Add(storyboard);
|
||||||
decoupledClock.ChangeSource(Beatmap.Value.Track);
|
decoupledClock.ChangeSource(Beatmap.Value.Track);
|
||||||
|
@ -1,17 +1,23 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions.ObjectExtensions;
|
||||||
|
using osu.Framework.Graphics.Audio;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
using osu.Game.Storyboards;
|
using osu.Game.Storyboards;
|
||||||
using osu.Game.Storyboards.Drawables;
|
using osu.Game.Storyboards.Drawables;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Gameplay
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
{
|
{
|
||||||
@ -19,6 +25,10 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
private Storyboard storyboard;
|
private Storyboard storyboard;
|
||||||
|
|
||||||
|
private IReadOnlyList<Mod> storyboardMods;
|
||||||
|
|
||||||
|
protected override bool HasCustomSteps => true;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
@ -31,42 +41,107 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
backgroundLayer.Add(new StoryboardSampleInfo("Intro/welcome.mp3", time: 0, volume: 20));
|
backgroundLayer.Add(new StoryboardSampleInfo("Intro/welcome.mp3", time: 0, volume: 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp() => storyboardMods = Array.Empty<Mod>();
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestStoryboardSamplesStopDuringPause()
|
public void TestStoryboardSamplesStopDuringPause()
|
||||||
{
|
{
|
||||||
checkForFirstSamplePlayback();
|
createPlayerTest();
|
||||||
|
|
||||||
AddStep("player paused", () => Player.Pause());
|
AddStep("player paused", () => Player.Pause());
|
||||||
AddAssert("player is currently paused", () => Player.GameplayClockContainer.IsPaused.Value);
|
AddAssert("player is currently paused", () => Player.GameplayClockContainer.IsPaused.Value);
|
||||||
AddAssert("all storyboard samples stopped immediately", () => allStoryboardSamples.All(sound => !sound.IsPlaying));
|
allStoryboardSamplesStopped();
|
||||||
|
|
||||||
AddStep("player resume", () => Player.Resume());
|
AddStep("player resume", () => Player.Resume());
|
||||||
AddUntilStep("any storyboard samples playing after resume", () => allStoryboardSamples.Any(sound => sound.IsPlaying));
|
waitUntilStoryboardSamplesPlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestStoryboardSamplesStopOnSkip()
|
public void TestStoryboardSamplesStopOnSkip()
|
||||||
{
|
{
|
||||||
checkForFirstSamplePlayback();
|
createPlayerTest();
|
||||||
|
|
||||||
AddStep("skip intro", () => InputManager.Key(osuTK.Input.Key.Space));
|
skipIntro();
|
||||||
AddAssert("all storyboard samples stopped immediately", () => allStoryboardSamples.All(sound => !sound.IsPlaying));
|
allStoryboardSamplesStopped();
|
||||||
|
|
||||||
AddUntilStep("any storyboard samples playing after skip", () => allStoryboardSamples.Any(sound => sound.IsPlaying));
|
waitUntilStoryboardSamplesPlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkForFirstSamplePlayback()
|
[TestCase(typeof(OsuModDoubleTime), 1.5)]
|
||||||
|
[TestCase(typeof(OsuModDoubleTime), 2)]
|
||||||
|
[TestCase(typeof(OsuModHalfTime), 0.75)]
|
||||||
|
[TestCase(typeof(OsuModHalfTime), 0.5)]
|
||||||
|
public void TestStoryboardSamplesPlaybackWithRateAdjustMods(Type expectedMod, double expectedRate)
|
||||||
{
|
{
|
||||||
AddAssert("storyboard loaded", () => Player.Beatmap.Value.Storyboard != null);
|
AddStep("setup mod", () =>
|
||||||
AddUntilStep("any storyboard samples playing", () => allStoryboardSamples.Any(sound => sound.IsPlaying));
|
{
|
||||||
|
ModRateAdjust testedMod = (ModRateAdjust)Activator.CreateInstance(expectedMod).AsNonNull();
|
||||||
|
testedMod.SpeedChange.Value = expectedRate;
|
||||||
|
storyboardMods = new[] { testedMod };
|
||||||
|
});
|
||||||
|
|
||||||
|
createPlayerTest();
|
||||||
|
skipIntro();
|
||||||
|
|
||||||
|
AddAssert("sample playback rate matches mod rates", () => allStoryboardSamples.All(sound =>
|
||||||
|
sound.ChildrenOfType<DrawableSample>().First().AggregateFrequency.Value == expectedRate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase(typeof(ModWindUp), 0.5, 2)]
|
||||||
|
[TestCase(typeof(ModWindUp), 1.51, 2)]
|
||||||
|
[TestCase(typeof(ModWindDown), 2, 0.5)]
|
||||||
|
[TestCase(typeof(ModWindDown), 0.99, 0.5)]
|
||||||
|
public void TestStoryboardSamplesPlaybackWithTimeRampMods(Type expectedMod, double initialRate, double finalRate)
|
||||||
|
{
|
||||||
|
AddStep("setup mod", () =>
|
||||||
|
{
|
||||||
|
ModTimeRamp testedMod = (ModTimeRamp)Activator.CreateInstance(expectedMod).AsNonNull();
|
||||||
|
testedMod.InitialRate.Value = initialRate;
|
||||||
|
testedMod.FinalRate.Value = finalRate;
|
||||||
|
storyboardMods = new[] { testedMod };
|
||||||
|
});
|
||||||
|
|
||||||
|
createPlayerTest();
|
||||||
|
skipIntro();
|
||||||
|
|
||||||
|
ModTimeRamp gameplayMod = null;
|
||||||
|
|
||||||
|
AddUntilStep("mod speed change updated", () =>
|
||||||
|
{
|
||||||
|
gameplayMod = Player.GameplayState.Mods.OfType<ModTimeRamp>().Single();
|
||||||
|
return gameplayMod.SpeedChange.Value != initialRate;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("sample playback rate matches mod rates", () => allStoryboardSamples.All(sound =>
|
||||||
|
sound.ChildrenOfType<DrawableSample>().First().AggregateFrequency.Value == gameplayMod.SpeedChange.Value));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createPlayerTest()
|
||||||
|
{
|
||||||
|
CreateTest(null);
|
||||||
|
|
||||||
|
AddAssert("storyboard loaded", () => Player.Beatmap.Value.Storyboard != null);
|
||||||
|
waitUntilStoryboardSamplesPlay();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void waitUntilStoryboardSamplesPlay() => AddUntilStep("any storyboard samples playing", () => allStoryboardSamples.Any(sound => sound.IsPlaying));
|
||||||
|
|
||||||
|
private void allStoryboardSamplesStopped() => AddAssert("all storyboard samples stopped immediately", () => allStoryboardSamples.All(sound => !sound.IsPlaying));
|
||||||
|
|
||||||
|
private void skipIntro() => AddStep("skip intro", () => InputManager.Key(Key.Space));
|
||||||
|
|
||||||
private IEnumerable<DrawableStoryboardSample> allStoryboardSamples => Player.ChildrenOfType<DrawableStoryboardSample>();
|
private IEnumerable<DrawableStoryboardSample> allStoryboardSamples => Player.ChildrenOfType<DrawableStoryboardSample>();
|
||||||
|
|
||||||
protected override bool AllowFail => false;
|
protected override bool AllowFail => false;
|
||||||
|
|
||||||
|
protected override TestPlayer CreatePlayer(Ruleset ruleset)
|
||||||
|
{
|
||||||
|
SelectedMods.Value = SelectedMods.Value.Concat(storyboardMods).ToArray();
|
||||||
|
return new TestPlayer(true, false);
|
||||||
|
}
|
||||||
|
|
||||||
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
|
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
|
||||||
protected override TestPlayer CreatePlayer(Ruleset ruleset) => new TestPlayer(true, false);
|
|
||||||
|
|
||||||
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);
|
new ClockBackedTestWorkingBeatmap(beatmap, storyboard ?? this.storyboard, Clock, Audio);
|
||||||
|
@ -3,12 +3,15 @@
|
|||||||
|
|
||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Storyboards.Drawables;
|
using osu.Game.Storyboards.Drawables;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Backgrounds
|
namespace osu.Game.Graphics.Backgrounds
|
||||||
@ -20,6 +23,9 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private MusicController? musicController { get; set; }
|
private MusicController? musicController { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IBindable<IReadOnlyList<Mod>> mods { get; set; } = null!;
|
||||||
|
|
||||||
public BeatmapBackgroundWithStoryboard(WorkingBeatmap beatmap, string fallbackTextureName = "Backgrounds/bg1")
|
public BeatmapBackgroundWithStoryboard(WorkingBeatmap beatmap, string fallbackTextureName = "Backgrounds/bg1")
|
||||||
: base(beatmap, fallbackTextureName)
|
: base(beatmap, fallbackTextureName)
|
||||||
{
|
{
|
||||||
@ -39,7 +45,7 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Volume = { Value = 0 },
|
Volume = { Value = 0 },
|
||||||
Child = new DrawableStoryboard(Beatmap.Storyboard) { Clock = storyboardClock }
|
Child = new DrawableStoryboard(Beatmap.Storyboard, mods.Value) { Clock = storyboardClock }
|
||||||
}, AddInternal);
|
}, AddInternal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Storyboards;
|
using osu.Game.Storyboards;
|
||||||
using osu.Game.Storyboards.Drawables;
|
using osu.Game.Storyboards.Drawables;
|
||||||
|
|
||||||
@ -18,6 +20,8 @@ namespace osu.Game.Screens.Play
|
|||||||
public Container OverlayLayerContainer { get; private set; }
|
public Container OverlayLayerContainer { get; private set; }
|
||||||
|
|
||||||
private readonly Storyboard storyboard;
|
private readonly Storyboard storyboard;
|
||||||
|
private readonly IReadOnlyList<Mod> mods;
|
||||||
|
|
||||||
private DrawableStoryboard drawableStoryboard;
|
private DrawableStoryboard drawableStoryboard;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -28,9 +32,10 @@ namespace osu.Game.Screens.Play
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
public IBindable<bool> HasStoryboardEnded = new BindableBool(true);
|
public IBindable<bool> HasStoryboardEnded = new BindableBool(true);
|
||||||
|
|
||||||
public DimmableStoryboard(Storyboard storyboard)
|
public DimmableStoryboard(Storyboard storyboard, IReadOnlyList<Mod> mods)
|
||||||
{
|
{
|
||||||
this.storyboard = storyboard;
|
this.storyboard = storyboard;
|
||||||
|
this.mods = mods;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -57,7 +62,7 @@ namespace osu.Game.Screens.Play
|
|||||||
if (!ShowStoryboard.Value && !IgnoreUserSettings.Value)
|
if (!ShowStoryboard.Value && !IgnoreUserSettings.Value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
drawableStoryboard = storyboard.CreateDrawable();
|
drawableStoryboard = storyboard.CreateDrawable(mods);
|
||||||
HasStoryboardEnded.BindTo(drawableStoryboard.HasStoryboardEnded);
|
HasStoryboardEnded.BindTo(drawableStoryboard.HasStoryboardEnded);
|
||||||
|
|
||||||
if (async)
|
if (async)
|
||||||
|
@ -359,7 +359,7 @@ namespace osu.Game.Screens.Play
|
|||||||
protected virtual GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart) => new MasterGameplayClockContainer(beatmap, gameplayStart);
|
protected virtual GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart) => new MasterGameplayClockContainer(beatmap, gameplayStart);
|
||||||
|
|
||||||
private Drawable createUnderlayComponents() =>
|
private Drawable createUnderlayComponents() =>
|
||||||
DimmableStoryboard = new DimmableStoryboard(Beatmap.Value.Storyboard) { RelativeSizeAxes = Axes.Both };
|
DimmableStoryboard = new DimmableStoryboard(Beatmap.Value.Storyboard, GameplayState.Mods) { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
private Drawable createGameplayComponents(IWorkingBeatmap working) => new ScalingContainer(ScalingMode.Gameplay)
|
private Drawable createGameplayComponents(IWorkingBeatmap working) => new ScalingContainer(ScalingMode.Gameplay)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -11,6 +13,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Stores;
|
using osu.Game.Stores;
|
||||||
|
|
||||||
@ -50,14 +53,18 @@ namespace osu.Game.Storyboards.Drawables
|
|||||||
|
|
||||||
private double? lastEventEndTime;
|
private double? lastEventEndTime;
|
||||||
|
|
||||||
|
[Cached(typeof(IReadOnlyList<Mod>))]
|
||||||
|
public IReadOnlyList<Mod> Mods { get; }
|
||||||
|
|
||||||
private DependencyContainer dependencies;
|
private DependencyContainer dependencies;
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
|
||||||
dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
|
|
||||||
public DrawableStoryboard(Storyboard storyboard)
|
public DrawableStoryboard(Storyboard storyboard, IReadOnlyList<Mod> mods = null)
|
||||||
{
|
{
|
||||||
Storyboard = storyboard;
|
Storyboard = storyboard;
|
||||||
|
Mods = mods ?? Array.Empty<Mod>();
|
||||||
|
|
||||||
Size = new Vector2(640, 480);
|
Size = new Vector2(640, 480);
|
||||||
|
|
||||||
|
@ -28,17 +28,20 @@ namespace osu.Game.Storyboards.Drawables
|
|||||||
LifetimeStart = sampleInfo.StartTime;
|
LifetimeStart = sampleInfo.StartTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Resolved]
|
[Resolved(CanBeNull = true)]
|
||||||
private IBindable<IReadOnlyList<Mod>> mods { get; set; }
|
private IReadOnlyList<Mod> mods { get; set; }
|
||||||
|
|
||||||
protected override void SkinChanged(ISkinSource skin)
|
protected override void SkinChanged(ISkinSource skin)
|
||||||
{
|
{
|
||||||
base.SkinChanged(skin);
|
base.SkinChanged(skin);
|
||||||
|
|
||||||
foreach (var mod in mods.Value.OfType<IApplicableToSample>())
|
if (mods != null)
|
||||||
{
|
{
|
||||||
foreach (var sample in DrawableSamples)
|
foreach (var mod in mods.OfType<IApplicableToSample>())
|
||||||
mod.ApplyToSample(sample);
|
{
|
||||||
|
foreach (var sample in DrawableSamples)
|
||||||
|
mod.ApplyToSample(sample);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Extensions;
|
using osu.Game.Extensions;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osu.Game.Storyboards.Drawables;
|
using osu.Game.Storyboards.Drawables;
|
||||||
|
|
||||||
@ -90,8 +91,8 @@ namespace osu.Game.Storyboards
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DrawableStoryboard CreateDrawable(IWorkingBeatmap working = null) =>
|
public DrawableStoryboard CreateDrawable(IReadOnlyList<Mod> mods = null) =>
|
||||||
new DrawableStoryboard(this);
|
new DrawableStoryboard(this, mods);
|
||||||
|
|
||||||
public Drawable CreateSpriteFromResourcePath(string path, TextureStore textureStore)
|
public Drawable CreateSpriteFromResourcePath(string path, TextureStore textureStore)
|
||||||
{
|
{
|
||||||
|
@ -26,9 +26,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
public new DrawableRuleset DrawableRuleset => base.DrawableRuleset;
|
public new DrawableRuleset DrawableRuleset => base.DrawableRuleset;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Mods from *player* (not OsuScreen).
|
|
||||||
/// </summary>
|
|
||||||
public new Bindable<IReadOnlyList<Mod>> Mods => base.Mods;
|
public new Bindable<IReadOnlyList<Mod>> Mods => base.Mods;
|
||||||
|
|
||||||
public new HUDOverlay HUDOverlay => base.HUDOverlay;
|
public new HUDOverlay HUDOverlay => base.HUDOverlay;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user