public void Load(string file) { if (!IsLoaded) { Strengts.Clear(); var listItems = JsonConvert.DeserializeObject <List <UnitStrengthJsonData> >(Resources.Load <TextAsset>(file).text); listItems.ForEach(item => Strengts.Add(item.id, new UnitStrengthData(item))); IsLoaded = true; } }
public void SetFromExternalSource(IEnumerable <UnitStrengthData> strengths) { Strengts.Clear(); strengths.ToList().ForEach(item => Strengts.Add(item.Id, item)); IsLoaded = true; }