1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-08 00:37:40 +08:00

Update the pauseLoop sample instantly on skin change

This commit is contained in:
Terochi 2023-03-15 09:05:34 +01:00
parent a9c349fa6d
commit b0f1a69523
4 changed files with 14 additions and 3 deletions

View File

@ -28,6 +28,7 @@ namespace osu.Game.Screens.Play
private SkinnableSound pauseLoop; private SkinnableSound pauseLoop;
public void FlushPendingSkinChanges() => pauseLoop.FlushPendingSkinChanges();
protected override Action BackAction => () => InternalButtons.First().TriggerClick(); protected override Action BackAction => () => InternalButtons.First().TriggerClick();
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -316,6 +316,11 @@ namespace osu.Game.Screens.Play
// we may want to limit this in the future to disallow rulesets from outright replacing elements the user expects to be there. // we may want to limit this in the future to disallow rulesets from outright replacing elements the user expects to be there.
failAnimationLayer.Add(createOverlayComponents(Beatmap.Value)); failAnimationLayer.Add(createOverlayComponents(Beatmap.Value));
rulesetSkinProvider.SourceChanged += () =>
{
PauseOverlay.FlushPendingSkinChanges();
};
if (!DrawableRuleset.AllowGameplayOverlays) if (!DrawableRuleset.AllowGameplayOverlays)
{ {
HUDOverlay.ShowHud.Value = false; HUDOverlay.ShowHud.Value = false;

View File

@ -42,7 +42,7 @@ namespace osu.Game.Skinning
pendingSkinChange = Scheduler.Add(skinChanged); pendingSkinChange = Scheduler.Add(skinChanged);
} }
public void FlushPendingSkinChanges() public virtual void FlushPendingSkinChanges()
{ {
if (pendingSkinChange == null) if (pendingSkinChange == null)
return; return;

View File

@ -110,6 +110,13 @@ namespace osu.Game.Skinning
} }
} }
public override void FlushPendingSkinChanges()
{
base.FlushPendingSkinChanges();
samplesContainer.ForEach(c => c.FlushPendingSkinChanges());
}
/// <summary> /// <summary>
/// Plays the samples. /// Plays the samples.
/// </summary> /// </summary>
@ -119,8 +126,6 @@ namespace osu.Game.Skinning
samplesContainer.ForEach(c => samplesContainer.ForEach(c =>
{ {
c.FlushPendingSkinChanges();
if (PlayWhenZeroVolume || c.AggregateVolume.Value > 0) if (PlayWhenZeroVolume || c.AggregateVolume.Value > 0)
{ {
c.Stop(); c.Stop();