1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 14:37:30 +08:00

fix updating wrong samples

This commit is contained in:
OliBomby 2023-05-08 13:05:53 +02:00
parent cb7b747d52
commit 32f945d304
2 changed files with 11 additions and 7 deletions

View File

@ -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;

View File

@ -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<HitObject> 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);