123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- 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<StringBuilder> _builderPool = new Pool<StringBuilder>();
- [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.db.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;
- }
- }
- }
|