Ejemplo n.º 1
0
 public WordAndLetterDieEventArgs(GameWord word, GameLetter letter, GameCellPos wordPosition)
 {
     this.word = word;
         this.letter = letter;
         this.wordPosition = wordPosition;
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 public LetterDieEventArgs(GameLetter letter, GameCellPos letterPosition)
 {
     this.letter = letter;
         this.letterPosition = letterPosition;
 }
Ejemplo n.º 4
0
 protected virtual bool StartWordAndLetterDieAnimation(GameWord word, GameLetter letter, GameCellPos wordPosition)
 {
     if (OnStartWordAndLetterDieAnimation == null) return false;
     return OnStartWordAndLetterDieAnimation(this, new WordAndLetterDieEventArgs(word, letter, wordPosition));
 }
Ejemplo n.º 5
0
 protected virtual bool StartLetterDieAnimation(GameLetter letter, GameCellPos letterPosition)
 {
     if(OnStartLetterDieAnimation == null) return false;
     return OnStartLetterDieAnimation(this, new LetterDieEventArgs(letter, letterPosition));
 }
Ejemplo n.º 6
0
 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;
     }
 }
Ejemplo n.º 7
0
 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();
     }
 }
Ejemplo n.º 8
0
 public void EndLetterDieAnimation(GameLetter letter)
 {
     try {
         if (currentLetter == letter) {
             mainTable.RemoveObject(letter);
             currentLetter = null;
         }
     } finally {
         suspendEvent.Set();
     }
 }