1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 12:27:26 +08:00

Show tooltip on auto normal bank when not usable

This commit is contained in:
OliBomby 2024-10-23 21:25:37 +02:00
parent 5939c78760
commit ddbeb56f0f
2 changed files with 16 additions and 2 deletions

View File

@ -68,7 +68,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
SampleBankTernaryStates = createSampleBankTernaryButtons(SelectionHandler.SelectionBankStates).ToArray();
SampleAdditionBankTernaryStates = createSampleBankTernaryButtons(SelectionHandler.SelectionAdditionBankStates).ToArray();
SelectionHandler.SelectionAdditionBanksEnabled.BindValueChanged(_ => updateTernaryButtonTooltips());
SelectionHandler.AutoSelectionBankEnabled.BindValueChanged(_ => updateAutoBankTernaryButtonTooltip(), true);
SelectionHandler.SelectionAdditionBanksEnabled.BindValueChanged(_ => updateAdditionBankTernaryButtonTooltips(), true);
AddInternal(new DrawableRulesetDependenciesProvidingContainer(Composer.Ruleset)
{
@ -290,7 +291,13 @@ namespace osu.Game.Screens.Edit.Compose.Components
return null;
}
private void updateTernaryButtonTooltips()
private void updateAutoBankTernaryButtonTooltip()
{
var autoBankButton = SampleBankTernaryStates.Single(t => t.Bindable == SelectionHandler.SelectionBankStates[EditorSelectionHandler.HIT_BANK_AUTO]);
autoBankButton.Tooltip = !SelectionHandler.AutoSelectionBankEnabled.Value ? "Auto normal bank can only be used during hit object placement" : string.Empty;
}
private void updateAdditionBankTernaryButtonTooltips()
{
foreach (var ternaryButton in SampleAdditionBankTernaryStates)
ternaryButton.Tooltip = !SelectionHandler.SelectionAdditionBanksEnabled.Value ? "Add an addition sample first to be able to set a bank" : string.Empty;

View File

@ -64,6 +64,11 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// </summary>
public readonly Dictionary<string, Bindable<TernaryState>> SelectionAdditionBankStates = new Dictionary<string, Bindable<TernaryState>>();
/// <summary>
/// Whether there is no selection and the auto <see cref="SelectionBankStates"/> can be used.
/// </summary>
public readonly Bindable<bool> AutoSelectionBankEnabled = new Bindable<bool>();
/// <summary>
/// Whether the selection contains any addition samples and the <see cref="SelectionAdditionBankStates"/> can be used.
/// </summary>
@ -253,6 +258,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
private void resetTernaryStates()
{
AutoSelectionBankEnabled.Value = true;
SelectionBankStates[HIT_BANK_AUTO].Value = TernaryState.True;
SelectionAdditionBankStates[HIT_BANK_AUTO].Value = TernaryState.True;
}
@ -263,6 +269,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected virtual void UpdateTernaryStates()
{
SelectionNewComboState.Value = GetStateFromSelection(SelectedItems.OfType<IHasComboInformation>(), h => h.NewCombo);
AutoSelectionBankEnabled.Value = SelectedItems.Count == 0;
var samplesInSelection = SelectedItems.SelectMany(enumerateAllSamples).ToArray();