1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-05 07:42:54 +08:00

Clean code and apply requested changes

This commit is contained in:
AlFasGD 2018-07-24 22:04:02 +03:00
parent 0e50e4ee34
commit 3ca112aef0

View File

@ -28,81 +28,40 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents
public event OnCommitHandler OnCommit; public event OnCommitHandler OnCommit;
private bool readOnly;
public bool ReadOnly public bool ReadOnly
{ {
get => readOnly; get => textBox.ReadOnly;
set set => textBox.ReadOnly = value;
{
textBox.ReadOnly = value;
readOnly = value;
}
} }
private string labelText;
public string LabelText public string LabelText
{ {
get => labelText; get => label.Text;
set set => label.Text = value;
{
labelText = value;
label.Text = value;
}
} }
private float labelTextSize;
public float LabelTextSize public float LabelTextSize
{ {
get => labelTextSize; get => label.TextSize;
set set => label.TextSize = value;
{
labelTextSize = value;
label.TextSize = value;
}
} }
private string placeholderText;
public string PlaceholderText public string PlaceholderText
{ {
get => placeholderText; get => textBox.PlaceholderText;
set set => textBox.PlaceholderText = value;
{
placeholderText = value;
textBox.PlaceholderText = value;
}
} }
private string text;
public string Text public string Text
{ {
get => text; get => textBox.Text;
set set => textBox.Text = value;
{
text = value;
textBox.Text = value;
}
}
private float height = default_height;
public float Height
{
get => height;
private set
{
height = value;
textBox.Height = value;
content.Height = value;
}
} }
public MarginPadding Padding public MarginPadding Padding
{ {
get => base.Padding; get => base.Padding;
set set => base.Padding = value;
{
base.Padding = value;
base.Height = Height + base.Padding.Top;
}
} }
public MarginPadding LabelPadding public MarginPadding LabelPadding
@ -132,7 +91,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents
public LabelledTextBox() public LabelledTextBox()
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
base.Height = default_height + Padding.Top; Height = default_height;
CornerRadius = outer_corner_radius; CornerRadius = outer_corner_radius;
Masking = true; Masking = true;
@ -148,42 +107,37 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = OsuColour.FromHex("1c2125"), Colour = OsuColour.FromHex("1c2125"),
}, },
new Container new GridContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = default_height, Height = default_height,
Child = new GridContainer Content = new[]
{ {
RelativeSizeAxes = Axes.X, new Drawable[]
Height = default_height,
Content = new[]
{ {
new Drawable[] label = new OsuSpriteText
{ {
label = new OsuSpriteText Anchor = Anchor.TopLeft,
{ Origin = Anchor.TopLeft,
Anchor = Anchor.TopLeft, Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding },
Origin = Anchor.TopLeft, Colour = Color4.White,
Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding }, TextSize = default_label_text_size,
Colour = Color4.White, Font = @"Exo2.0-Bold",
TextSize = default_label_text_size, },
Font = @"Exo2.0-Bold", textBox = new OsuTextBox
}, {
textBox = new OsuTextBox Anchor = Anchor.TopLeft,
{ Origin = Anchor.TopLeft,
Anchor = Anchor.TopLeft, RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopLeft, Height = 1,
RelativeSizeAxes = Axes.X, CornerRadius = inner_corner_radius,
Height = default_height,
CornerRadius = inner_corner_radius,
},
}, },
}, },
ColumnDimensions = new[] },
{ ColumnDimensions = new[]
new Dimension(GridSizeMode.Absolute, label_container_width), {
new Dimension() new Dimension(GridSizeMode.Absolute, label_container_width),
} new Dimension()
} }
} }
} }