using O5Kit.Core; namespace ADOFAIRenderer.UI; using UnityEngine; public class RendererUIManager : MonoBehaviour { private static RendererUIManager? _instance; public static RendererUIManager Instance { get { if (_instance == null) { var go = new GameObject("RendererUIManager"); DontDestroyOnLoad(go); _instance = go.AddComponent(); } return _instance; } private set => _instance = value; } public static O5Context Context => Instance._context; public O5WindowManager WindowManager => _windowManager; private O5Context _context = null!; private O5WindowManager _windowManager = null!; private void Awake() { _instance = this; _context = new O5Context( config: new O5Config { UIScale = 1.0f, MiddleClickToDefault = true, SliderSensitivity = 1.0f }, theme: O5Theme.Dark ); _windowManager = O5WindowManager.Create(_context, transform, "RendererMod_Canvas"); } private void Update() { O5Object.TickAll(); Context.Tooltip.Tick(); O5Kit.Input.O5ShortcutManager.HandleUpdate(); } private void OnDestroy() { _windowManager.Dispose(); _context.Dispose(); if (_instance == this) _instance = null; } }