public void SavePlatoon() //реализует сохранение взвода { ReadData(); PlatoonsManager.AddPlatoon(new Platoon(NamePlatoon.text, BufferStudents)); PlatoonsManager.SavePlatoons(); PlatoonsHandler.Starter(SelectPlatoon, Table2, PlatoonNameLabel); CreatePanel.SetActive(false); }
public void SavePlatoon() //реализует сохранение взвода { ReadData(); PlatoonsManager.Platoons[PlatoonsManager.Platoons.FindIndex(x => x.NamePlatoon == SelectedPlatoon.NamePlatoon)] = new Platoon(NamePlatoon.text, BufferStudents); PlatoonsManager.SavePlatoons(); PlatoonsHandler.Starter(SelectPlatoon, Table2, PlatoonNameLabel); Invoke("UpdateHeadTable", (float)0.5); CreatePanel.SetActive(false); }
public void OpenPanel() //выполняет открытие меню редактирования списка студентов { CreatePanel.SetActive(true); SelectedPlatoon = PlatoonsManager.GetPlatoon(SelectPlatoon.captionText.text); NamePlatoon.text = SelectedPlatoon.NamePlatoon; Students = new List <Student>(SelectedPlatoon.Students); Debug.Log(Students.Count); Debug.Log(Students.ToArray()[0].NameStudent); Invoke("UpdateTable", (float)0.5); //задержка для подгрузки данных }
public void DeletePlatoonHandler() //реализует удаление взвода { PlatoonsManager.Platoons.RemoveAt(PlatoonsManager.Platoons.FindIndex(x => x.NamePlatoon == SelectedPlatoon.NamePlatoon)); PlatoonsHandler.SelectedPlatoon = null; SelectPlatoon.value = 0; PlatoonsManager.SavePlatoons(); PlatoonsHandler.Starter(SelectPlatoon, Table2, PlatoonNameLabel); Invoke("UpdateHeadTable", (float)0.5); OkNoPanel.SetActive(false); CreatePanel.SetActive(false); }
public static void Starter(Dropdown SelectPlatoon, UnityUITable.Table Table, Text PlatoonNameLabel)//реализует процесс инициализации { PlatoonsManager.LoadPlatoons(); SelectPlatoon.options.Clear(); foreach (Platoon platoon in PlatoonsManager.Platoons) { SelectPlatoon.options.Add(new Dropdown.OptionData(platoon.NamePlatoon)); } SelectPlatoon.RefreshShownValue(); SelectPlatoon.value = 0; OnChangePlatoonDropdownOut(SelectPlatoon, Table, PlatoonNameLabel); }
public static void OnChangePlatoonDropdownOut(Dropdown SelectPlatoon, UnityUITable.Table Table, Text PlatoonNameLabel) //внешний обработчик события изменения выбранного взвода { SelectedPlatoon = PlatoonsManager.GetPlatoon(SelectPlatoon.captionText.text); PlatoonNameLabel.text = "Взвод: " + SelectPlatoon.captionText.text; byte number = 1; Students.Clear(); foreach (Student student in SelectedPlatoon.Students) { Students.Add(new Student(student.NameStudent, number)); number++; } Table.UpdateContent(); }