1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-03 05:25:38 +08:00

Make sure to properly update hitobjects

This commit is contained in:
Marvin Schürz 2024-10-11 23:22:15 +02:00
parent 9e97141e33
commit f76a2d02f6
2 changed files with 13 additions and 3 deletions

View File

@ -50,9 +50,14 @@ namespace osu.Game.Rulesets.Osu.Edit
[Resolved]
private HitObjectComposer composer { get; set; } = null!;
private Bindable<TernaryState> newComboState = null!;
[BackgroundDependencyLoader]
private void load()
{
var selectionHandler = (EditorSelectionHandler)composer.BlueprintContainer.SelectionHandler;
newComboState = selectionHandler.SelectionNewComboState.GetBoundCopy();
Child = new FillFlowContainer
{
Width = 220,
@ -122,6 +127,7 @@ namespace osu.Game.Rulesets.Osu.Edit
offsetAngleInput.Current.BindValueChanged(_ => Scheduler.AddOnce(tryCreatePolygon));
repeatCountInput.Current.BindValueChanged(_ => Scheduler.AddOnce(tryCreatePolygon));
pointInput.Current.BindValueChanged(_ => Scheduler.AddOnce(tryCreatePolygon));
newComboState.BindValueChanged(_ => Scheduler.AddOnce(tryCreatePolygon));
tryCreatePolygon();
}
@ -144,7 +150,6 @@ namespace osu.Game.Rulesets.Osu.Edit
insertedCircles.RemoveRange(totalPoints, insertedCircles.Count - totalPoints);
}
var selectionHandler = (EditorSelectionHandler)composer.BlueprintContainer.SelectionHandler;
bool first = true;
var newlyAdded = new List<HitCircle>();
@ -162,7 +167,7 @@ namespace osu.Game.Rulesets.Osu.Edit
circle.Position = position;
circle.StartTime = startTime;
circle.NewCombo = first && selectionHandler.SelectionNewComboState.Value == TernaryState.True;
circle.NewCombo = first && newComboState.Value == TernaryState.True;
if (position.X < 0 || position.Y < 0 || position.X > OsuPlayfield.BASE_SIZE.X || position.Y > OsuPlayfield.BASE_SIZE.Y)
{
@ -179,6 +184,10 @@ namespace osu.Game.Rulesets.Osu.Edit
// TODO: probably ensure samples also follow current ternary status (not trivial)
circle.Samples.Add(circle.CreateHitSampleInfo());
}
else
{
editorBeatmap.Update(circle);
}
startTime = beatSnapProvider.SnapTime(startTime + timeSpacing);

View File

@ -176,7 +176,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// </summary>
protected virtual void UpdateTernaryStates()
{
SelectionNewComboState.Value = GetStateFromSelection(SelectedItems.OfType<IHasComboInformation>(), h => h.NewCombo);
if (SelectedItems.Any())
SelectionNewComboState.Value = GetStateFromSelection(SelectedItems.OfType<IHasComboInformation>(), h => h.NewCombo);
var samplesInSelection = SelectedItems.SelectMany(enumerateAllSamples).ToArray();