public void GameRule() // 게임 규칙 { if (showstudent <= studentname.Length) { int id = Convert.ToInt32(buzzer.ID); for (int i = 0; i < checkbuzzer.Length; i++) // 버저의 눌림상태를 번호순으로 확인하여 순서대로 눌릴 수 있도록함 { if (checkbuzzer[i] == false) { if (i == (id - 1) % bps) //버저는 (bps * n) + 1번부터 (bps * n) + bps까지 할당 { checkbuzzer[i] = true; if (!studentname[showstudent - 1].StartsWith("unknown")) // unknown의 경우 DB접근 X { game.Buzzerdata(id, buzzer.Content, buzzer.Color, buzzer.Time); } if (i == 0) // 게임 시작 { stopwatch.Restart(); return; } viewarray[showstudent].Settime(i, stopwatch.Elapsed.ToString().Substring(3, 8)); if (i == bps - 1) // 마지막 버저 { stopwatch.Stop(); checkbuzzer = new bool[bps]; rank.Add(viewarray[showstudent].GetName(), viewarray[showstudent].Gettotal()); List <string> r = viewarray[showstudent].GetList(); result.Add(r); game.UpdateRecord(game.getGamenum(), Convert.ToInt32(r[0]), r[7]); // 기록 DB저장 Ranking(); if (showstudent++ == studentname.Length) // 마지막 참가자 { MessageBox.Show("게임종료"); Game.recordhistory = game.Recordhistory().OrderBy(x => x[1]).ToList(); // 역대 기록 갱신 GetResult.Enabled = true; Receiver303.StopVote(buzzer.ComNo); } } } else { break; } } } } }
public void BuzzerSetting_VisibleChanged(object sender, EventArgs e) // 화면변경 시 버저 수신종료, 색상 변경 초기화 { Receiver303.StopVote(buzzer.ComNo); Receiver303.UpdateAllIdSame(buzzer.ComNo, 0, 0, 0, 0, 0); }