using System; using Godot; using TBL.GodotSharp.Ui.AutoAdaption; namespace TBL.GodotSharp.Ui { /// /// Ui 根节点 /// public class UiRoot : Control where TEnumUiLayer : Enum { public override void _EnterTree() { Name = "UiRoot"; this.SetFullParent(); foreach (var uiLayerName in Enum.GetNames(typeof(TEnumUiLayer))) { var layer = uiLayerName == "Debug" ? new Control() : new AutoAdaptionUiRoot(); layer.Name = uiLayerName; layer.MouseFilter = MouseFilterEnum.Pass; AddChild(layer); if (layer is AutoAdaptionUiRoot) { layer.SetCenterParent(true); } else { layer.SetFullParent(); } } } } }