private void OnClick(object sender, ControlEventArg e) { if (e.Key == Keys.SPACE) { isPaused = !isPaused; } else { snake.ChangeDirection(e.Direction); } }
private void BtnEsc_OnClick(object sender, ControlEventArg e) { File.WriteAllText("save.txt", currentLvl.LvlNum.ToString()); isExit = true; btnSpace.OnClick -= OnClick; btnEsc.OnClick -= BtnEsc_OnClick; cg.FillRectangle(0xFF000000, 0, 0, 600, 600); foreach (Control cc in arrowBtns) { cc.OnClick -= OnClick; } }
internal void OnClick(object s, ControlEventArg e) { ChangeDirection(e.Direction); }