Example #1
0
        private void coinFallTimer_Tick(object sender, EventArgs e)
        {
            bool Finished = false;
            EventCoinAnimation coinArgsElement = e as EventCoinAnimation;

            for (int i = 0; i < 2 && !Finished; ++i)
            {
                if (fallingCoinPicBox.Bottom >= coinArgsElement.BotoomLimit)
                {
                    Finished = true;
                    CoinFallAnimationDone(coinArgsElement);
                }
                else
                {
                    fallingCoinPicBox.Top += 5;
                }
            }
        }
Example #2
0
        private void CoinFallAnimationDone(EventCoinAnimation coinPos)
        {
            coinFallTimer.Stop();

            fallingCoinPicBox.Visible = false;
            r_CoinImageBoard[coinPos.CoinArgs.Col][coinPos.CoinArgs.Row].ResetRegion(); // Change the region now, because the picture is not in empty cell.

            coinFallTimer.Tick -= coinPos.EventHandlerMethod;
            ChangeCellToFullCell(coinPos.CoinArgs);

            if (matchOver)
            {
                GameOver(coinPos.State, coinPos.CoinArgs);
            }
            else
            {
                ChangeToNextPlayerTurn();
                ChangeCurrentPlayerName();
            }
        }
Example #3
0
        private void CoinFallingAnimation(int Col, int Row, GameState Status)
        {
            if (coinFallTimer.Enabled == false)
            {
                fallingCoinPicBox.Image    = GetCurrentPlayerCoinImage();
                fallingCoinPicBox.Visible  = true;
                fallingCoinPicBox.Location = new Point(67 * Col, 0);
                EventCoinAnimation coinArgs = new EventCoinAnimation(
                    fallingCoinPicBox.Location,
                    r_CoinImageBoard[Col][Row].Bottom,
                    new EventOnCoin(Col, Row, currentPlayerCoin),
                    Status);
                EventHandler eventHandlerTickMethod = new EventHandler(delegate(object sender, EventArgs e) { coinFallTimer_Tick(this, coinArgs); });
                coinArgs.EventHandlerMethod = eventHandlerTickMethod;

                coinFallTimer.Tick    += eventHandlerTickMethod;
                coinFallTimer.Interval = 25;
                coinFallTimer.Start();
            }
        }