1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-19 02:22:56 +08:00
osu-lazer/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs

55 lines
1.8 KiB
C#
Raw Normal View History

// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
2017-02-14 15:13:25 +08:00
// 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;
2017-02-25 20:12:39 +08:00
using osu.Framework.Graphics.Transforms;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Graphics.UserInterface
{
public class OsuPasswordTextBox : OsuTextBox
{
2017-02-08 15:01:58 +08:00
protected override Drawable GetDrawableCharacter(char c) => new PasswordMaskChar(CalculatedTextSize);
public override bool AllowClipboardExport => false;
2017-02-08 15:01:58 +08:00
public class PasswordMaskChar : Container
{
private CircularContainer circle;
public PasswordMaskChar(float size)
{
2017-02-08 15:01:58 +08:00
Size = new Vector2(size / 2, size);
Children = new[]
{
2017-02-08 15:01:58 +08:00
circle = new CircularContainer
{
Anchor = Anchor.Centre,
2017-02-08 15:01:58 +08:00
Alpha = 0,
RelativeSizeAxes = Axes.Both,
2017-02-08 15:01:58 +08:00
Size = new Vector2(0.8f, 0),
Children = new[]
{
new Box
{
Colour = Color4.White,
RelativeSizeAxes = Axes.Both,
}
},
}
2017-02-08 15:01:58 +08:00
};
}
protected override void LoadComplete()
{
base.LoadComplete();
circle.FadeIn(500, EasingTypes.OutQuint);
circle.ResizeTo(new Vector2(0.8f), 500, EasingTypes.OutQuint);
}
}
}
2017-02-08 15:01:58 +08:00
}