Esempio n. 1
0
		public virtual void FromString(string aString) {
			string uncom = Base64.Base64Decode(aString);
			string[] s = uncom.Split(new char[] {'|'});
			GTDriver d = new GTDriver();
			d.FromString(s[0]);

			this.drivers.Add(d);
			d = new GTDriver();
			d.FromString(s[1]);
			this.drivers.Add(d);
			GTCar c = new GTCar();
			c.FromString(s[2]);
			this.cars.Add(c);
			c = new GTCar();
			c.FromString(s[3]);
			this.cars.Add(c);

			teamColor.r = (float) Convert.ToDouble(s[4]);
			teamColor.g = (float) Convert.ToDouble(s[5]);
			teamColor.b = (float) Convert.ToDouble(s[6]);
			teamColor.a = 1f;
			wheelColor.r = (float) Convert.ToDouble(s[7]);
			wheelColor.g = (float) Convert.ToDouble(s[8]);
			wheelColor.b = (float) Convert.ToDouble(s[9]);
			wheelColor.a = 1f;

			if(s[10].ToLower()=="true") {
				humanControlled = true;
			} else {
				humanControlled = false;
			}
			this.teamName = s[11];
			this.seasonPoints = Convert.ToInt32(s[12]);
			this.seasonWins =Convert.ToInt32(s[13]);
			this.cash = Convert.ToInt32(s[14]);
			this.reputation = Convert.ToInt32(s[15]);
			this.id = Convert.ToInt32(s[16]);

			DriverLibraryRecord rec = DriverLibrary.REF.driverByID(drivers[0].id);
			
			rec.assignedTeam = id;
			rec = DriverLibrary.REF.driverByID(drivers[1].id);
			 
			rec.assignedTeam = id; 

			ignoreFromRelegationAndPromotion = false;
		}
		public void FromString(string aString) {
			GTDriver.allDrivers = new List<GTDriver>();
			List<DriverLibraryRecord> availableDrivers = DriverLibrary.REF.drivers;
			for(int i = 0;i<availableDrivers.Count;i++) {
				availableDrivers[i].assignedTeam = 0;
			}
			GTDriver.allDrivers = new List<GTDriver>();

			ChampionshipSeason.ACTIVE_SEASON = (ChampionshipSeason) this;
			string[] split1 = aString.Split (new char[] {'%'});
			aString = split1[0];
			string[] split = aString.Split (new char[] {'|'});
			if(split.Length>1) {
				ChampionshipSeason.ACTIVE_SEASON.secondsPast = Convert.ToInt32(split[0]);
			}
			for(int i = 1;i<split.Length;i++) {
				ChampionshipSeasonLeague l = new ChampionshipSeasonLeague();
				if(split[i].Length>10) {
					l.FromString(split[i]);
					leagues.Add(l);
				}
			}
			split = split1[1].Split (new char[] {'|'});
			for(int i = 0;i<split.Length;i++) {
				if(split[i].Length>10) {
					GTDriver d = new GTDriver();
					d.FromString(split[i]);
				}
				
			}
			for(int i = 0;i<leagues.Count;i++) {
				leagues[i].postInit();
			}

			for(int i = 0;i<GTDriver.allDrivers.Count;i++) {
				GTDriver.allDrivers[i].initContract();
			}
		}