Esempio n. 1
0
        private void fallingPiece_MotionFinished(object sender, EventArgs e)
        {
            FallingPiece piece = sender as FallingPiece;

            piece.MotionFinished -= fallingPiece_MotionFinished;
            Controls.Remove(piece);

            if (OnColumnSelectPressed != null)
            {
                OnColumnSelectPressed.Invoke(m_ColumnSelected);
            }
        }
Esempio n. 2
0
        private void selector_Click(object sender, EventArgs e)
        {
            ColumnSelector senderSelector = sender as ColumnSelector;
            int            columnSelected = m_ColumnSelectors.IndexOf(senderSelector);

            FallingPiece fallingPiece = new FallingPiece();

            Controls.Add(fallingPiece);
            fallingPiece.Type = m_CuerrentPlayer;
            fallingPiece.Left = m_CellSize.X * columnSelected;
            int targetHeight = GetTargetHeight(columnSelected);

            fallingPiece.MoveToY(targetHeight, 1000);
            fallingPiece.MotionFinished += fallingPiece_MotionFinished;
            m_ColumnSelected             = columnSelected;
            BringAllBoardCellsToFrontAndSelectorsToBack();

            Debug.Print(columnSelected.ToString());
        }