public void SetDriverRelationship(float inRelationshipAmount, int inWeeksTogether, string inDriverName = null) { string str = !string.IsNullOrEmpty(inDriverName) ? inDriverName : this.Contract.GetTeam().GetDriver(this.driver).name; if (!this.mDictDriversRelationships.ContainsKey(str)) { this.mDictDriversRelationships.Add(str, new Mechanic.DriverRelationship() { numberOfWeeks = inWeeksTogether, relationshipAmount = inRelationshipAmount }); if (this.mDictRelationshipModificationHistory.ContainsKey(str)) { return; } this.mDictRelationshipModificationHistory.Add(str, new StatModificationHistory()); } else { if (this.mDriversRelationships == null) { return; } Mechanic.DriverRelationship map = this.mDriversRelationships.GetMap(str); map.numberOfWeeks = inWeeksTogether; map.relationshipAmount = inRelationshipAmount; } }
private Mechanic.DriverRelationship GenerateDriverRelationship(string inDriverName, int inWeeksTogether, float inRelationshipAmount) { if (string.IsNullOrEmpty(inDriverName) || this.mDictDriversRelationships.ContainsKey(inDriverName)) { return((Mechanic.DriverRelationship)null); } Mechanic.DriverRelationship driverRelationship = new Mechanic.DriverRelationship(); driverRelationship.numberOfWeeks = inWeeksTogether; driverRelationship.relationshipAmount = inRelationshipAmount; this.mDictDriversRelationships.Add(inDriverName, driverRelationship); if (!this.mDictRelationshipModificationHistory.ContainsKey(inDriverName)) { this.mDictRelationshipModificationHistory.Add(inDriverName, new StatModificationHistory()); } return(driverRelationship); }