public void MoveNextPhaseHaveChallenge()
{
//Update team location in lane on audience screen
foreach (Player_Lane1 PlayerLane in audience.pnl_Lane.Controls)
{
if (Convert.ToInt32(PlayerLane.lbl_SequencePlayer.Text) == sequenceplayer(records.ElementAt(team).IDPlayer))
{
if (records.ElementAt(team).TotalPass == AmountPhase * AmountSteptoPass)
{//move out lane when done all question in all phase
//get bonus when team is the first champion
if (records.ElementAt(team).First == true)
{
records.ElementAt(team).TeamScore += Bonus;
//Record
Record Restore = new Record();
//Team score
Restore.TeamScore = records.ElementAt(team).TeamScore;
Restore.IDPlayer = records.ElementAt(team).IDPlayer;
Restore.IDContest = iDContest;
RecordBL.UpdateTeamScore(Restore);
//check player done
records.ElementAt(team).Done = true;
Restore.Done_I = 1;
Restore.IDContest = iDContest;
Restore.IDPlayer = records.ElementAt(team).IDPlayer;
RecordBL.UpdateDone(Restore);
//check false all first
//for (int i = 0; i < records.Count; i++)
//{
// records.ElementAt(i).First = false;
//}
//Restore.First_I = 0;
//Restore.IDContest = iDContest;
//RecordBL.UpdateFirst(Restore);
//Done = false;
GameOver = true;
//show icon to end when team have finished
//pb_EndGame.Visible = true;
}
int H_Phase = (PlayerLane.Height - PlayerLane.btn_Team.Height - PlayerLane.lbl_Finish.Location.Y - PlayerLane.lbl_Finish.Height) / (AmountPhase * AmountSteptoPass);
PlayerLane.btn_Team.Location = new Point(PlayerLane.btn_Team.Location.X + 0, PlayerLane.btn_Team.Location.Y - (H_Phase / 2 - PlayerLane.btn_Team.Height / 2) - PlayerLane.lbl_Finish.Height - PlayerLane.btn_Team.Height - 2);
}
else
{//move after done each question
int H_Phase = (PlayerLane.Height - PlayerLane.btn_Team.Height - PlayerLane.lbl_Finish.Location.Y - PlayerLane.lbl_Finish.Height) / (AmountPhase * AmountSteptoPass);
PlayerLane.btn_Team.Location = new Point(PlayerLane.btn_Team.Location.X + 0, PlayerLane.btn_Team.Location.Y - H_Phase);
}
}
}
//move to next phase
if (records.ElementAt(team).NumPass == 0)
{
//get phase
Phase.IDContest = iDContest;
List<Phase> ListPhase;
ListPhase = PhaseBL.GetPhaseNormal(Phase);
records.ElementAt(team).PhaseIndex += 1;
records.ElementAt(team).NumFail = AmountSteptofail;
records.ElementAt(team).NumPass = AmountSteptoPass;
//Record
Record Restore = new Record();
//Number of correct
Restore.NumPass = records.ElementAt(team).NumPass;
Restore.IDPlayer = records.ElementAt(team).IDPlayer;
Restore.IDContest = iDContest;
RecordBL.UpdateNumofCorrect(Restore);
//Number of incorrect
Restore.NumFail = records.ElementAt(team).NumFail;
RecordBL.UpdateNumofIncorrect(Restore);
//Phase index
Restore.PhaseIndex = records.ElementAt(team).PhaseIndex;
RecordBL.UpdatePhaseIndex(Restore);
if (records.ElementAt(team).PhaseIndex < AmountPhase)
{
records.ElementAt(team).IDPhase = ListPhase.ElementAt(records.ElementAt(team).PhaseIndex).IDPhase;
//Record
Restore.IDPhase = ListPhase.ElementAt(records.ElementAt(team).PhaseIndex).IDPhase;
Restore.IDPlayer = records.ElementAt(team).IDPlayer;
Restore.IDContest = iDContest;
RecordBL.UpdateIDPhase(Restore);
}
else
{
//if phase out of range
}
}
}