using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using UnityEngine; using UnityEngine.UIElements; using BITKit; using BITKit.UX; using System.Linq; using UnityEngine.InputSystem; using Cysharp.Threading.Tasks; using System.Text; using System.IO; using System.Reflection; using System.Reflection.Emit; using UnityEngine.InputSystem.Interactions; using Label = UnityEngine.UIElements.Label; // ReSharper disable PossibleMultipleEnumeration namespace BITKit.Console { public class BITConsole : MonoBehaviour { [RuntimeInitializeOnLoadMethod] private static void Reload() { Application.logMessageReceivedThreaded += EnqueueLog; } [BITCommand] public static void Console_Exception_Print_StackTrace(int allow) { exceptionPrintStackTrace = allow is 1; } private static bool exceptionPrintStackTrace = false; private class CommandSelector { public VisualElement Container { get; set; } public int Index { get => _index; set { if (_methods.Length is 0) { _index = -1; return; } _index = (value+_methods.Length)%_methods.Length; Rebuild(); } } public event Action OnSelected; private int _index; private MethodInfo[] _methods=Array.Empty(); public void Rebuild() { Container.Clear(); for (var i = 0; i < _methods.Length; i++) { var method = _methods[i]; var button = Container.Create