예제 #1
0
 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;
     }
 }
예제 #2
0
 public void ClearParticipants()
 {
     if (!RaceIsOn)
     {
         Bolides.Clear();
         Loaders.Clear();
         Mechanics.Clear();
     }
     else
     {
         throw new Exception("Гонка уже началась! Сначала остановите гонку");
     }
 }
예제 #3
0
        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();
            }
        }
예제 #4
0
 public void SetFromExternalDataSource(IEnumerable <MechanicData> mechanics)
 {
     Mechanics.Clear();
     mechanics.ToList().ForEach(item => Mechanics.Add(item.PlanetId, item));
     IsLoaded = true;
 }
예제 #5
0
 public override void LoadDefaults()
 {
     Mechanics.Clear();
     ReparedViewCount = 0;
     IsLoaded         = true;
 }