1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-16 07:20: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; break;
} }
// If none of the selected objects have any addition samples, we should not apply the bank. // If none of the selected objects have any addition samples, we should not apply the addition bank.
if (SelectedItems.All(h => h.Samples.All(o => o.Name == HitSampleInfo.HIT_NORMAL))) if (SelectedItems.SelectMany(enumerateAllSamples).All(h => h.All(o => o.Name == HitSampleInfo.HIT_NORMAL)))
{ {
bindable.Value = TernaryState.False; bindable.Value = TernaryState.False;
break; 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); 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; yield return hitObject.Samples;
@ -271,7 +272,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
yield return node; yield return node;
} }
} }
}
#endregion #endregion
@ -340,7 +340,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
EditorBeatmap.PerformOnSelection(h => 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; return;
h.Samples = h.Samples.Select(s => s.Name != HitSampleInfo.HIT_NORMAL ? s.With(newBank: bankName) : s).ToList(); h.Samples = h.Samples.Select(s => s.Name != HitSampleInfo.HIT_NORMAL ? s.With(newBank: bankName) : s).ToList();