public void SetGroup(MapLua.SaveLua.Army Owner, MapLua.SaveLua.Army.UnitsGroup Data, MapLua.SaveLua.Army.UnitsGroup Parent, bool root) { this.Owner = Owner; this.Source = Data; this.Parent = Parent; IsRoot = root; IsExpanded = Data.Expanded; Data.Instance = this; if (IsRoot) { GroupName.text = Owner.Name; //NameInputField.SetValue(Owner.Name); RemoveButton.SetActive(false); //UnitsCount.gameObject.SetActive(false); } else { GroupName.text = Source.Name; //NameInputField.SetValue(Source.Name); RemoveButton.SetActive(true); //UnitsCount.gameObject.SetActive(true); } UpdateValues(Source.Units.Count, Source.UnitGroups.Count); RenameEnd(); Selection.color = ColorNormal; GroupName.color = IsRoot ? NameRoot : NameGroup; }
public bool AddDataToArmy(SaveLua.Army ArmyData) { for (int c = 0; c < Data.Configurations.Length; c++) { for (int t = 0; t < Data.Configurations[c].Teams.Length; t++) { for (int a = 0; a < Data.Configurations[c].Teams[t].Armys.Count; a++) { if (Data.Configurations[c].Teams[t].Armys[a].Name == ArmyData.Name) { Data.Configurations[c].Teams[t].Armys[a].Data = ArmyData; return(true); } } } for (int a = 0; a < Data.Configurations[c].ExtraArmys.Count; a++) { if (Data.Configurations[c].ExtraArmys[a].Name == ArmyData.Name) { Data.Configurations[c].ExtraArmys[a].Data = ArmyData; return(true); } } } //No army found - Force new army if (Data.Configurations.Length > 0 && Data.Configurations[0].Teams.Length > 0) { Army NewArmy = new Army(); NewArmy.Name = ArmyData.Name; NewArmy.NoRush = new NoRusnOffset(); NewArmy.Data = ArmyData; Data.Configurations[0].Teams[0].Armys.Add(NewArmy); return(true); } return(false); // Unable to add new army }
public Army(string name) { Name = name; Data = new SaveLua.Army(); NoRush = new NoRusnOffset(); }