mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Fix storyboard samples rate not adjusted from actual gameplay mods
This commit is contained in:
parent
e14a35b469
commit
cbb8dc2891
@ -94,7 +94,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
var decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = true };
|
||||
storyboardContainer.Clock = decoupledClock;
|
||||
|
||||
storyboard = working.Storyboard.CreateDrawable(Beatmap.Value);
|
||||
storyboard = working.Storyboard.CreateDrawable(SelectedMods.Value);
|
||||
storyboard.Passing = false;
|
||||
|
||||
storyboardContainer.Add(storyboard);
|
||||
@ -118,7 +118,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
sb = decoder.Decode(bfr);
|
||||
}
|
||||
|
||||
storyboard = sb.CreateDrawable(Beatmap.Value);
|
||||
storyboard = sb.CreateDrawable(SelectedMods.Value);
|
||||
|
||||
storyboardContainer.Add(storyboard);
|
||||
decoupledClock.ChangeSource(Beatmap.Value.Track);
|
||||
|
@ -3,12 +3,15 @@
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Storyboards.Drawables;
|
||||
|
||||
namespace osu.Game.Graphics.Backgrounds
|
||||
@ -20,6 +23,9 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
[Resolved(CanBeNull = true)]
|
||||
private MusicController? musicController { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private IBindable<IReadOnlyList<Mod>> mods { get; set; } = null!;
|
||||
|
||||
public BeatmapBackgroundWithStoryboard(WorkingBeatmap beatmap, string fallbackTextureName = "Backgrounds/bg1")
|
||||
: base(beatmap, fallbackTextureName)
|
||||
{
|
||||
@ -39,7 +45,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Volume = { Value = 0 },
|
||||
Child = new DrawableStoryboard(Beatmap.Storyboard) { Clock = storyboardClock }
|
||||
Child = new DrawableStoryboard(Beatmap.Storyboard, mods.Value) { Clock = storyboardClock }
|
||||
}, AddInternal);
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,12 @@
|
||||
// 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.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Storyboards;
|
||||
using osu.Game.Storyboards.Drawables;
|
||||
|
||||
@ -18,6 +20,8 @@ namespace osu.Game.Screens.Play
|
||||
public Container OverlayLayerContainer { get; private set; }
|
||||
|
||||
private readonly Storyboard storyboard;
|
||||
private readonly IReadOnlyList<Mod> mods;
|
||||
|
||||
private DrawableStoryboard drawableStoryboard;
|
||||
|
||||
/// <summary>
|
||||
@ -28,9 +32,10 @@ namespace osu.Game.Screens.Play
|
||||
/// </remarks>
|
||||
public IBindable<bool> HasStoryboardEnded = new BindableBool(true);
|
||||
|
||||
public DimmableStoryboard(Storyboard storyboard)
|
||||
public DimmableStoryboard(Storyboard storyboard, IReadOnlyList<Mod> mods)
|
||||
{
|
||||
this.storyboard = storyboard;
|
||||
this.mods = mods;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -57,7 +62,7 @@ namespace osu.Game.Screens.Play
|
||||
if (!ShowStoryboard.Value && !IgnoreUserSettings.Value)
|
||||
return;
|
||||
|
||||
drawableStoryboard = storyboard.CreateDrawable();
|
||||
drawableStoryboard = storyboard.CreateDrawable(mods);
|
||||
HasStoryboardEnded.BindTo(drawableStoryboard.HasStoryboardEnded);
|
||||
|
||||
if (async)
|
||||
|
@ -355,7 +355,7 @@ namespace osu.Game.Screens.Play
|
||||
protected virtual GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart) => new MasterGameplayClockContainer(beatmap, gameplayStart);
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -1,6 +1,8 @@
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using osuTK;
|
||||
@ -11,6 +13,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Stores;
|
||||
|
||||
@ -50,14 +53,18 @@ namespace osu.Game.Storyboards.Drawables
|
||||
|
||||
private double? lastEventEndTime;
|
||||
|
||||
[Cached(typeof(IReadOnlyList<Mod>))]
|
||||
public IReadOnlyList<Mod> Mods { get; }
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
|
||||
dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||
|
||||
public DrawableStoryboard(Storyboard storyboard)
|
||||
public DrawableStoryboard(Storyboard storyboard, IReadOnlyList<Mod> mods)
|
||||
{
|
||||
Storyboard = storyboard;
|
||||
Mods = mods ?? Array.Empty<Mod>();
|
||||
|
||||
Size = new Vector2(640, 480);
|
||||
|
||||
|
@ -28,17 +28,20 @@ namespace osu.Game.Storyboards.Drawables
|
||||
LifetimeStart = sampleInfo.StartTime;
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
private IBindable<IReadOnlyList<Mod>> mods { get; set; }
|
||||
[Resolved(CanBeNull = true)]
|
||||
private IReadOnlyList<Mod> mods { get; set; }
|
||||
|
||||
protected override void SkinChanged(ISkinSource skin)
|
||||
{
|
||||
base.SkinChanged(skin);
|
||||
|
||||
foreach (var mod in mods.Value.OfType<IApplicableToSample>())
|
||||
if (mods != null)
|
||||
{
|
||||
foreach (var sample in DrawableSamples)
|
||||
mod.ApplyToSample(sample);
|
||||
foreach (var mod in mods.OfType<IApplicableToSample>())
|
||||
{
|
||||
foreach (var sample in DrawableSamples)
|
||||
mod.ApplyToSample(sample);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Game.Storyboards.Drawables;
|
||||
|
||||
@ -90,8 +91,8 @@ namespace osu.Game.Storyboards
|
||||
}
|
||||
}
|
||||
|
||||
public DrawableStoryboard CreateDrawable(IWorkingBeatmap working = null) =>
|
||||
new DrawableStoryboard(this);
|
||||
public DrawableStoryboard CreateDrawable(IReadOnlyList<Mod> mods = null) =>
|
||||
new DrawableStoryboard(this, mods);
|
||||
|
||||
public Drawable CreateSpriteFromResourcePath(string path, TextureStore textureStore)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user