upd: sync local changes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
iisaevandClaude Opus 5.5 committed 2026-10-16 16:18:16 +00:00
1 parent 7a30f4b8c5
commit 6884cd5374
36 files changed
+3363 -6

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
using Godot;
using Cthangover.Core.UI;
namespace Cthangover.Mods.Interface.Base.Lists
{
/// <summary>
/// Lightweight alternative to Widget for mod-authored controls. Has a simpler
/// lifecycle — just Construct() on first access and Destruct() on tree exit —
/// without the visibility interception and Show/Hide pipeline that Widget
/// carries. Use when the heavy Widget state machine would be overkill or
/// when the control's visibility is managed by Godot's native system.
/// </summary>
public abstract partial class ModWidget : Control, IUiLazyConstruct
{
private bool _constructed;
/// <summary>Idempotent construction gate: calls <see cref="Construct"/> exactly once, on the first invocation. Thread-safe for repeated external calls.</summary>
public void EnsureConstructed()
{
if (_constructed)
return;
_constructed = true;
Construct();
}
/// <summary>Runs <see cref="Destruct"/> once when the constructed control leaves the tree.</summary>
public override void _ExitTree()
{
if (_constructed)
Destruct();
}
protected abstract void Construct();
protected virtual void Destruct() { }
}
}