// *** TOTAL SCORE *** public void TotalScore_RobberMode(RobberScore robScore, int robNo) { if (loadingFromDB) return; DealScore ts_score, ts_score_OLD; ts_score = (robScore as IMatchGetScore).GetScore(); ts_score_OLD = (DealScore) DB_Matches_TotalScores[robNo]; if (!ts_score.Equals(ts_score_OLD)) { //MessageBox.Show("saver [" + robNo + "] " + ts_score_OLD + " => " + ts_score); //delme DB_SaveMatchScore(robNo, ts_score); } }
public void SetTotalScore(RobberScore rs) { bool bNS = false, bEW = false; int iNS = 0, iEW = 0; int iNS_total = 0, iEW_total = 0; for (int i = 0; i < ScoreArray.Count; i++) { // если сдача незавершена if (ScoreArray[i] == null || ScoreArray[i].IsEmpty()) { rs.SetScore(iNS_total, iEW_total, false); return; } iNS += ScoreArray[i].NS_down; iEW += ScoreArray[i].EW_down; iNS_total += ScoreArray[i].NS_down; if (ScoreArray[i].NS_up != null) { for (int j = 0; j < ScoreArray[i].NS_up.Length; j++) { iNS_total += ScoreArray[i].NS_up[j]; } } iEW_total += ScoreArray[i].EW_down; if (ScoreArray[i].EW_up != null) { for (int j = 0; j < ScoreArray[i].EW_up.Length; j++) { iEW_total += ScoreArray[i].EW_up[j]; } } if (iEW >= 100) { if (bEW) { // Роббер завершен. rs.SetScore(iNS_total, iEW_total, true); return; } bEW = true; iNS = iEW = 0; } else if (iNS >= 100) { if (bNS) { // Роббер завершен. rs.SetScore(iNS_total, iEW_total, true); return; } bNS = true; iNS = iEW = 0; } } // Роббер не завершен rs.SetScore(iNS_total, iEW_total, false); }
public void SetTotalScore(RobberScore rs) { bool bNS = false, bEW = false; int iNS = 0, iEW = 0; int iNS_total = 0, iEW_total = 0; for (int i = 0; i < ScoreArray.Count; i++) { // если сдача незавершена if (ScoreArray[i] == null || ScoreArray[i].IsEmpty()) { rs.SetScore(iNS_total, iEW_total, false); return; } iNS += ScoreArray[i].NS_down; iEW += ScoreArray[i].EW_down; iNS_total += ScoreArray[i].NS_down; if (ScoreArray[i].NS_up != null) for (int j = 0; j < ScoreArray[i].NS_up.Length; j++) iNS_total += ScoreArray[i].NS_up[j]; iEW_total += ScoreArray[i].EW_down; if (ScoreArray[i].EW_up != null) for (int j = 0; j < ScoreArray[i].EW_up.Length; j++) iEW_total += ScoreArray[i].EW_up[j]; if (iEW >= 100) { if (bEW) { // Роббер завершен. rs.SetScore(iNS_total, iEW_total, true); return; } bEW = true; iNS = iEW = 0; } else if (iNS >= 100) { if (bNS) { // Роббер завершен. rs.SetScore(iNS_total, iEW_total, true); return; } bNS = true; iNS = iEW = 0; } } // Роббер не завершен rs.SetScore(iNS_total, iEW_total, false); }
// Подсчет total score роббера public static void SetRobberScore(Robber rob, RobberScore robTScore) { rob.SetTotalScore(robTScore); }