Skip to content

Commit

Permalink
Attempt to address design concerns
Browse files Browse the repository at this point in the history
  • Loading branch information
bdach committed Sep 13, 2024
1 parent 2c19b79 commit 652a590
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
2 changes: 0 additions & 2 deletions osu.Game.Tests/Visual/UserInterface/TestSceneFormControls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ public TestSceneFormControls()
{
Caption = EditorSetupStrings.LetterboxDuringBreaks,
HintText = EditorSetupStrings.LetterboxDuringBreaksDescription,
OnText = "Letterbox",
OffText = "Do not letterbox",
},
new FormCheckBox
{
Expand Down
33 changes: 23 additions & 10 deletions osu.Game/Graphics/UserInterfaceV2/FormCheckBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
using osu.Framework.Localisation;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Overlays;
using osuTK;

namespace osu.Game.Graphics.UserInterfaceV2
{
Expand All @@ -30,8 +32,6 @@ public Bindable<bool> Current

public LocalisableString Caption { get; init; }
public LocalisableString HintText { get; init; }
public LocalisableString OnText { get; init; } = "On";
public LocalisableString OffText { get; init; } = "Off";

private Box background = null!;
private FormFieldCaption caption = null!;
Expand Down Expand Up @@ -74,17 +74,30 @@ private void load(AudioManager audio)
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
},
text = new OsuSpriteText
new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
},
checkbox = new Nub
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Current = Current,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(7),
Children = new Drawable[]
{
checkbox = new Nub
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Current = Current,
Margin = new MarginPadding { Top = 2, },
},
text = new OsuSpriteText
{
RelativeSizeAxes = Axes.X,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},
}
}
},
},
Expand Down Expand Up @@ -141,7 +154,7 @@ private void updateState()
checkbox.Colour = Current.Disabled ? colourProvider.Foreground1 : colourProvider.Content1;
text.Colour = Current.Disabled ? colourProvider.Foreground1 : colourProvider.Content1;

text.Text = Current.Value ? OnText : OffText;
text.Text = Current.Value ? CommonStrings.Enabled : CommonStrings.Disabled;

if (!Current.Disabled)
{
Expand Down

0 comments on commit 652a590

Please sign in to comment.