Exemplo n.º 1
0
 private void r_GameLogic_UpdateButtonBoardEventHandler(object sender, CoinEventArgs e)
 {
     if (e.Row == 0)
     {
         r_ButtonsToPRess[e.Col].Enabled = false;
     }
 }
Exemplo n.º 2
0
 protected virtual void OnUpdateButtonOnBoardOccured(CoinEventArgs e)
 {
     if (UpdateButtonOnBoardOccured != null)
     {
         UpdateButtonOnBoardOccured.Invoke(this, e);
     }
 }
 public CoinAnimationEventArgs(Point i_StartLocation, int i_BotoomLimit, CoinEventArgs i_CoinArgs, EState i_State)
 {
     r_StartLoaction = i_StartLocation;
     r_BotoomLimit   = i_BotoomLimit;
     r_CoinArgs      = i_CoinArgs;
     r_State         = i_State;
 }
Exemplo n.º 4
0
 private void winAnimation(CoinEventArgs i_Coin)
 {
     if (timerFall.Enabled == false)
     { // if timer is not running.
         m_ArrWinLine = new Point[r_GameLogic.Sequence];
         r_GameLogic.GetWinRow(m_ArrWinLine, i_Coin);
         timerSwitch.Tick += timerSwitch_Tick;
         timerSwitch.Start();
     }
 }
Exemplo n.º 5
0
 private void changeToFullCell(CoinEventArgs e)
 {
     if (e.SignPlayer == k_Player1Sign)
     {
         r_BoardImages[e.Col][e.Row].BackgroundImage = Properties.Resources.FullCellRed;
     }
     else
     {
         r_BoardImages[e.Col][e.Row].BackgroundImage = Properties.Resources.FullCellYellow;
     }
 }
Exemplo n.º 6
0
        public void GetWinRow(Point[] i_arr, CoinEventArgs i_Coin)
        {
            bool isWinHappen;
            int  startWinInd, EndWinInd;
            int  startRow;
            int  startCol;

            m_Row = new Position[k_MaxSizeBoard];

            // check line down
            updateRowLine(eRowOrCol.Col, i_Coin.Col);
            isWinHappen = checkAWinLine(i_Coin.SignPlayer, out startWinInd, out EndWinInd);
            if (isWinHappen)
            {
                CreatePointToReturn(i_arr, startWinInd, EndWinInd);
                return;
            }

            // check line left/right
            updateRowLine(eRowOrCol.Row, i_Coin.Row);
            isWinHappen = checkAWinLine(i_Coin.SignPlayer, out startWinInd, out EndWinInd);
            if (isWinHappen)
            {
                CreatePointToReturn(i_arr, startWinInd, EndWinInd);
                return;
            }

            // check diagonal from up right to down left
            startRow = (i_Coin.Row + i_Coin.Col > m_GameBoard.Row - 1) ? m_GameBoard.Row - 1 : i_Coin.Row + i_Coin.Col;
            startCol = (i_Coin.Col + i_Coin.Row > m_GameBoard.Row - 1) ? (i_Coin.Col - (m_GameBoard.Row - 1 - i_Coin.Row)) : 0;
            updateRowLineDiagonal(eDiagonalType.Secondary, startRow, startCol);
            isWinHappen = checkAWinLine(i_Coin.SignPlayer, out startWinInd, out EndWinInd);
            if (isWinHappen)
            {
                CreatePointToReturn(i_arr, startWinInd, EndWinInd);
                return;
            }

            // check diagonal from up left to down right
            startRow = (i_Coin.Row - i_Coin.Col < 0) ? 0 : i_Coin.Row - i_Coin.Col;
            startCol = (i_Coin.Col - i_Coin.Row < 0) ? 0 : i_Coin.Col - i_Coin.Row;
            updateRowLineDiagonal(eDiagonalType.Main, startRow, startCol);
            isWinHappen = checkAWinLine(i_Coin.SignPlayer, out startWinInd, out EndWinInd);
            if (isWinHappen)
            {
                CreatePointToReturn(i_arr, startWinInd, EndWinInd);
                return;
            }
        }
Exemplo n.º 7
0
        private bool checkStatus(EState i_Status, CoinEventArgs i_Coin)
        {
            m_GameIsFinish = true;

            switch (i_Status)
            {
            case EState.Win:
                winAnimation(i_Coin);
                updateScore();
                showWinMessage("wins!", this.Text);
                break;

            case EState.Draw:
                showMessage("Tie!!", this.Text);
                break;

            case EState.Continue:
                m_GameIsFinish = false;
                break;
            }

            return(m_GameIsFinish);
        }