private void Check(int n) { temp[ans] = x[n]; ans++; if (ans == 3) { if (temp[0] == B[0] && temp[1] == B[1] && temp[2] == B[2]) { //答對! MessageBox.Show("答對了!"); anscount++; label1.Text = "答對題數:" + anscount.ToString(); if (anscount == 3) { //過關 Finish finish = new Finish(); finish.BackGround(3); finish.FormClosed += new FormClosedEventHandler(view_FormClosed); //當pianoview關閉時,返回主畫面 finish.Show(); this.Hide(); } else { SetBCard(); } } else { //答錯! MessageBox.Show("答錯了!"); } ans = 0; } }
private void timer2_Tick(object sender, EventArgs e) { counter++; lblTimer.Text = counter.ToString(); if (counter == 5) { timer1.Interval = 30; } if (counter == 10) { timer1.Interval = 18; } if (counter == 15)//過關 { timer1.Stop(); timer2.Stop(); Finish finish = new Finish(); finish.BackGround(1); finish.FormClosed += new FormClosedEventHandler(view_FormClosed); finish.Show(); this.Hide(); } }
private void PianoView_KeyPress(object sender, KeyPressEventArgs e) { switch (e.KeyChar) { case 'A': case 'a': press = '0'; System.Console.Beep(sound[5] / 2, 200); break; case 'S': case 's': press = '1'; System.Console.Beep(sound[6] / 2, 200); break; case 'D': case 'd': press = '2'; System.Console.Beep(sound[0], 200); break; case 'F': case 'f': press = '3'; System.Console.Beep(sound[1], 200); break; case 'G': case 'g': press = '4'; System.Console.Beep(sound[2], 200); break; case 'H': case 'h': press = '5'; System.Console.Beep(sound[3], 200); break; case 'J': case 'j': press = '6'; System.Console.Beep(sound[4], 200); break; case 'K': case 'k': press = '7'; System.Console.Beep(sound[5], 200); break; case 'L': case 'l': press = '8'; System.Console.Beep(sound[6], 200); break; case ';': case ':': press = '9'; System.Console.Beep(sound[0] * 2, 200); break; default: break; } if (press == bee[count]) { count++; if (count == 24) { //遊戲結束 Finish finish = new Finish(); finish.BackGround(0); finish.FormClosed += new FormClosedEventHandler(view_FormClosed); //當pianoview關閉時,返回主畫面 finish.Show(); this.Hide(); } } else { count = 0; } }