public void DisplayStatistic(string statisticsData, MatchReportAggregations aggregationType, string aggregatedFieldName) { var isAverage = aggregationType == MatchReportAggregations.average; var displayString = (isAverage ? "Average" : "Median") + " Match " + aggregatedFieldName + ": " + statisticsData + ((aggregatedFieldName == "duration") ? "s" : ""); var newTextObject = Instantiate(dynamicTextPrefab, statisticsListObject.transform); newTextObject.GetComponent <Text>().text = displayString; }
/// <summary> /// Public method that can be called to request statistics from match report data. /// Takes a enum representing the aggregation we want returned, a string representing the fieldName and a callback as parameters. /// </summary> /// <param name="aggregationType">Enum representing the type of aggregation we want to retrieve.</param> /// <param name="fieldName">A string representing the name of the field we want to acquire statistics from.</param> /// <param name="callback">A callback taking a string as parameter, used to send the aggregated value back.</param> public void RequestAggregation(MatchReportAggregations aggregationType, string fieldName, System.Action <string> callback) { switch (aggregationType) { case MatchReportAggregations.average: StartCoroutine(GETMatchReportAverage(fieldName, callback)); break; case MatchReportAggregations.median: StartCoroutine(GETMatchReportMedian(fieldName, callback)); break; default: break; } }