public override void LoadSave(object obj) { try { GenerationServiceSave save = obj as GenerationServiceSave; if (save != null) { save.Guard(); if (save.generators != null) { Generators.ClearGenerators(); foreach (var item in save.generators) { GeneratorData generatorData = Services.ResourceService.Generators.GetGeneratorData(item.generatorId); GeneratorLocalData localData = Services.ResourceService.GeneratorLocalData.GetLocalData(item.generatorId); Generators.AddGeneratorInner(new GeneratorInfo(item, generatorData, localData)); } } Generators.ProfitBoosts.Load(save.profitSave); Generators.TimeBoosts.Load(save.timeSave); IsLoaded = true; } else { LoadDefaults(); } } catch (Exception exception) { UnityEngine.Debug.LogException(exception); LoadDefaults(); } }
public override void LoadDefaults() { Generators.ClearGenerators(); Generators.ProfitBoosts.ClearAll(); Generators.TimeBoosts.ClearAll(); IsLoaded = true; }