From 1eb9b8e135ff2ae31f65bde9b7d5c01dae2a9afc Mon Sep 17 00:00:00 2001 From: OliBomby Date: Thu, 1 Jun 2023 09:34:21 +0200 Subject: [PATCH] added xmldoc and renamed GetSamples --- .../Components/Timeline/NodeSamplePointPiece.cs | 2 +- .../Components/Timeline/SamplePointPiece.cs | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/NodeSamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/NodeSamplePointPiece.cs index f168fb791f..ae3838bc41 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/NodeSamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/NodeSamplePointPiece.cs @@ -34,7 +34,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline { private readonly int nodeIndex; - protected override IList GetSamples(HitObject ho) + protected override IList GetRelevantSamples(HitObject ho) { if (ho is not IHasRepeats hasRepeats) return ho.Samples; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs index 997e342dad..26cdf87d02 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs @@ -101,7 +101,13 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline private HitObject[] relevantObjects = null!; private IList[] relevantSamples = null!; - protected virtual IList GetSamples(HitObject ho) => ho.Samples; + /// + /// Gets the sub-set of samples relevant to this sample point piece. + /// For example, to edit node samples this should return the samples at the index of the node. + /// + /// The hit object to get the relevant samples from. + /// The relevant list of samples. + protected virtual IList GetRelevantSamples(HitObject ho) => ho.Samples; [Resolved(canBeNull: true)] private EditorBeatmap beatmap { get; set; } = null!; @@ -157,7 +163,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline // if the piece belongs to a currently selected object, assume that the user wants to change all selected objects. // if the piece belongs to an unselected object, operate on that object alone, independently of the selection. relevantObjects = (beatmap.SelectedHitObjects.Contains(hitObject) ? beatmap.SelectedHitObjects : hitObject.Yield()).ToArray(); - relevantSamples = relevantObjects.Select(GetSamples).ToArray(); + relevantSamples = relevantObjects.Select(GetRelevantSamples).ToArray(); // even if there are multiple objects selected, we can still display sample volume or bank if they all have the same value. string? commonBank = getCommonBank(); @@ -210,7 +216,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline foreach (var h in relevantObjects) { - var samples = GetSamples(h); + var samples = GetRelevantSamples(h); updateAction(h, samples); beatmap.Update(h); } @@ -325,7 +331,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline { foreach ((string sampleName, var bindable) in selectionSampleStates) { - bindable.Value = SelectionHandler.GetStateFromSelection(relevantObjects, h => GetSamples(h).Any(s => s.Name == sampleName)); + bindable.Value = SelectionHandler.GetStateFromSelection(relevantObjects, h => GetRelevantSamples(h).Any(s => s.Name == sampleName)); } }