From 32f945d304509a4e3f359f667caa4ccb3d473e19 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Mon, 8 May 2023 13:05:53 +0200 Subject: [PATCH] fix updating wrong samples --- .../Components/Timeline/NodeSamplePointPiece.cs | 4 ++-- .../Components/Timeline/SamplePointPiece.cs | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/NodeSamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/NodeSamplePointPiece.cs index dc91401c13..437d3c3d3a 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/NodeSamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/NodeSamplePointPiece.cs @@ -32,7 +32,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline return NodeIndex < hasRepeats.NodeSamples.Count ? hasRepeats.NodeSamples[NodeIndex] : HitObject.Samples; } - public override Popover GetPopover() => new NodeSampleEditPopover(HitObject); + public override Popover GetPopover() => new NodeSampleEditPopover(HitObject, NodeIndex); public partial class NodeSampleEditPopover : SampleEditPopover { @@ -44,7 +44,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline return nodeIndex < hasRepeats.NodeSamples.Count ? hasRepeats.NodeSamples[nodeIndex] : ho.Samples; } - public NodeSampleEditPopover(HitObject hitObject, int nodeIndex = 0) + public NodeSampleEditPopover(HitObject hitObject, int nodeIndex) : base(hitObject) { this.nodeIndex = nodeIndex; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs index 064e96c255..50b1ec80ff 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs @@ -158,9 +158,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline foreach (var h in objects) { - for (int i = 0; i < h.Samples.Count; i++) + var samples = GetSamples(h); + + for (int i = 0; i < samples.Count; i++) { - h.Samples[i] = h.Samples[i].With(newBank: newBank); + samples[i] = samples[i].With(newBank: newBank); } beatmap.Update(h); @@ -171,7 +173,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline private void updateBankPlaceholderText(IEnumerable objects) { - string? commonBank = getCommonBank(objects.Select(h => h.Samples).ToArray()); + string? commonBank = getCommonBank(objects.Select(GetSamples).ToArray()); bank.PlaceholderText = string.IsNullOrEmpty(commonBank) ? "(multiple)" : string.Empty; } @@ -184,9 +186,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline foreach (var h in objects) { - for (int i = 0; i < h.Samples.Count; i++) + var samples = GetSamples(h); + + for (int i = 0; i < samples.Count; i++) { - h.Samples[i] = h.Samples[i].With(newVolume: newVolume.Value); + samples[i] = samples[i].With(newVolume: newVolume.Value); } beatmap.Update(h);