mirror of
https://github.com/ppy/osu.git
synced 2025-01-30 21:32:57 +08:00
Make password mask characters look better.
This commit is contained in:
parent
5a89ba1040
commit
84096b146e
37
osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs
Normal file
37
osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
public class OsuPasswordTextBox : OsuTextBox
|
||||||
|
{
|
||||||
|
protected override Drawable GetDrawableCharacter(char c) =>
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Size = new Vector2(CalculatedTextSize / 2, CalculatedTextSize),
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new CircularContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Size = new Vector2(0.8f),
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Colour = Color4.White,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -8,7 +8,6 @@ using osu.Framework.Input;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
@ -47,13 +46,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
base.OnFocusLost(state);
|
base.OnFocusLost(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override SpriteText GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString() };
|
protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), TextSize = CalculatedTextSize };
|
||||||
}
|
|
||||||
|
|
||||||
public class OsuPasswordTextBox : OsuTextBox
|
|
||||||
{
|
|
||||||
protected virtual char MaskCharacter => '*';
|
|
||||||
|
|
||||||
protected override Drawable AddCharacterToFlow(char c) => base.AddCharacterToFlow(MaskCharacter);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,7 @@
|
|||||||
<Compile Include="Graphics\Sprites\OsuSpriteText.cs" />
|
<Compile Include="Graphics\Sprites\OsuSpriteText.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\BackButton.cs" />
|
<Compile Include="Graphics\UserInterface\BackButton.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\Nub.cs" />
|
<Compile Include="Graphics\UserInterface\Nub.cs" />
|
||||||
|
<Compile Include="Graphics\UserInterface\OsuPasswordTextBox.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\OsuSliderBar.cs" />
|
<Compile Include="Graphics\UserInterface\OsuSliderBar.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\OsuTextBox.cs" />
|
<Compile Include="Graphics\UserInterface\OsuTextBox.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\TwoLayerButton.cs" />
|
<Compile Include="Graphics\UserInterface\TwoLayerButton.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user