예제 #1
0
 /// <summary>
 /// Updates the state of the current grid when a play ends. 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void OnEndingPlay(object sender, MakingPlayEventArgs e)
 {
     CurrentGrid = e.PokemonGrid;
     OnBoardChanged(this, e);
 }
예제 #2
0
 /// <summary>
 /// Updates the state of the current grid and previous grid when a play ends. 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnBoardChanged(object sender, MakingPlayEventArgs e)
 {
     _justMadeMove = true;
     if (null != BoardChanged)
     {
         BoardChanged(this, e);
     }
 }
예제 #3
0
        /// <summary>
        /// Updates the images associated with the grid buttons for the PokemonBoard. 
        /// <param name="e">The event args that holds to current grid with which to updatee the screen. </param>
        /// </summary>
        private void OnBoardChanged(object obj, MakingPlayEventArgs e)
        {
            IBasicPokemonToken[,] currentGrid = e.PokemonGrid;
            GridButton currentButton;
            System.Collections.IEnumerator buttonEnumerator = GridBoard.Children.GetEnumerator();
            for (int r = 0; r < PokemonBoard.gridSize; r++)
            {
                for (int c = 0; c < PokemonBoard.gridSize; c++)
                {
                    buttonEnumerator.MoveNext();
                    currentButton = (GridButton)buttonEnumerator.Current;
                    if (null == currentGrid[r, c])
                    {
                        currentButton.Background = _pokeball;
                    }
                    else
                    {
                        currentButton.Background = PokemonPictureDictionary.getImageBrush(currentGrid[r, c]);
                    }
                }
            }

            HintButton.Content = _resourceManager.GetString("Hint");
            DependencyObject scope = FocusManager.GetFocusScope(this);
            FocusManager.SetFocusedElement(scope, this);
            GridBoard.Dispatcher.Invoke(delegate() { Thread.Sleep(500); }, DispatcherPriority.Render);
        }