1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 17:23:22 +08:00

Drank some coffee and figured out the fix

This commit is contained in:
Terochi 2023-03-15 10:49:59 +01:00
parent b0f1a69523
commit edc6314634
5 changed files with 13 additions and 22 deletions

View File

@ -28,7 +28,6 @@ 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,11 +316,6 @@ 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

@ -132,6 +132,8 @@ namespace osu.Game.Skinning
if (Sample == null) if (Sample == null)
return; return;
FlushPendingSkinChanges();
activeChannel = Sample.GetChannel(); activeChannel = Sample.GetChannel();
activeChannel.Looping = Looping; activeChannel.Looping = Looping;
activeChannel.Play(); activeChannel.Play();

View File

@ -27,6 +27,15 @@ namespace osu.Game.Skinning
/// </summary> /// </summary>
protected ISkinSource CurrentSkin { get; private set; } = null!; protected ISkinSource CurrentSkin { get; private set; } = null!;
protected void FlushPendingSkinChanges()
{
if (pendingSkinChange == null)
return;
pendingSkinChange.RunTask();
pendingSkinChange = null;
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ISkinSource source) private void load(ISkinSource source)
{ {
@ -42,15 +51,6 @@ namespace osu.Game.Skinning
pendingSkinChange = Scheduler.Add(skinChanged); pendingSkinChange = Scheduler.Add(skinChanged);
} }
public virtual void FlushPendingSkinChanges()
{
if (pendingSkinChange == null)
return;
pendingSkinChange.RunTask();
pendingSkinChange = null;
}
protected override void LoadAsyncComplete() protected override void LoadAsyncComplete()
{ {
base.LoadAsyncComplete(); base.LoadAsyncComplete();
@ -61,6 +61,8 @@ namespace osu.Game.Skinning
{ {
SkinChanged(CurrentSkin); SkinChanged(CurrentSkin);
OnSkinChanged?.Invoke(); OnSkinChanged?.Invoke();
pendingSkinChange = null;
} }
/// <summary> /// <summary>

View File

@ -110,13 +110,6 @@ 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>