protected void UpdateDynamic(Unit unit) { var mods = FilterModifiers(unit.modifiers.Get <UnitModifier>()).ToList(); var old = dynamics.ToList(); dynamics.Clear(); int i = 0; for (; i < mods.Count; i++) { if (i < old.Count) { dynamics.Add(mods[i], old[i].Value); SendValue(old[i].Value, mods[i]); } else { CreateItem(mods[i]); } } for (; i < old.Count; i++) { Destroy(old[i].Value); } }
public void FillDictionary() { ResearchCostDictionary.Clear(); for (var i = 0; i < 18; i++) { ResearchCostDictionary.Add((ResearchType)i, researchCosts[i]); } }
// -------------------------------------------------------------------------- GetStyleSheet // -- The StyleSheet is used for styling the AAI editor windows -- // -- GetStyleSheet ----------------------------------------------------------------------- public void BuildStyleSheet(bool refresh = false) { if (aaiStyleSheets.Count != 0 && !refresh) { return; } aaiStyleSheets.Clear(); aaiStyleSheetsDictionary.Clear(); aaiStyleSheets = GetStylesheet(refresh); for (var i = 0; i < aaiStyleSheets.Count; i++) { aaiStyleSheetsDictionary.TryAddValue(aaiStyleSheets[i].name, aaiStyleSheets[i]); } }