public WordAndLetterDieEventArgs(GameWord word, GameLetter letter, GameCellPos wordPosition) { this.word = word; this.letter = letter; this.wordPosition = wordPosition; }
void StartWordAndLetterDieAnimationInternal(GameWord word, GameLetter letter) { GameCellPos wordPosition; if (!mainTable.TryGetObjectPosition(word, out wordPosition)) return; try { if (StartWordAndLetterDieAnimation(word, letter, wordPosition)) { suspendEvent.Reset(); return; } } catch (Exception ex) { //TODO Log } EndWordAndLetterDieAnimation(word, letter); }
public LetterDieEventArgs(GameLetter letter, GameCellPos letterPosition) { this.letter = letter; this.letterPosition = letterPosition; }
protected virtual bool StartWordAndLetterDieAnimation(GameWord word, GameLetter letter, GameCellPos wordPosition) { if (OnStartWordAndLetterDieAnimation == null) return false; return OnStartWordAndLetterDieAnimation(this, new WordAndLetterDieEventArgs(word, letter, wordPosition)); }
protected virtual bool StartLetterDieAnimation(GameLetter letter, GameCellPos letterPosition) { if(OnStartLetterDieAnimation == null) return false; return OnStartLetterDieAnimation(this, new LetterDieEventArgs(letter, letterPosition)); }
public void LetterDown(object state) { if (pause) return; try { if (currentLetter == null) { string nextLetterString = GetNextLetter(); if (string.IsNullOrEmpty(nextLetterString)) return; GameLetter nextLetter = new GameLetter(nextLetterString); mainTable.AddObject(nextLetter, 0, mainTable.Width / 2); currentLetter = nextLetter; } else { GameCellPos position; if (!mainTable.TryGetObjectPosition(currentLetter, out position)) { throw new InvalidOperationException("Current letter not found in table."); } position.MoveDown(); CanMoveResult moveResult = mainTable.TryMoveObjectHere(currentLetter, position.Row, position.Column); switch (moveResult) { case CanMoveResult.ObjectCollision: case CanMoveResult.TableBoundsCollision: { LetterStop(); break; } default: break; } } UpdateScreen(); } catch (Exception ex) { threadsException = ex; exit = true; } }
public void EndWordAndLetterDieAnimation(GameWord word, GameLetter letter) { try { if (currentLetter == letter) { mainTable.RemoveObject(letter); currentLetter = null; int wordIndex; if ((wordIndex = currentWords.IndexOf(word)) >= 0) { currentWords.RemoveAt(wordIndex); mainTable.RemoveObject(word); gameWords++; if (gameWords >= settings.WinWordsCount) { win = true; } } } } finally { suspendEvent.Set(); } }
public void EndLetterDieAnimation(GameLetter letter) { try { if (currentLetter == letter) { mainTable.RemoveObject(letter); currentLetter = null; } } finally { suspendEvent.Set(); } }