// ------------------------------------------------------------------------------------ // Detailed Results List // Generate main list IEnumerator GenerateDetailedResultsList() { Console.Instance.Write(DebugLevel.Full, MessageLevel.Log, "Generating list"); // Write to console yield return(null); ClearDetailedResultsList(); // Clear current list ClearDetailedResultsTitleEntryLists(); // Clear title lists DestroyContextEntry(); // Destroy the context object TestLogicBase logic = null; // Track previous logic string previousSuite = ""; // Track previous suite string previousType = ""; // Track previous type for (int i = 0; i < filteredResultsEntries.Count; i++) // Iterate filtered results { if (previousSuite != filteredResultsEntries[i].testEntry.suiteName || previousType != filteredResultsEntries[i].testEntry.typeName) // New suite or type { GenerateNewTitleEntry(filteredResultsEntries[i].testEntry); // Generate new title entry } if (!logic || filteredResultsEntries[i].testEntry.typeName != previousType) // If logic doesnt match previous type { logic = TestTypeManager.Instance.GetLogicInstanceFromName(filteredResultsEntries[i].testEntry.typeName); // Get logic instance } previousSuite = filteredResultsEntries[i].testEntry.suiteName; // Track previous suite previousType = filteredResultsEntries[i].testEntry.typeName; // Track previous type ResultsEntry newEntry = GenerateResultsEntry(resultsEntryPrefab); // Generate a ResultsEntry newEntry.Setup(filteredResultsEntries[i], logic); // Setup the instance if (entryHeight == 0) // Track entry height { entryHeight = newEntry.GetComponent <RectTransform>().sizeDelta.y; } listHeight -= entryHeight; // Track height for next entry } listContentRect.sizeDelta = new Vector2(listContentRect.sizeDelta.x, -listHeight); // Set content rect size }
// Create and expand context object IEnumerator ExpandContextObject(ResultsEntry inputEntry, TestDisplayBase display) { Console.Instance.Write(DebugLevel.Full, MessageLevel.Log, "Expanding context object"); // Write to console int entryIndex = FindEntryInDetailedResultsList(inputEntry); // Get index of selected entry activeContextEntry = inputEntry; // Track selected entry activeContextObject = Instantiate(display.resultsContextPrefab, listContentRect, false); // Create context object instance RectTransform contextObjectRect = activeContextObject.GetComponent <RectTransform>(); // Get rect contextObjectRect.anchoredPosition = new Vector2(0, (entryIndex + 1) * -listEntries[0].GetComponent <RectTransform>().sizeDelta.y); // Set position listContentRect.sizeDelta = new Vector2(listContentRect.sizeDelta.x, listContentRect.sizeDelta.y + contextObjectRect.sizeDelta.y); // Set size NudgeDetailedResultsListEntries(entryIndex, -contextObjectRect.sizeDelta.y); // Nudge entries ResultsContext resultsContext = activeContextObject.GetComponent <ResultsContext>(); // Get results context reference resultsContext.Setup(activeContextEntry); // Setup base of results context ResultsIOData resultsDataFull = new ResultsIOData(); // Create output data yield return(StartCoroutine(ResultsIO.Instance.FetchSpecificEntry(inputEntry.resultsEntryData.resultsData, (value => { resultsDataFull = value; })))); // Get full results data // SQLCHECK ResultsIOData resultsDataFullB = new ResultsIOData(); // Create output data if (TestRunner.Instance) { if (TestRunner.Instance.runnerType == RunnerType.Analytic) { yield return(StartCoroutine(SQL.SQLIO.FetchBaseline(inputEntry.resultsEntryData.resultsDataB, (value => { resultsDataFullB = value; })))); // Get full results data // SQLCHECK } else if (TestRunner.Instance.runnerType == RunnerType.AnalyticComparison) { yield return(StartCoroutine(ResultsIO.Instance.FetchSpecificEntry(inputEntry.resultsEntryData.resultsDataB, (value => { resultsDataFullB = value; })))); // Get full results data // SQLCHECK } } //if(inputEntry.resultsEntryData.resultsDataB != null) display.SetupResultsContext(resultsContext, resultsDataFull, resultsDataFullB); // Tell Display how to setup the results context }
// Hide and destroy context object void HideContextObject(ResultsEntry inputEntry) { Console.Instance.Write(DebugLevel.Full, MessageLevel.Log, "Hiding context object"); // Write to console int entryIndex = FindEntryInDetailedResultsList(inputEntry); // Get index of selected entry NudgeDetailedResultsListEntries(entryIndex, activeContextObject.GetComponent <RectTransform>().sizeDelta.y); // Nudge entries listContentRect.sizeDelta = new Vector2(listContentRect.sizeDelta.x, listContentRect.sizeDelta.y - activeContextObject.GetComponent <RectTransform>().sizeDelta.y); // Set size DestroyContextEntry(); // Destroy Resources.UnloadUnusedAssets(); // Cleanup previous textures }
// Find an entries index from its instance int FindEntryInDetailedResultsList(ResultsEntry inputEntry) { Console.Instance.Write(DebugLevel.Full, MessageLevel.Log, "Finding entry in list"); // Write to console for (int i = 0; i < listEntries.Count; i++) // Iterate current entries { if (listEntries[i] == inputEntry.gameObject) // If the entry matches { return(i); // Return the index } } return(-1); // Return fail }
// ------------------------------------------------------------------------------------ // Detailed Results Title Entry // Generate a new title entry void GenerateNewTitleEntry(TestEntry input) { string title = input.suiteName + " - " + input.typeName; // If new suite add new suite name to title ResultsEntry newEntry = GenerateResultsEntry(resultsEntryTitlePrefab); // Generate a results entry newEntry.SetupTitle(title); // Setup the title instance if (titleEntriesBelow.Count == 0) // If first entry { SetHoverTitleEntry(title); // Set hover title } titleEntriesBelow.Add(newEntry); // Add to list of titles below top of scroll rect listHeight -= newEntry.GetComponent <RectTransform>().sizeDelta.y; // Track height for next entry }
// Create and expand context object void ExpandContextObject(ResultsEntry inputEntry, TestDisplayBase display) { Console.Instance.Write(DebugLevel.Full, MessageLevel.Log, "Expanding context object"); // Write to console int entryIndex = FindEntryInDetailedResultsList(inputEntry); // Get index of selected entry activeContextEntry = inputEntry; // Track selected entry activeContextObject = Instantiate(display.resultsContextPrefab, listContentRect, false); // Create context object instance RectTransform contextObjectRect = activeContextObject.GetComponent <RectTransform>(); // Get rect contextObjectRect.anchoredPosition = new Vector2(0, (entryIndex + 1) * -listEntries[0].GetComponent <RectTransform>().sizeDelta.y); // Set position listContentRect.sizeDelta = new Vector2(listContentRect.sizeDelta.x, listContentRect.sizeDelta.y + contextObjectRect.sizeDelta.y); // Set size NudgeDetailedResultsListEntries(entryIndex, -contextObjectRect.sizeDelta.y); // Nudge entries ResultsContext resultsContext = activeContextObject.GetComponent <ResultsContext>(); // Get results context reference resultsContext.Setup(activeContextEntry); // Setup base of results context display.SetupResultsContext(resultsContext, inputEntry.resultsEntryData.resultsData); // Tell Display how to setup the results context }
// ------------------------------------------------------------------------------------ // Detailed Results Context Object // Toggle the context object public void ToggleContextObject(ResultsEntry inputEntry, TestDisplayBase display) { Console.Instance.Write(DebugLevel.Full, MessageLevel.Log, "Toggling context object for " + inputEntry); // Write to console if (activeContextObject == null) // If context object is null { ExpandContextObject(inputEntry, display); // Create and expand } else { if (activeContextEntry == inputEntry) // If selected entry matches current context { HideContextObject(inputEntry); // Hide it } else { HideContextObject(activeContextEntry); // Hide the current ExpandContextObject(inputEntry, display); // Create and expand } } RefreshMenu(); // Refresh menu - WORKAROUND }
// Move a title entry from one loist to another and update hover entry void MoveTitleEntryInLists(ResultsEntry input) { bool isAbove = false; // Set to track list found in foreach (ResultsEntry r in titleEntriesAbove) // Iterate above list { if (r == input) // If requested { isAbove = true; // Set true } } if (isAbove) // If requested is above { titleEntriesAbove.Remove(input); // Remove from above titleEntriesBelow.Insert(0, input); // Add to below } else { titleEntriesBelow.Remove(input); // Remove from below titleEntriesAbove.Insert(0, input); // Add to above } SetHoverTitleEntry(); // Set hove title }
// Setup the context object public void Setup(ResultsEntry inputResults) { activeResultsEntry = inputResults; // Track active results entry viewTestButton.onClick.AddListener(delegate { OnClickViewTest(); }); // Add listener for view test }