1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 17:57:29 +08:00

merge updateAdditionBankPlaceholderText and updateAdditionBankActivated

This commit is contained in:
OliBomby 2023-06-01 09:27:04 +02:00
parent e709390052
commit 63d9be9523

View File

@ -178,13 +178,12 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
// this ensures that committing empty text causes a revert to the previous value. // this ensures that committing empty text causes a revert to the previous value.
bank.OnCommit += (_, _) => bank.Current.Value = getCommonBank(); bank.OnCommit += (_, _) => bank.Current.Value = getCommonBank();
updateAdditionBankPlaceholderText();
updateAdditionBankText(); updateAdditionBankText();
updateAdditionBankActivated(); updateAdditionBankVisual();
additionBank.Current.BindValueChanged(val => additionBank.Current.BindValueChanged(val =>
{ {
updateAdditionBank(val.NewValue); updateAdditionBank(val.NewValue);
updateAdditionBankPlaceholderText(); updateAdditionBankVisual();
}); });
additionBank.OnCommit += (_, _) => updateAdditionBankText(); additionBank.OnCommit += (_, _) => updateAdditionBankText();
@ -257,14 +256,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
bank.PlaceholderText = string.IsNullOrEmpty(commonBank) ? "(multiple)" : string.Empty; bank.PlaceholderText = string.IsNullOrEmpty(commonBank) ? "(multiple)" : string.Empty;
} }
private void updateAdditionBankPlaceholderText() private void updateAdditionBankVisual()
{ {
string? commonAdditionBank = getCommonAdditionBank(); string? commonAdditionBank = getCommonAdditionBank();
additionBank.PlaceholderText = string.IsNullOrEmpty(commonAdditionBank) ? "(multiple)" : string.Empty; additionBank.PlaceholderText = string.IsNullOrEmpty(commonAdditionBank) ? "(multiple)" : string.Empty;
}
private void updateAdditionBankActivated()
{
bool anyAdditions = relevantSamples.Any(o => o.Any(s => s.Name != HitSampleInfo.HIT_NORMAL)); bool anyAdditions = relevantSamples.Any(o => o.Any(s => s.Name != HitSampleInfo.HIT_NORMAL));
if (anyAdditions) if (anyAdditions)
additionBank.Show(); additionBank.Show();
@ -274,8 +270,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private void updateAdditionBankText() private void updateAdditionBankText()
{ {
if (additionBank.Current.Disabled) return;
string? commonAdditionBank = getCommonAdditionBank(); string? commonAdditionBank = getCommonAdditionBank();
if (string.IsNullOrEmpty(commonAdditionBank)) return; if (string.IsNullOrEmpty(commonAdditionBank)) return;
@ -357,7 +351,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
samples.Add(relevantSample?.With(sampleName) ?? h.CreateHitSampleInfo(sampleName)); samples.Add(relevantSample?.With(sampleName) ?? h.CreateHitSampleInfo(sampleName));
}); });
updateAdditionBankActivated(); updateAdditionBankVisual();
updateAdditionBankText(); updateAdditionBankText();
} }
@ -376,7 +370,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
}); });
updateAdditionBankText(); updateAdditionBankText();
updateAdditionBankActivated(); updateAdditionBankVisual();
} }
protected override bool OnKeyDown(KeyDownEvent e) protected override bool OnKeyDown(KeyDownEvent e)