public string Set_Random_Text(string _words, int _count, bool fromPlayer, textGimmick gimmick) { if (!fromPlayer) { _count = _count / 2; } List <string> text_array = GetWords_as_list(_words, gimmick); string _Text = TextChanger.Set_Word_Count(_count, text_array); Set_text_field(_Text); return(_Text); }
public List <string> GetWords_as_list(string _words, textGimmick gimmick) { List <int> all_spaces = TextChanger.Get_All_spaces(_words); List <string> text_array = TextChanger.string_into_string_list(all_spaces, _words); if (gimmick == textGimmick.firstLetterUppercase) { List <string> text_array_uppercase = new List <string>(); foreach (string _text in text_array) { if (_text.Length > 1) { char firstLetter = _text[0]; string FirstLetter = firstLetter.ToString().ToUpper(); text_array_uppercase.Add(FirstLetter + _text.Substring(1)); } else { char firstLetter = _text[0]; string FirstLetter = firstLetter.ToString().ToUpper(); text_array_uppercase.Add(FirstLetter); } } return(text_array_uppercase); } else if (gimmick == textGimmick.swap_uppercase_lowercase) { List <string> text_array_uppercase = new List <string>(); bool uppercase = false; foreach (string _text in text_array) { if (uppercase) { text_array_uppercase.Add(_text.ToUpper()); uppercase = false; } else { text_array_uppercase.Add(_text.ToLower()); uppercase = true; } } return(text_array_uppercase); } return(text_array); }
public void Start_typing(string _words, int _count, float _time_per_character, bool _player, textGimmick gimmick, Ability ability) { //if(noTyping) //{ // EndTyping(0.1f, false); //} if (settings) { if (settings.doublWordCount) { _count += _count; } } if (AN) { AN.SetAbility(ability); } fromPlayer = _player; var _text = Set_Random_Text(_words, _count, fromPlayer, gimmick); Debug.Log(_text); currentText = _text; StartTimer(_text, _time_per_character, player); input.readOnly = false; if (input.isFocused == false) { input.ActivateInputField(); } typo_made = false; _position = 0; activated = true; }