using System.Numerics; namespace AcDream.App.UI; /// /// Retained presentation of retail's ECM_UI display-string notice emitted by /// gmSmartBoxUI::UseTime @ 0x004D6E30 while portal-space cell blocking /// continues. It is a centered overlay, not a chat message. /// internal sealed class PortalWaitNoticeController : IDisposable { private readonly UiRoot _root; private readonly UiText _text; private UiText.Line[] _lines = []; private bool _disposed; public PortalWaitNoticeController(UiRoot root) { _root = root ?? throw new ArgumentNullException(nameof(root)); _text = new UiText { Name = "PortalSpaceWaitNotice", Left = 0f, Top = 0f, Width = root.Width, Height = root.Height, Anchors = AnchorEdges.Left | AnchorEdges.Top | AnchorEdges.Right | AnchorEdges.Bottom, Centered = true, OneLine = true, ClickThrough = true, ZOrder = int.MaxValue, DefaultColor = Vector4.One, Visible = false, }; _text.LinesProvider = () => _lines; _root.AddChild(_text); } public void Set(string? message) { ObjectDisposedException.ThrowIf(_disposed, this); if (string.IsNullOrEmpty(message)) { _text.Visible = false; _lines = []; return; } _lines = [new UiText.Line(message, Vector4.One)]; _text.Visible = true; } public void Dispose() { if (_disposed) return; _root.RemoveChild(_text); _disposed = true; } }