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

fix addition on node sample not working

This commit is contained in:
OliBomby 2024-07-14 22:50:15 +02:00
parent df7a42a00e
commit 9f02a1f1bf

View File

@ -176,8 +176,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
break;
}
// If none of the selected objects have any addition samples, we should not apply the bank.
if (SelectedItems.All(h => h.Samples.All(o => o.Name == HitSampleInfo.HIT_NORMAL)))
// If none of the selected objects have any addition samples, we should not apply the addition bank.
if (SelectedItems.SelectMany(enumerateAllSamples).All(h => h.All(o => o.Name == HitSampleInfo.HIT_NORMAL)))
{
bindable.Value = TernaryState.False;
break;
@ -260,8 +260,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
bindable.Value = GetStateFromSelection(samplesInSelection.SelectMany(s => s).Where(o => o.Name != HitSampleInfo.HIT_NORMAL), h => h.Bank == bankName);
}
}
IEnumerable<IList<HitSampleInfo>> enumerateAllSamples(HitObject hitObject)
private IEnumerable<IList<HitSampleInfo>> enumerateAllSamples(HitObject hitObject)
{
yield return hitObject.Samples;
@ -271,7 +272,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
yield return node;
}
}
}
#endregion
@ -340,7 +340,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
EditorBeatmap.PerformOnSelection(h =>
{
if (h.Samples.Where(o => o.Name != HitSampleInfo.HIT_NORMAL).All(s => s.Bank == bankName))
if (enumerateAllSamples(h).SelectMany(o => o).Where(o => o.Name != HitSampleInfo.HIT_NORMAL).All(s => s.Bank == bankName))
return;
h.Samples = h.Samples.Select(s => s.Name != HitSampleInfo.HIT_NORMAL ? s.With(newBank: bankName) : s).ToList();