1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 15:27:26 +08:00
osu-lazer/osu.Game/Graphics/UserInterface/OsuTextBox.cs
2017-01-31 18:37:11 +09:00

50 lines
1.3 KiB
C#

//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Game.Overlays;
using OpenTK.Graphics;
namespace osu.Game.Graphics.UserInterface
{
public class OsuTextBox : TextBox
{
public OsuTextBox()
{
Height = 40;
TextContainer.Height = OptionsOverlay.FONT_SIZE / Height;
CornerRadius = 5;
}
[BackgroundDependencyLoader]
private void load(OsuColour colour)
{
BorderColour = colour.Yellow;
}
protected override bool OnFocus(InputState state)
{
BorderThickness = 3;
return base.OnFocus(state);
}
protected override void OnFocusLost(InputState state)
{
BorderThickness = 0;
base.OnFocusLost(state);
}
}
public class OsuPasswordTextBox : OsuTextBox
{
protected virtual char MaskCharacter => '*';
protected override Drawable AddCharacterToFlow(char c) => base.AddCharacterToFlow(MaskCharacter);
}
}