public void Load(string file) { if (!IsLoaded) { Mechanics.Clear(); var listItems = JsonConvert.DeserializeObject <List <MechanicJsonData> >(Resources.Load <TextAsset>(file).text); listItems.ForEach(item => Mechanics.Add(item.planetId, new MechanicData(item))); IsLoaded = true; } }
public void ClearParticipants() { if (!RaceIsOn) { Bolides.Clear(); Loaders.Clear(); Mechanics.Clear(); } else { throw new Exception("Гонка уже началась! Сначала остановите гонку"); } }
public override void LoadSave(object obj) { MechanicServiceSave save = obj as MechanicServiceSave; if (save != null) { Mechanics.Clear(); save.Validate(); foreach (var kvp in save.mechanics) { Mechanics.Add(kvp.Key, new MechanicInfo(kvp.Value)); } ReparedViewCount = save.repairedViewCount; IsLoaded = true; } else { LoadDefaults(); } }
public void SetFromExternalDataSource(IEnumerable <MechanicData> mechanics) { Mechanics.Clear(); mechanics.ToList().ForEach(item => Mechanics.Add(item.PlanetId, item)); IsLoaded = true; }
public override void LoadDefaults() { Mechanics.Clear(); ReparedViewCount = 0; IsLoaded = true; }