1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 07:42:55 +08:00

Add visual disabled state to ternary buttons

This commit is contained in:
Dean Herbert 2024-10-24 18:36:34 +09:00
parent ddbeb56f0f
commit 77bd0e8d70
No known key found for this signature in database
3 changed files with 15 additions and 2 deletions

View File

@ -66,6 +66,9 @@ namespace osu.Game.Screens.Edit.Components.TernaryButtons
private void onAction()
{
if (!Button.Enabled.Value)
return;
Button.Toggle();
}

View File

@ -12,6 +12,8 @@ namespace osu.Game.Screens.Edit.Components.TernaryButtons
{
public readonly Bindable<TernaryState> Bindable;
public readonly Bindable<bool> Enabled = new Bindable<bool>();
public readonly string Description;
/// <summary>

View File

@ -293,14 +293,22 @@ namespace osu.Game.Screens.Edit.Compose.Components
private void updateAutoBankTernaryButtonTooltip()
{
bool enabled = SelectionHandler.AutoSelectionBankEnabled.Value;
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;
autoBankButton.Enabled.Value = enabled;
autoBankButton.Tooltip = !enabled ? "Auto normal bank can only be used during hit object placement" : string.Empty;
}
private void updateAdditionBankTernaryButtonTooltips()
{
bool enabled = SelectionHandler.SelectionAdditionBanksEnabled.Value;
foreach (var ternaryButton in SampleAdditionBankTernaryStates)
ternaryButton.Tooltip = !SelectionHandler.SelectionAdditionBanksEnabled.Value ? "Add an addition sample first to be able to set a bank" : string.Empty;
{
ternaryButton.Enabled.Value = enabled;
ternaryButton.Tooltip = !enabled ? "Add an addition sample first to be able to set a bank" : string.Empty;
}
}
#region Placement