private void gestionPartida() { clsPlayer ganador = null; Clients.Users(new List <string>(GameInfo.players.Keys)).empezarPartida(0); System.Threading.Thread.Sleep(1000); Clients.Users(new List <string>(GameInfo.players.Keys)).empezarPartida(1); System.Threading.Thread.Sleep(1000); Clients.Users(new List <string>(GameInfo.players.Keys)).empezarPartida(2); System.Threading.Thread.Sleep(1000); Clients.Users(new List <string>(GameInfo.players.Keys)).empezarPartida(3); Clients.Users(new List <string>(GameInfo.players.Keys)).actualizarTiempo(30); for (int i = 30; i >= 0; i--) { System.Threading.Thread.Sleep(1000); Clients.Users(new List <string>(GameInfo.players.Keys)).actualizarTiempo(i); } foreach (clsPlayer player in GameInfo.players.Values) { if (ganador == null || player.points > ganador.points) { ganador = player; } } Clients.Users(new List <string>(GameInfo.players.Keys)).gameEnd(ganador); }
public MiViewModel() { _player = new clsPlayer(); _counter = 30; _jugadoresConectados = 0; _points = 0; }
private clsPlayer getplayer(string playerName) { clsPlayer id = new clsPlayer(); foreach (clsPlayer player in PLAYERS_LOADED) { if (player.fName + " " + player.lName == playerName) { id = player; break; } } return(id); }
private void GetSelectedPlayerFullDetails(object parameter = null) { // Local variables clsPlayer objSelectedPlayer = null; Globals.enumMatchType objEnumMatchType = Globals.enumMatchType.ODI; Globals.enumCarrier objEnumCarrier = Globals.enumCarrier.Batting; try { if ((string)parameter == "Batsman1") { objSelectedPlayer = objMatchDetailsForUI.Batsman1; objEnumCarrier = Globals.enumCarrier.Batting; } //objBatsmanCarrierVisibility = Visibility.Visible; } else if ((string)parameter == "Batsman2") { objSelectedPlayer = objMatchDetailsForUI.Batsman2; objEnumCarrier = Globals.enumCarrier.Batting; } // objBatsmanCarrierVisibility = Visibility.Visible; } else if ((string)parameter == "Bowler") { objSelectedPlayer = objMatchDetailsForUI.Bowler; objEnumCarrier = Globals.enumCarrier.Bowling; } //objBatsmanCarrierVisibility = Visibility.Hidden; } if (objMatchDetailsForUI.MatchType == Globals.enumMatchType.ODI.ToString().ToUpper()) { objEnumMatchType = Globals.enumMatchType.ODI; } else if (objMatchDetailsForUI.MatchType == Globals.enumMatchType.Test.ToString().ToUpper()) { objEnumMatchType = Globals.enumMatchType.Test; } else if (objMatchDetailsForUI.MatchType == Globals.enumMatchType.T20I.ToString().ToUpper()) { objEnumMatchType = Globals.enumMatchType.T20I; } else if (objMatchDetailsForUI.MatchType == Globals.enumMatchType.IPL.ToString().ToUpper()) { objEnumMatchType = Globals.enumMatchType.IPL; } objSelectedPlayerForUC = objSelectedPlayer; objSelectedPlayerForUC = clsCrickBuzzData.GetPlayerCarrierDetails(objSelectedPlayer, objEnumCarrier, objEnumMatchType); //IsEnableFlyOut = true; } catch (Exception) { } }
private void btnCheckIn_Click(object sender, EventArgs e) { clsPlayer checkInPlayer = (clsPlayer)listPlayers.Items[listPlayers.SelectedIndex]; frmConfirm confirmChallengeGame = new frmConfirm(); confirmChallengeGame.SetConfirmText("Would you like to play a challenge game today?"); DialogResult result = confirmChallengeGame.ShowDialog(); clsMeetingAttendee newAttendee = new clsMeetingAttendee(); newAttendee.Player = checkInPlayer; newAttendee.LastGame = new clsChallengeGame(); newAttendee.PlayChallengeGame = (result == DialogResult.Yes); bindCheckedIn.Add(newAttendee); bindPlayers.Remove(checkInPlayer); bindCheckedIn.Sort = "PlayerFullNameAndChallengeGame"; meetingDataChanged = true; }
private void button1_Click(object sender, EventArgs e) { dsCountriesAllBindingSource.DataSource = null; dsCountriesAllBindingSource.DataMember = null; reportViewer1.RefreshReport(); dsCountriesAll.Tables["tblCountriesAll"].Rows.Clear(); int country1 = clsCountry.getCountryCode(cmbCountry1.SelectedItem.ToString()); int country2 = -1; if (cmbCountry2.SelectedIndex > 0) { country2 = clsCountry.getCountryCode(cmbCountry2.SelectedItem.ToString()); } string query = "SELECT [team1CountryId] AS Country, [team1Captain] AS Captain, [team2CountryId] AS PlayedAgainst, [matchDate] AS Date, [matchWonBy] AS Resutls FROM tblMatch WHERE [team1CountryId]=@p1 AND [team2CountryId]=@p2"; if (cmbCountry2.SelectedItem.ToString() == "*") { query = "SELECT [team1CountryId] AS Country, [team1Captain] AS Captain, [team2CountryId] AS PlayedAgainst, [matchDate] AS Date, [matchWonBy] AS Resutls FROM tblMatch WHERE [team1CountryId]=@p1 OR [team2CountryId]=@p1"; } SqlCeCommand com = new SqlCeCommand(query, connection.CON); if (cmbCountry2.SelectedItem.ToString() == "*") { com.Parameters.AddWithValue("@p1", country1); } else { com.Parameters.AddWithValue("@p1", country1); com.Parameters.AddWithValue("@p2", country2); } SqlCeDataAdapter ad = new SqlCeDataAdapter(com); //DataSet ds = new DataSet("tblCountriesAll"); ad.Fill(dsCountriesAll, "tblCountriesAll"); //Replacing values for (int i = 0; i < dsCountriesAll.Tables["tblCountriesAll"].Rows.Count; i++) { try { //string countryName = dsCountriesAll.Tables["tblCountriesAll"].Rows[i][0].ToString(); int captain = Convert.ToInt32(dsCountriesAll.Tables["tblCountriesAll"].Rows[i][1].ToString()); country1 = Convert.ToInt32(dsCountriesAll.Tables["tblCountriesAll"].Rows[i][0].ToString()); country2 = Convert.ToInt32(dsCountriesAll.Tables["tblCountriesAll"].Rows[i][2].ToString()); DateTime date = Convert.ToDateTime(dsCountriesAll.Tables["tblCountriesAll"].Rows[i][3].ToString()); int wonBy = Convert.ToInt32(dsCountriesAll.Tables["tblCountriesAll"].Rows[i][4].ToString()); dsCountriesAll.Tables["tblCountriesAll"].Rows[i][0] = clsCountry.getCountryName(country1); clsPlayer player = clsPlayer.getPlayer(captain); dsCountriesAll.Tables["tblCountriesAll"].Rows[i][1] = player.fName + " " + player.lName; dsCountriesAll.Tables["tblCountriesAll"].Rows[i][2] = clsCountry.getCountryName(country2); dsCountriesAll.Tables["tblCountriesAll"].Rows[i][3] = date.ToShortDateString(); dsCountriesAll.Tables["tblCountriesAll"].Rows[i][4] = clsCountry.getCountryName(wonBy) + " Won"; } catch (Exception ex) { clsMessages.showMessage(clsMessages.msgType.exclamation, "No matches data found for selected countries.\n" + ex.Message); return; } } dsCountriesAllBindingSource.DataSource = dsCountriesAll; dsCountriesAllBindingSource.DataMember = "tblCountriesAll"; reportViewer1.RefreshReport(); }