1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-16 02:11:05 +08:00
osu-lazer/osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
746 B
C#
Raw Normal View History

2024-09-04 19:57:53 +08:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
namespace osu.Game.Graphics.UserInterfaceV2
{
public partial class FormNumberBox : FormTextBox
{
public bool AllowDecimals { get; init; }
internal override InnerTextBox CreateTextBox() => new InnerNumberBox
{
AllowDecimals = AllowDecimals,
};
internal partial class InnerNumberBox : InnerTextBox
{
public bool AllowDecimals { get; init; }
protected override bool CanAddCharacter(char character)
=> char.IsAsciiDigit(character) || (AllowDecimals && character == '.');
}
}
}