mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Use new placeholder logic.
This commit is contained in:
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
@ -19,6 +21,13 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected override float LeftRightPadding => 10;
|
protected override float LeftRightPadding => 10;
|
||||||
|
|
||||||
|
protected override SpriteText CreatePlaceholder() => new OsuSpriteText
|
||||||
|
{
|
||||||
|
Font = @"Exo2.0-MediumItalic",
|
||||||
|
Colour = new Color4(180, 180, 180, 255),
|
||||||
|
Margin = new MarginPadding { Left = 2 },
|
||||||
|
};
|
||||||
|
|
||||||
public OsuTextBox()
|
public OsuTextBox()
|
||||||
{
|
{
|
||||||
Height = 40;
|
Height = 40;
|
||||||
|
@ -27,15 +27,15 @@ namespace osu.Game.Overlays.Options
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string InternalText
|
public OptionTextBox()
|
||||||
{
|
{
|
||||||
get { return base.InternalText; }
|
OnChange += onChange;
|
||||||
set
|
|
||||||
{
|
|
||||||
base.InternalText = value;
|
|
||||||
if (bindable != null)
|
|
||||||
bindable.Value = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onChange(TextBox sender, bool newText)
|
||||||
|
{
|
||||||
|
if (bindable != null)
|
||||||
|
bindable.Value = Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindableValueChanged(object sender, EventArgs e)
|
private void bindableValueChanged(object sender, EventArgs e)
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Options.Sections.General
|
|||||||
{
|
{
|
||||||
private bool bounding = true;
|
private bool bounding = true;
|
||||||
|
|
||||||
protected override string Header => "Sign In";
|
protected override string Header => "Account";
|
||||||
|
|
||||||
public override RectangleF BoundingBox => bounding ? base.BoundingBox : RectangleF.Empty;
|
public override RectangleF BoundingBox => bounding ? base.BoundingBox : RectangleF.Empty;
|
||||||
|
|
||||||
@ -112,11 +112,13 @@ namespace osu.Game.Overlays.Options.Sections.General
|
|||||||
{
|
{
|
||||||
username = new OsuTextBox
|
username = new OsuTextBox
|
||||||
{
|
{
|
||||||
|
PlaceholderText = "Username",
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Text = api?.Username ?? string.Empty
|
Text = api?.Username ?? string.Empty
|
||||||
},
|
},
|
||||||
password = new OsuPasswordTextBox
|
password = new OsuPasswordTextBox
|
||||||
{
|
{
|
||||||
|
PlaceholderText = "Password",
|
||||||
RelativeSizeAxes = Axes.X
|
RelativeSizeAxes = Axes.X
|
||||||
},
|
},
|
||||||
saveUsername = new OsuCheckbox
|
saveUsername = new OsuCheckbox
|
||||||
|
@ -34,38 +34,11 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private SpriteText placeholder;
|
|
||||||
|
|
||||||
protected override string InternalText
|
|
||||||
{
|
|
||||||
get { return base.InternalText; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
base.InternalText = value;
|
|
||||||
if (placeholder != null)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(value))
|
|
||||||
placeholder.Text = "type to search";
|
|
||||||
else
|
|
||||||
placeholder.Text = string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public SearchTextBox()
|
public SearchTextBox()
|
||||||
{
|
{
|
||||||
Height = 35;
|
Height = 35;
|
||||||
Add(new Drawable[]
|
Add(new Drawable[]
|
||||||
{
|
{
|
||||||
placeholder = new SpriteText
|
|
||||||
{
|
|
||||||
Font = @"Exo2.0-MediumItalic",
|
|
||||||
Text = "type to search",
|
|
||||||
Colour = new Color4(180, 180, 180, 255),
|
|
||||||
Anchor = Anchor.CentreLeft,
|
|
||||||
Origin = Anchor.CentreLeft,
|
|
||||||
Margin = new MarginPadding { Left = 10 },
|
|
||||||
},
|
|
||||||
new TextAwesome
|
new TextAwesome
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.fa_search,
|
Icon = FontAwesome.fa_search,
|
||||||
@ -74,6 +47,8 @@ namespace osu.Game.Screens.Select
|
|||||||
Margin = new MarginPadding { Right = 10 },
|
Margin = new MarginPadding { Right = 10 },
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
PlaceholderText = "type to search";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
Reference in New Issue
Block a user