Exemplo n.º 1
0
        private void UsernameSetup()
        {
            int Ux = UsernameButton.Location.X, Uy = UsernameButton.Location.Y;
            int Px = PasswordButton.Location.X, Py = PasswordButton.Location.Y;

            Label emailLabel = new Label();

            emailLabel.Name     = "EmailLabel";
            emailLabel.Text     = "Email";
            emailLabel.Location = new Point(Ux + emailLabel.Text.Length * 3, Uy + emailLabel.Text.Length * 3);
            emailLabel.Size     = new Size(159, 22);
            emailLabel.Anchor   = AnchorStyles.Left;
            emailLabel.AutoSize = true;
            emailLabel.Font     = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            Controls.Add(emailLabel);

            textBox          = new TextBox();
            textBox.Name     = "EmailTextBox";
            textBox.Location = new Point(Px / 5 - emailLabel.Text.Length, Py);
            textBox.Text     = string.Empty;
            textBox.Size     = new Size(259, 22);
            textBox.Anchor   = AnchorStyles.Left;
            textBox.Font     = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            Controls.Add(textBox);

            UsernameButton.Dispose();
            PasswordButton.Dispose();

            emailLabel.Show();
            textBox.Show();

            Password = false;
        }
Exemplo n.º 2
0
        private void PasswordSetup()
        {
            int Ux = UsernameButton.Location.X, Uy = UsernameButton.Location.Y;
            int Px = PasswordButton.Location.X, Py = PasswordButton.Location.Y;

            Label usernameLabel = new Label();

            usernameLabel.Name     = "UsernameLabel";
            usernameLabel.Text     = "Username";
            usernameLabel.Location = new Point(Ux + 3, Uy + usernameLabel.Text.Length * 3);
            usernameLabel.Size     = new Size(159, 22);
            usernameLabel.Anchor   = AnchorStyles.Left;
            usernameLabel.AutoSize = true;
            usernameLabel.Font     = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            Controls.Add(usernameLabel);

            textBox          = new TextBox();
            textBox.Name     = "UsernameTextBox";
            textBox.Location = new Point(Px - PasswordButton.Size.Width / 2, Py);
            textBox.Text     = string.Empty;
            textBox.Size     = new Size(159, 22);
            textBox.Anchor   = AnchorStyles.Left;
            textBox.Font     = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            Controls.Add(textBox);

            UsernameButton.Dispose();
            PasswordButton.Dispose();

            usernameLabel.Show();
            textBox.Show();

            Password = true;
        }
Exemplo n.º 3
0
    public void OnButtonClick(PasswordButton button)
    {
        if (displayText != null)
        {
            displayText.DOFade(1f, 0f);
        }
        else if (displayTexts.Count != 0)
        {
            displayTexts.ForEach((obj) => obj.DOFade(1f, 0f));
        }
        switch (button.str)
        {
        case "backspace":
            if (stringList.Count != 0)
            {
                stringList.RemoveAt(stringList.Count - 1);
            }
            break;

        case "delete":
            stringList.Clear();
            break;

        case "enter":
            Complete();
            break;

        default:
            stringList.Add(button.str);
            break;
        }
        if (length > 0 && stringList.Count >= length)
        {
            //stringList.Clear();
            if (IsComplete() == true)
            {
                UpdataShow();
                if (autoComplete == true)
                {
                    Complete();
                }
            }
            else if (displayText != null)
            {
                buttonList.ForEach((_button) => _button.CanClick(false));
                displayText.color = Color.red;
                displayText.DOFade(0.5f, 0.2f).SetLoops(3).OnComplete(() => {
                    stringList.Clear();
                    UpdataShow();
                    buttonList.ForEach((_button) => _button.CanClick(true));
                    displayText.color = textDefaultColor;
                });
            }
            else
            {
                buttonList.ForEach((_button) => _button.CanClick(false));
                displayTexts[0].color = Color.red;
                displayTexts[0].DOFade(0.5f, 0.2f).SetLoops(3).OnComplete(() =>
                {
                    stringList.Clear();
                    UpdataShow();
                    buttonList.ForEach((_button) => _button.CanClick(true));
                    displayTexts[0].color = textDefaultColor;
                });

                displayTexts.ForEach((obj) => {
                    if (obj != displayTexts[0])
                    {
                        obj.color = Color.red;
                        obj.DOFade(0.5f, 0.2f).SetLoops(3).OnComplete(() => obj.color = textDefaultColor);
                    }
                });
            }
        }
        UpdataShow();
        if (autoComplete == true)
        {
            Complete();
        }
    }