public void GetEntitiesByRaceType(RaceTypeEnum raceType, List <BaseGameEntity> objList) { foreach (var item in EntityDic) { if (item.Value.RaceType == raceType) { objList.Add(item.Value); } } }
private void RaceTypeCmb_DropDownClosed(object sender, EventArgs e) { switch (RaceTypeCmb.Text) { case "Best Lap": RaceType = RaceTypeEnum.BestLap; NoLapsBox.IsEnabled = false; PenaltyBox.IsEnabled = false; TimeLimitBox.IsEnabled = true; break; case "Total Time": RaceType = RaceTypeEnum.TotalTime; NoLapsBox.IsEnabled = true; TimeLimitBox.IsEnabled = false; PenaltyBox.IsEnabled = true; break; } }
public MainWindow() { InitializeComponent(); nextTimer = new Timer(); //var googleSearchText = File.ReadAllText("c:\\fril.json"); //JObject googleSearch = JObject.Parse(googleSearchText); // get JSON result objects into a list //IList<JToken> results = googleSearch["data"].Children().ToList(); // serialize JSON results into .NET objects //IList<CRaceJSONData> searchResults = new List<CRaceJSONData>(); //foreach (JToken result in results) //{ // CRaceJSONData searchResult = JsonConvert.DeserializeObject<CRaceJSONData>(result.ToString()); // searchResults.Add(searchResult); //} var pre = new PreWindow(); pre.ShowDialog(); int minTime = Settings.Default.minLapTime; lapMinTime = new TimeSpan(0, 0, minTime); RaceType = (RaceTypeEnum)pre.RaceType; if (pre.PilotList.Count == 0) { Close(); } if (pre.PilotList != null) { Pilots = pre.PilotList; } if (pre.RoundList != null) { Rounds = pre.RoundList; } penalty = pre.PenaltyCost; totalLaps = int.Parse(pre.NoLapsBox.Text); foreach (var round in Rounds) { foreach (CPilot pilotInRound in round.RoundPilots) { var pilotRound = new CPilotRound(); pilotRound.Pilot = pilotInRound; round.PilotsLaps.Add(pilotRound); pilotRound.Active = true; } } if (Pilots != null && Rounds != null && Rounds.Count > 0) { currRound = Rounds[0]; nextRound = Rounds[1]; SetupRound(currRound); } switch (RaceType) { case RaceTypeEnum.BestLap: DescLabel.Content = "Race Type: Best Lap"; penalty = 0; totalTimeCol.Visibility = Visibility.Collapsed; TopPilotLabel.Content = "Top Pilots - By Best Lap"; break; case RaceTypeEnum.TotalTime: DescLabel.Content = "Race Type: Total Time, In " + pre.NoLapsBox.Text + " Laps"; TopPilotLabel.Content = "Top Pilots - By Best Total Time"; break; } }
public bool IsEnemyRace(RaceTypeEnum src, RaceTypeEnum dst) { return(src != dst); }
public int RaceType2Int(RaceTypeEnum type) { return((int)type); }
public PreWindow() { InitializeComponent(); RaceType = RaceTypeEnum.TotalTime; }