public ChampionshipEntry_v1 GetEntry(Entity inEntity) { ChampionshipEntry_v1 championshipEntryV1 = (ChampionshipEntry_v1)null; if (inEntity is Driver) { int count = this.mDrivers.Count; for (int index = 0; index < count; ++index) { if (this.mDrivers[index].GetEntity <Driver>() == (Driver)inEntity) { championshipEntryV1 = this.mDrivers[index]; break; } } if (championshipEntryV1 == null) { championshipEntryV1 = this.GetInactiveEntry(inEntity); } } else { int count = this.mTeams.Count; for (int index = 0; index < count; ++index) { if (this.mTeams[index].GetEntity <Team>() == (Team)inEntity) { championshipEntryV1 = this.mTeams[index]; break; } } } return(championshipEntryV1); }
public void AddEntry(Entity inEntity, Championship inChampionship) { if (inEntity is Driver) { ChampionshipEntry_v1 inactiveEntry = this.GetInactiveEntry(inEntity); if (inactiveEntry != null) { this.mDrivers.Add(inactiveEntry); this.mInactiveDrivers.Remove(inactiveEntry); return; } } ChampionshipEntry_v1 championshipEntryV1 = new ChampionshipEntry_v1(); championshipEntryV1.Create(inEntity, inChampionship); if (inEntity is Driver) { this.mDrivers.Add(championshipEntryV1); this.mDrivers[this.mDrivers.Count - 1].SetStartingChampionshipPosition(); } else { this.mTeams.Add(championshipEntryV1); this.mTeams[this.mTeams.Count - 1].SetStartingChampionshipPosition(); } }
public void RemoveDriverEntryFromChampionship(Driver inDriver) { ChampionshipEntry_v1 championshipEntry = inDriver.GetChampionshipEntry(); if (championshipEntry != null && championshipEntry.races <= 0) { championshipEntry.championship.standings.RemoveEntry((Entity)inDriver); } inDriver.ResetChampionshipEntry(); }
private void MoveInactiveDrivers() { for (int index = this.mDrivers.Count - 1; index >= 0; --index) { ChampionshipEntry_v1 mDriver = this.mDrivers[index]; if (mDriver.isInactiveDriver()) { this.mDrivers.RemoveAt(index); this.mInactiveDrivers.Add(mDriver); } } }
public void AddDriverToChampionship(Driver inDriver) { if (!inDriver.IsMainDriver()) { return; } Championship championship = inDriver.Contract.GetTeam().championship; ChampionshipEntry_v1 championshipEntry = inDriver.GetChampionshipEntry(); bool flag = championshipEntry != null && championship != null && championship.standings.isEntryInactive(championshipEntry); if (championshipEntry != null && championshipEntry.championship == championship && !flag) { return; } championship.standings.AddEntry((Entity)inDriver, championship); }
public void AddDriverToChampionship(Driver inDriver, bool addRegardless = false) { Championship championship = inDriver.contract.GetTeam().championship; if (!inDriver.IsMainDriver() && !addRegardless && championship.series != Championship.Series.EnduranceSeries) { return; } ChampionshipEntry_v1 championshipEntry = inDriver.GetChampionshipEntry(); bool flag = championshipEntry != null && championship != null && championship.standings.isEntryInactive(championshipEntry); if (championshipEntry != null && championshipEntry.championship == championship && !flag) { return; } championship.standings.AddEntry((Entity)inDriver, championship); }
public bool isEntryInactive(ChampionshipEntry_v1 inEntry) { return(this.mInactiveDrivers.Contains(inEntry)); }