Implement notes for settings

This commit is contained in:
Joseph Madamba 2021-05-04 00:59:22 -07:00
parent f2f41545f8
commit acc9258eb2

View File

@ -19,6 +19,7 @@ using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.Settings
{
@ -36,6 +37,8 @@ namespace osu.Game.Overlays.Settings
private SpriteText labelText;
private readonly OsuTextFlowContainer noteText;
public bool ShowsDefaultIndicator = true;
public string TooltipText { get; set; }
@ -57,6 +60,19 @@ namespace osu.Game.Overlays.Settings
}
}
/// <summary>
/// Text to be displayed at the bottom of this <see cref="SettingsItem{T}"/>.
/// Used for further explanation or indicating drawbacks of the current setting.
/// </summary>
public string NoteText
{
set
{
noteText.Alpha = 1;
noteText.Text = value;
}
}
public virtual Bindable<T> Current
{
get => controlWithCurrent.Current;
@ -92,7 +108,16 @@ namespace osu.Game.Overlays.Settings
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS },
Child = Control = CreateControl()
Children = new[]
{
Control = CreateControl(),
noteText = new OsuTextFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Alpha = 0,
},
},
},
};
@ -108,6 +133,12 @@ namespace osu.Game.Overlays.Settings
}
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
noteText.Colour = colours.Yellow;
}
private void updateDisabled()
{
if (labelText != null)