コード例 #1
0
ファイル: TextBox.cs プロジェクト: omkelderman/osu-framework
        private Drawable addCharacter(char c)
        {
            if (char.IsControl(c))
            {
                return(null);
            }

            if (selectionLength > 0)
            {
                removeCharacterOrSelection();
            }

            if (InternalText.Length + 1 > LengthLimit)
            {
                if (background.Alpha > 0)
                {
                    background.FlashColour(Color4.Red, 200);
                }
                else
                {
                    textFlow.FlashColour(Color4.Red, 200);
                }
                return(null);
            }

            Drawable ch = AddCharacterToFlow(c);

            ch.Position = new Vector2(0, DrawSize.Y);
            ch.MoveToY(0, 200, EasingTypes.OutExpo);

            InternalText   = InternalText.Insert(selectionLeft, c.ToString());
            selectionStart = selectionEnd = selectionLeft + 1;

            cursorAndLayout.Invalidate();

            return(ch);
        }