public async Task ClearRow(string knownLetters) { var viewmodel = new WordGameRowViewModel(_wordGameRows.Items.First().Letters.Count); _wordGameRows.ReplaceAt(attemptIndex, viewmodel); await viewmodel.SetInitialLetters(knownLetters); }
/// <summary> /// Sets the word without checking for correctness yet /// </summary> /// <param name="word"></param> public void SetWord(string word) { WordGameRowViewModel viewmodel = _wordGameRows.Items.ElementAt(attemptIndex); for (int i = 0; i < word.Length; i++) { viewmodel.SetLetter(i, word[i], LetterState.DoesNotExistInWord); } }
public async Task ShowWord(string word) { CombinedSoundSampleProvider soundProvider = SetupWordGameEntrySounds(Enumerable.Repeat(LetterState.CorrectLocation, word.Length), 200); WordGameRowViewModel viewmodel = _wordGameRows.Items.ElementAt(attemptIndex); _audioPlaybackEngine.PlaySound(soundProvider); for (int i = 0; i < word.Length; i++) { viewmodel.SetLetter(i, word[i], LetterState.DoesNotExistInWord); await Task.Delay(200); } }
public async Task AcceptWord(WordPuzzleEntry result) { CombinedSoundSampleProvider soundProvider = SetupWordGameEntrySounds(result.LetterEntries.Select(x => x.State), 200); WordGameRowViewModel viewmodel = _wordGameRows.Items.ElementAt(attemptIndex); _audioPlaybackEngine.PlaySound(soundProvider); for (int i = 0; i < result.LetterEntries.Length; i++) { viewmodel.SetLetter(i, result.LetterEntries[i].Letter, result.LetterEntries[i].State); await Task.Delay(200); } }
public async Task StartNextAttempt(string knownLetters) { attemptIndex = Math.Min(attemptIndex + 1, 4); WordGameRowViewModel viewmodel = _wordGameRows.Items.ElementAt(attemptIndex); await viewmodel.SetInitialLetters(knownLetters); }