mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 11:42:56 +08:00
Clean code and apply requested changes
This commit is contained in:
parent
0e50e4ee34
commit
3ca112aef0
@ -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,11 +107,7 @@ 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,
|
|
||||||
Height = default_height,
|
|
||||||
Child = new GridContainer
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = default_height,
|
Height = default_height,
|
||||||
@ -173,8 +128,8 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.TopLeft,
|
Anchor = Anchor.TopLeft,
|
||||||
Origin = Anchor.TopLeft,
|
Origin = Anchor.TopLeft,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Height = default_height,
|
Height = 1,
|
||||||
CornerRadius = inner_corner_radius,
|
CornerRadius = inner_corner_radius,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -186,7 +141,6 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
textBox.OnCommit += OnCommit;
|
textBox.OnCommit += OnCommit;
|
||||||
|
Loading…
Reference in New Issue
Block a user