mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 03:22:57 +08:00
Simplify condition from two to one operand
This commit is contained in:
parent
e0f8f6a23f
commit
b692abd3c2
@ -18,7 +18,13 @@ namespace osu.Game.Skinning
|
||||
|
||||
protected bool RequestedPlaying { get; private set; }
|
||||
|
||||
protected virtual bool AllowNonLoopingCutOff => false;
|
||||
/// <summary>
|
||||
/// Whether this <see cref="PausableSkinnableSound"/> is affected by
|
||||
/// a higher-level <see cref="ISamplePlaybackDisabler"/>'s state changes.
|
||||
/// By default only looping samples are started/stopped on sample disable
|
||||
/// to prevent one-time samples from cutting off abruptly.
|
||||
/// </summary>
|
||||
protected virtual bool AffectedBySamplePlaybackDisable => Looping;
|
||||
|
||||
public PausableSkinnableSound()
|
||||
{
|
||||
@ -48,10 +54,7 @@ namespace osu.Game.Skinning
|
||||
samplePlaybackDisabled.BindValueChanged(disabled =>
|
||||
{
|
||||
if (!RequestedPlaying) return;
|
||||
|
||||
// if the sample is non-looping, and non-looping cut off is not allowed,
|
||||
// let the sample play out to completion (sounds better than abruptly cutting off).
|
||||
if (!Looping && !AllowNonLoopingCutOff) return;
|
||||
if (!AffectedBySamplePlaybackDisable) return;
|
||||
|
||||
cancelPendingStart();
|
||||
|
||||
|
@ -21,7 +21,11 @@ namespace osu.Game.Storyboards.Drawables
|
||||
|
||||
public override bool RemoveWhenNotAlive => false;
|
||||
|
||||
protected override bool AllowNonLoopingCutOff => true;
|
||||
/// <remarks>
|
||||
/// Contrary to <see cref="PausableSkinnableSound"/>, all <see cref="DrawableStoryboardSample"/>s are affected
|
||||
/// by sample disables, as they are oftentimes longer-running sound effects. This also matches stable behaviour.
|
||||
/// </remarks>
|
||||
protected override bool AffectedBySamplePlaybackDisable => true;
|
||||
|
||||
public DrawableStoryboardSample(StoryboardSampleInfo sampleInfo)
|
||||
: base(sampleInfo)
|
||||
|
Loading…
Reference in New Issue
Block a user