public object Clone() { return(new PlayResult { PlayerGroupInfo = (PlayerGroupInfo)PlayerGroupInfo?.Clone(), Team1Score = (ScoreAmount)Team1Score?.Clone(), Team2Score = (ScoreAmount)Team2Score?.Clone() }); }
void applyScore(string scoringTeamAlias) { if (scoringTeamAlias == Team1Alias) { Team1Score++; Team1ScoreLabel.Text = Team1Score.ToString(); } else if (scoringTeamAlias == Team2Alias) { Team2Score++; Team2ScoreLabel.Text = Team2Score.ToString(); } }
public override string ToString() { StringBuilder result = new StringBuilder(); result.Append(Periods.StartTime.ToString("hh:mm:ss")); if (!String.IsNullOrEmpty(Pool)) { result.Append(" " + Pool.ToString()); } result.Append(": " + Team1 + " " + Team1Score.ToString() + " vs " + Team2Score.ToString() + " " + Team2); return(result.ToString()); }
private void PasswordGuessed(object sender, RoutedEventArgs e) { if (playerReady) { StackReadyPanel.Visibility = Visibility.Visible; // here is some problem (only in full screen mode) with refreshing points in label graphic structure if (TeamToPLay && PasswordAmountToQuess > 0) { Team2Score += 1; Team2ScoreContent = Team2Score.ToString() + " pkt"; Team2ScoreLabel.Refresh(); } else if (!TeamToPLay && PasswordAmountToQuess > 0) { Team1Score += 1; Team1ScoreContent = Team1Score.ToString() + " pkt"; Team1ScoreLabel.Refresh(); } Task.Factory.StartNew(() => { Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action(() => { Team1ScoreLabel.UpdateLayout(); })); }); Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action(() => { Team2ScoreLabel.UpdateLayout(); })); PasswordAmountToQuess--; GameIterations--; try { if (PasswordAmountToQuess == 0 && GameIterations > 0) { Timer.Stop(); TimeForClock = TimeChoosen; if (TeamToPLay) { TeamLabelContent = Team1List.ElementAt(0); PlayerLabelContent = Team1List.ElementAt(1); Team1List.RemoveRange(0, 2); TeamToPLay = team1; } else { TeamLabelContent = Team2List.ElementAt(0); PlayerLabelContent = Team2List.ElementAt(1); Team2List.RemoveRange(0, 2); TeamToPLay = team2; } TimerTextBlock.Visibility = Visibility.Hidden; PasswordAmountToQuess = (int)((PasswordAmount)this.PasswordsComboBox.SelectedItem); MessageBox.Show("Następny gracz!"); playerReady = false; } else if (GameIterations > 0) { Passwordclass PasswordList = new Passwordclass(); PasswordList = PasswordGameCollection.ElementAt(0); PasswordGameCollection.RemoveAt(0); PasswordLabelContent = PasswordList.Name; CategoryLabelContent = PasswordList.Category; } playerReady = false; if (GameIterations <= 0) { int result = Team2Score - Team1Score; if (result > 0) { MessageBox.Show("Koniec gry!\n Wygrała drużyna: " + Team2Name); } else if (result == 0) { MessageBox.Show("Koniec gry!\n REMIS!"); } else { MessageBox.Show("Koniec gry!\n Wygrała drużyna: " + Team1Name); } SetParametersDefault(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public string ToJson() { StringBuilder result = new StringBuilder(); result.Append('{'); result.Append("\"startTime\": \"" + (StartTime.HasValue ? StartTime.Value.ToString("HH:mm") : "--:--") + "\""); result.Append(", \"team1\": \"" + Team1 + "\""); if (!String.IsNullOrEmpty(Team1Flag)) { result.Append(", \"team1Flag\": \"" + Team1Flag + "\""); } result.Append(", \"team1Score\": " + Team1Score.ToString()); result.Append(", \"team2\": \"" + Team2 + "\""); if (!String.IsNullOrEmpty(Team2Flag)) { result.Append(", \"team2Flag\": \"" + Team2Flag + "\""); } result.Append(", \"team2Score\": " + Team2Score.ToString()); if (!String.IsNullOrEmpty(Pool)) { result.Append(", \"pool\": \"" + Pool + "\""); } else { result.Append(", \"pool\": \"\""); } if (Periods.CurrentPeriod != null) { result.Append(", \"period\": \"" + Periods.CurrentPeriod.Name + "\""); result.Append(", \"periodIsActive\": \"" + (Periods.CurrentPeriod.Status == GamePeriodStatus.Active ? "1" : "0") + "\""); result.Append(", \"timeRemaining\": \"" + GameTimeConverter.ToString(Periods.CurrentPeriod.TimeRemaining) + "\""); } else { result.Append(", \"period\": \"None\""); result.Append(", \"periodIsActive\": false"); result.Append(", \"timeRemaining\": \"0:00\""); } if (Parent != null && Parent.Parent != null) { result.Append(", \"shotClockTime\": \"" + Parent.Parent.ShotTime.ToString() + "\""); } else { result.Append(", \"shotClockTime\": \"0\""); } if (Result != GameResult.None) { result.Append(", \"hasCompleted\": true"); result.Append(", \"result\": \"" + ResultDescription + "\""); result.Append(", \"team1Points\": " + Team1Points.ToString()); result.Append(", \"team2Points\": " + Team2Points.ToString()); } else { result.Append(", \"hasCompleted\": false"); } result.Append('}'); return(result.ToString()); }