mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 05:22:54 +08:00
Update to support non-control-point sample changes
This commit is contained in:
parent
e68ba6366c
commit
a9ba16a2be
@ -199,12 +199,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
private void bankChanged(string bankName, TernaryState state)
|
private void bankChanged(string bankName, TernaryState state)
|
||||||
{
|
{
|
||||||
if (currentPlacement == null) return;
|
if (CurrentPlacement == null) return;
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case TernaryState.True:
|
case TernaryState.True:
|
||||||
currentPlacement.HitObject.SampleControlPoint.SampleBank = bankName;
|
CurrentPlacement.HitObject.Samples = CurrentPlacement.HitObject.Samples.Select(s => s.With(newBank: bankName)).ToList();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
{
|
{
|
||||||
// Never remove a sample bank.
|
// Never remove a sample bank.
|
||||||
// These are basically radio buttons, not toggles.
|
// These are basically radio buttons, not toggles.
|
||||||
if (SelectedItems.All(h => h.SampleControlPoint.SampleBank == bankName))
|
if (SelectedItems.All(h => h.Samples.All(s => s.Bank == bankName)))
|
||||||
bindable.Value = TernaryState.True;
|
bindable.Value = TernaryState.True;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
foreach ((string bankName, var bindable) in SelectionBankStates)
|
foreach ((string bankName, var bindable) in SelectionBankStates)
|
||||||
{
|
{
|
||||||
bindable.Value = GetStateFromSelection(SelectedItems, h => h.SampleControlPoint.SampleBank == bankName);
|
bindable.Value = GetStateFromSelection(SelectedItems, h => h.Samples.All(s => s.Bank == bankName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,25 +183,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
{
|
{
|
||||||
EditorBeatmap.PerformOnSelection(h =>
|
EditorBeatmap.PerformOnSelection(h =>
|
||||||
{
|
{
|
||||||
if (h.SampleControlPoint.SampleBank == bankName)
|
if (h.Samples.All(s => s.Bank == bankName))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
h.SampleControlPoint.SampleBank = bankName;
|
h.Samples = h.Samples.Select(s => s.With(newBank: bankName)).ToList();
|
||||||
EditorBeatmap.Update(h);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Removes a sample bank from all selected <see cref="HitObject"/>s.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="bankName">The name of the sample bank.</param>
|
|
||||||
public void RemoveSampleBank(string bankName)
|
|
||||||
{
|
|
||||||
EditorBeatmap.PerformOnSelection(h =>
|
|
||||||
{
|
|
||||||
if (h.SampleControlPoint.SampleBank == bankName)
|
|
||||||
h.SampleControlPoint.SampleBankBindable.SetDefault();
|
|
||||||
|
|
||||||
EditorBeatmap.Update(h);
|
EditorBeatmap.Update(h);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user