private void OnEnclosureSelected(LevelID id) { // Destroy all existing editors foreach (TestAndMetricsEntryEditor editor in currentEditors) { Destroy(editor.gameObject); } // Clear out the list currentEditors.Clear(); // Foreach entry in the selected list, add an editor foreach (TestAndMetricsEntryData entry in UIParent.Data.TestAndMetrics.GetEntryList(id).Entries) { TestAndMetricsEntryEditor editor = Instantiate(editorPrefab, editorParent.transform); editor.Setup(id, entry, editorScroller); currentEditors.Add(editor); } // If the enclosure selected is the current enclosure, then add a new editor // that we can use to add more entries if (id == LevelID.Current()) { CreateAddingEntry(); } }
private void CreateAddingEntry() { TestAndMetricsEntryEditor editor = Instantiate(editorPrefab, editorParent.transform); editor.Setup(LevelID.Current(), null, editorScroller); editor.OnNewEntryCreated.AddListener(OnNewEntryCreated); currentEditors.Add(editor); }