mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 17:02:57 +08:00
Reset the sample bank states to auto when selection is cleared
this matches behaviour in stable
This commit is contained in:
parent
1960a0d44d
commit
154a3eebc6
@ -3,13 +3,13 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Specialized;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
@ -36,7 +36,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
// bring in updates from selection changes
|
// bring in updates from selection changes
|
||||||
EditorBeatmap.HitObjectUpdated += _ => Scheduler.AddOnce(UpdateTernaryStates);
|
EditorBeatmap.HitObjectUpdated += _ => Scheduler.AddOnce(UpdateTernaryStates);
|
||||||
|
|
||||||
SelectedItems.CollectionChanged += (_, _) => Scheduler.AddOnce(UpdateTernaryStates);
|
SelectedItems.CollectionChanged += onSelectedItemsChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void DeleteItems(IEnumerable<HitObject> items) => EditorBeatmap.RemoveRange(items);
|
protected override void DeleteItems(IEnumerable<HitObject> items) => EditorBeatmap.RemoveRange(items);
|
||||||
@ -208,9 +208,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
SelectionAdditionBankStates[bankName] = bindable;
|
SelectionAdditionBankStates[bankName] = bindable;
|
||||||
}
|
}
|
||||||
|
|
||||||
// start with normal selected.
|
resetTernaryStates();
|
||||||
SelectionBankStates[SampleControlPoint.DEFAULT_BANK].Value = TernaryState.True;
|
|
||||||
SelectionAdditionBankStates[HIT_BANK_AUTO].Value = TernaryState.True;
|
|
||||||
|
|
||||||
foreach (string sampleName in HitSampleInfo.AllAdditions)
|
foreach (string sampleName in HitSampleInfo.AllAdditions)
|
||||||
{
|
{
|
||||||
@ -252,6 +250,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void resetTernaryStates()
|
||||||
|
{
|
||||||
|
SelectionBankStates[HIT_BANK_AUTO].Value = TernaryState.True;
|
||||||
|
SelectionAdditionBankStates[HIT_BANK_AUTO].Value = TernaryState.True;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when context menu ternary states may need to be recalculated (selection changed or hitobject updated).
|
/// Called when context menu ternary states may need to be recalculated (selection changed or hitobject updated).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -279,6 +283,15 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onSelectedItemsChanged(object? sender, NotifyCollectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
// Reset the ternary states when the selection is cleared.
|
||||||
|
if (e.OldStartingIndex >= 0 && e.NewStartingIndex < 0)
|
||||||
|
Scheduler.AddOnce(resetTernaryStates);
|
||||||
|
else
|
||||||
|
Scheduler.AddOnce(UpdateTernaryStates);
|
||||||
|
}
|
||||||
|
|
||||||
private IEnumerable<IList<HitSampleInfo>> enumerateAllSamples(HitObject hitObject)
|
private IEnumerable<IList<HitSampleInfo>> enumerateAllSamples(HitObject hitObject)
|
||||||
{
|
{
|
||||||
yield return hitObject.Samples;
|
yield return hitObject.Samples;
|
||||||
|
Loading…
Reference in New Issue
Block a user