using Godot; using System.Collections.Generic; namespace BITKit; public interface IMetaDisplayElement { string Text { get; } Vector3 Position { get; } } public partial class UXMetaService : Control { #region 静态方法 private static readonly Queue AddQueue = new(); private static readonly Queue RemoveQueue = new(); private static readonly List Elements = new(); public static void Register(IMetaDisplayElement element) => AddQueue.Enqueue(element); public static void UnRegister(IMetaDisplayElement element) => RemoveQueue.Enqueue(element); #endregion #region 实例方法 private readonly Dictionary _dictionary = new(); #endregion /// /// 标签预制体 /// [Export] private PackedScene labelTemplate; /// /// 主要处理过程 /// /// public override void _Process(double delta) { //相机服务未初始化时返回 if(CameraService.Singleton is null)return; //处理添加队列 while (AddQueue.TryDequeue(out var newElement)) { if (!Elements.TryAdd(newElement)) continue; var instance = labelTemplate.Instantiate