mirror of
https://github.com/ppy/osu.git
synced 2025-03-13 03:07:45 +08:00
Add tooltip to explain why addition banks dont work when no additions exist
This commit is contained in:
parent
2381c2c72c
commit
1960a0d44d
@ -4,8 +4,10 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
@ -14,7 +16,7 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Components.TernaryButtons
|
namespace osu.Game.Screens.Edit.Components.TernaryButtons
|
||||||
{
|
{
|
||||||
public partial class DrawableTernaryButton : OsuButton
|
public partial class DrawableTernaryButton : OsuButton, IHasTooltip
|
||||||
{
|
{
|
||||||
private Color4 defaultBackgroundColour;
|
private Color4 defaultBackgroundColour;
|
||||||
private Color4 defaultIconColour;
|
private Color4 defaultIconColour;
|
||||||
@ -98,5 +100,7 @@ namespace osu.Game.Screens.Edit.Components.TernaryButtons
|
|||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
X = 40f
|
X = 40f
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public LocalisableString TooltipText => Button.Tooltip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,8 @@ namespace osu.Game.Screens.Edit.Components.TernaryButtons
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly Func<Drawable>? CreateIcon;
|
public readonly Func<Drawable>? CreateIcon;
|
||||||
|
|
||||||
|
public string Tooltip { get; set; } = string.Empty;
|
||||||
|
|
||||||
public TernaryButton(Bindable<TernaryState> bindable, string description, Func<Drawable>? createIcon = null)
|
public TernaryButton(Bindable<TernaryState> bindable, string description, Func<Drawable>? createIcon = null)
|
||||||
{
|
{
|
||||||
Bindable = bindable;
|
Bindable = bindable;
|
||||||
|
@ -68,6 +68,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
SampleBankTernaryStates = createSampleBankTernaryButtons(SelectionHandler.SelectionBankStates).ToArray();
|
SampleBankTernaryStates = createSampleBankTernaryButtons(SelectionHandler.SelectionBankStates).ToArray();
|
||||||
SampleAdditionBankTernaryStates = createSampleBankTernaryButtons(SelectionHandler.SelectionAdditionBankStates).ToArray();
|
SampleAdditionBankTernaryStates = createSampleBankTernaryButtons(SelectionHandler.SelectionAdditionBankStates).ToArray();
|
||||||
|
|
||||||
|
SelectionHandler.SelectionAdditionBanksEnabled.BindValueChanged(_ => updateTernaryButtonTooltips());
|
||||||
|
|
||||||
AddInternal(new DrawableRulesetDependenciesProvidingContainer(Composer.Ruleset)
|
AddInternal(new DrawableRulesetDependenciesProvidingContainer(Composer.Ruleset)
|
||||||
{
|
{
|
||||||
Child = placementBlueprintContainer
|
Child = placementBlueprintContainer
|
||||||
@ -288,6 +290,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateTernaryButtonTooltips()
|
||||||
|
{
|
||||||
|
foreach (var ternaryButton in SampleAdditionBankTernaryStates)
|
||||||
|
ternaryButton.Tooltip = !SelectionHandler.SelectionAdditionBanksEnabled.Value ? "Add an addition sample first to be able to set a bank" : string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
#region Placement
|
#region Placement
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -63,6 +63,11 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly Dictionary<string, Bindable<TernaryState>> SelectionAdditionBankStates = new Dictionary<string, Bindable<TernaryState>>();
|
public readonly Dictionary<string, Bindable<TernaryState>> SelectionAdditionBankStates = new Dictionary<string, Bindable<TernaryState>>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the selection contains any addition samples and the <see cref="SelectionAdditionBankStates"/> can be used.
|
||||||
|
/// </summary>
|
||||||
|
public readonly Bindable<bool> SelectionAdditionBanksEnabled = new Bindable<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set up ternary state bindables and bind them to selection/hitobject changes (in both directions)
|
/// Set up ternary state bindables and bind them to selection/hitobject changes (in both directions)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -266,6 +271,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
bindable.Value = GetStateFromSelection(samplesInSelection.SelectMany(s => s).Where(o => o.Name == HitSampleInfo.HIT_NORMAL), h => h.Bank == bankName);
|
bindable.Value = GetStateFromSelection(samplesInSelection.SelectMany(s => s).Where(o => o.Name == HitSampleInfo.HIT_NORMAL), h => h.Bank == bankName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SelectionAdditionBanksEnabled.Value = samplesInSelection.SelectMany(s => s).Any(o => o.Name != HitSampleInfo.HIT_NORMAL);
|
||||||
|
|
||||||
foreach ((string bankName, var bindable) in SelectionAdditionBankStates)
|
foreach ((string bankName, var bindable) in SelectionAdditionBankStates)
|
||||||
{
|
{
|
||||||
bindable.Value = GetStateFromSelection(samplesInSelection.SelectMany(s => s).Where(o => o.Name != HitSampleInfo.HIT_NORMAL), h => (bankName != HIT_BANK_AUTO && h.Bank == bankName && !h.EditorAutoBank) || (bankName == HIT_BANK_AUTO && h.EditorAutoBank));
|
bindable.Value = GetStateFromSelection(samplesInSelection.SelectMany(s => s).Where(o => o.Name != HitSampleInfo.HIT_NORMAL), h => (bankName != HIT_BANK_AUTO && h.Bank == bankName && !h.EditorAutoBank) || (bankName == HIT_BANK_AUTO && h.EditorAutoBank));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user