Beispiel #1
0
        private void timerBlinkEffects_Tick(object sender, EventArgs e)
        {
            m_BlinkCounter++;
            foreach (Point winningCellPoint in m_GameManager.FourInARowWinningCells)
            {
                customControls.GameBoardCell blinkingCell = m_GameBoardMatrix[m_NumOfBoardRows - winningCellPoint.X - 1, winningCellPoint.Y];
                if (m_GameManager.GameStatus == GameManager.eGameStatus.Player1Turn)
                {
                    blinkingCell.BackgroundImage = Properties.Resources.FullCellRed;
                }
                else
                {
                    blinkingCell.BackgroundImage = Properties.Resources.FullCellYellow;
                }

                if (m_BlinkCounter % 2 == 0)
                {
                    paintBackgroundOfPicture(Color.Magenta, blinkingCell);
                }
                else
                {
                    paintBackgroundOfPicture(Color.Purple, blinkingCell);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// animation of coin dropping
        /// </summary>
        /// <param name="i_ColToInsert"></param>
        private void performAnimation(int i_ColToInsert)
        {
            m_ButtonCoin.SendToBack();
            int rowIndex = m_NumOfBoardRows - m_GameManager.LogicGameBoard.FirstAvailablePoisitionInCol[i_ColToInsert] - 1;

            m_CellToStop          = m_GameBoardMatrix[rowIndex, i_ColToInsert];
            m_ButtonCoin.Left     = (i_ColToInsert * k_WidthOfCellImage) + k_ExtraSpacingForAnimation;
            m_ButtonCoin.Top      = 0;
            m_StopAnimationHeight = (m_NumOfBoardRows - m_GameManager.LogicGameBoard.FirstAvailablePoisitionInCol[i_ColToInsert] + 1) * k_HeightOfCellImage;
            m_AnimationInProcess  = true;
            timerCoinAnimation.Start();
        }
Beispiel #3
0
        private void paintBackgroundOfPicture(Color i_ColorToPaint, Control i_Control)
        {
            customControls.GameBoardCell cellToPaint = i_Control as customControls.GameBoardCell;
            Color colorToBeReplaced = (cellToPaint.PictureBackgroundImage as Bitmap).GetPixel(0, 0);

            for (int row = 0; row < cellToPaint.PictureBackgroundImage.Height; row++)
            {
                for (int col = 0; col < cellToPaint.PictureBackgroundImage.Width; col++)
                {
                    if ((cellToPaint.PictureBackgroundImage as Bitmap).GetPixel(row, col) == colorToBeReplaced)
                    {
                        (cellToPaint.PictureBackgroundImage as Bitmap).SetPixel(row, col, i_ColorToPaint);
                    }
                }
            }
        }
Beispiel #4
0
        private void buildGameBoard()
        {
            if (!m_IsFirstGame)
            {
                deleteOldGameBoard();
                setBoardSizeAndPlayerNames();
                setPanelProperties();
                setDynamicFormSize();
            }

            m_GameBoardMatrix = new customControls.GameBoardCell[m_NumOfBoardRows, m_NumOfBoardCols];
            for (int row = 0; row < m_NumOfBoardRows; row++)
            {
                for (int col = 0; col < m_NumOfBoardCols; col++)
                {
                    customControls.GameBoardCell newCell = new customControls.GameBoardCell();
                    newCell.Location   = new Point(k_WidthOfCellImage * col, k_HeightOfCellImage * (row + 1));
                    newCell.MouseMove += new MouseEventHandler(m_PanelGameBoard_MouseMove);
                    m_PanelGameBoard.Controls.Add(newCell);
                    m_GameBoardMatrix[row, col] = newCell;
                }
            }
        }