mirror of https://github.com/ppy/osu
Add xmldoc and throw a local exception on null background
This commit is contained in:
parent
11a0c637bc
commit
e9d4e4d1d5
|
@ -34,6 +34,10 @@ protected override bool OnKeyDown(KeyDownEvent e)
|
|||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply arbitrary changes to this background in a thread safe manner.
|
||||
/// </summary>
|
||||
/// <param name="action">The operation to perform.</param>
|
||||
public void ApplyToBackground(Action<BackgroundScreen> action) => Schedule(() => action.Invoke(this));
|
||||
|
||||
protected override void Update()
|
||||
|
|
|
@ -115,8 +115,6 @@ private void createDependencies(IReadOnlyDependencyContainer dependencies)
|
|||
Mods = screenDependencies.Mods;
|
||||
}
|
||||
|
||||
public void ApplyToBackground(Action<BackgroundScreen> action) => background.ApplyToBackground(action);
|
||||
|
||||
/// <summary>
|
||||
/// The background created and owned by this screen. May be null if the background didn't change.
|
||||
/// </summary>
|
||||
|
@ -148,6 +146,18 @@ private void load(OsuGame osu, AudioManager audio)
|
|||
Activity.Value ??= InitialActivity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply arbitrary changes to the current background screen in a thread safe manner.
|
||||
/// </summary>
|
||||
/// <param name="action">The operation to perform.</param>
|
||||
public void ApplyToBackground(Action<BackgroundScreen> action)
|
||||
{
|
||||
if (background == null)
|
||||
throw new InvalidOperationException("Attempted to apply to background before screen is pushed");
|
||||
|
||||
background.ApplyToBackground(action);
|
||||
}
|
||||
|
||||
public override void OnResuming(IScreen last)
|
||||
{
|
||||
if (PlayResumeSound)
|
||||
|
|
Loading…
Reference in New Issue