Ejemplo n.º 1
0
    private void TryToAppendScore()
    {
        if (_inputText.text.Length == 3)
        {
            Scores.AppendScoreToLeaderboard(_inputText.text);

            ShowScores();

            _inputVisuals.SetActive(false);
            _keyboard.enabled = false;
        }
        else
        {
            var charactersInput = "";

            DOTween.Sequence()
            .AppendCallback(() =>
            {
                _keyboard.InputEnabled = false;
                for (var i = _inputText.text.Length; i < _maxLetters; i++)
                {
                    charactersInput += "<color=red>X</color>";
                }

                _inputText.text += charactersInput;
            })
            .Join(_inputText.transform.DOShakePosition(0.5f, 50f))
            .AppendInterval(1f)
            .AppendCallback(() =>
            {
                _inputText.text        = _inputText.text.Replace(charactersInput, "");
                _keyboard.InputEnabled = true;
            });
        }
    }