private void ButtonToPress_Click(object sender, EventArgs e) { ButtonToPress buttonPressed = sender as ButtonToPress; if (timerFall.Enabled == false && buttonPressed != null && !r_GameLogic.CheckIfColumnFull(buttonPressed.Col + 1)) { int rowToEnter = r_GameLogic.EnterCoin(buttonPressed.Col, currentPlayerSign()); EState status = r_GameLogic.CheckBoardStatus(rowToEnter, buttonPressed.Col); onFallingAnimation(buttonPressed.Col, rowToEnter, status); } }
private void initButtonToPress(int i_Col) { r_ButtonsToPRess.Capacity = i_Col; int yPosition = 0; int nextXPosition = 0; for (int i = 0; i < r_ButtonsToPRess.Capacity; i++) { ButtonToPress newButtonToPress = new ButtonToPress(nextXPosition, yPosition, i); newButtonToPress.Click += ButtonToPress_Click; r_ButtonsToPRess.Add(newButtonToPress); nextXPosition += Properties.Resources.EmptyCell.Size.Width; } }