using System.Collections; using System.Collections.Generic; using System.Text; using UnityEngine; using KairoEngine.Utilities; using QFSW.QC; using QFSW.QC.Utilities; using KairoEngine.Core; namespace KairoEngine.Utilities.Statistics { public static class StatisticsConsoleCommands { private static readonly Pool _builderPool = new Pool(); [Command("statistics-list", "List of statistics names")] private static string PrintStatistics() { QuantumConsole console = QuantumConsole.Instance; string result = ""; StringBuilder buffer = _builderPool.GetObject(); Color color = Color.white; buffer.Clear(); if(console != null) { QuantumTheme theme = console.GetTheme(); color = theme ? theme.SuccessColor : Color.white; } foreach (var stat in Statistics.instance.data) { result += stat.title; switch (stat.category) { case StatisticType.integer: result += " - " + ColorExtensions.ColorText(stat.GetInteger().ToString(), color); break; case StatisticType.time: result += " - " + ColorExtensions.ColorText(KairoEngine.Core.Utilities.TimeToString(stat.GetTime()), color); break; default: break; } buffer.AppendLine(result); result = ""; } result = buffer.ToString(); _builderPool.Release(buffer); return result; } } }