feat(ui): D.2b empty-slot art — UiItemList.CellEmptySprite stamps cells

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-22 11:03:19 +02:00
parent b8626401ad
commit 4785232523
2 changed files with 39 additions and 0 deletions

View file

@ -28,6 +28,23 @@ public sealed class UiItemList : UiElement
public Func<uint, (uint tex, int w, int h)>? SpriteResolve { get; set; }
private uint _cellEmptySprite;
/// <summary>Empty-slot sprite for THIS list's cells, resolved from the dat cell template
/// (retail attribute 0x1000000e -> catalog 0x21000037 prototype's ItemSlot_Empty; see
/// <see cref="Layout.ItemListCellTemplate.ResolveEmptySprite"/>). 0 = leave the
/// <see cref="UiItemSlot.EmptySprite"/> default (0x060074CF). Applied to every existing
/// AND future cell.</summary>
public uint CellEmptySprite
{
get => _cellEmptySprite;
set
{
_cellEmptySprite = value;
if (value != 0)
foreach (var c in _cells) c.EmptySprite = value;
}
}
/// <summary>The drag handler this list routes drops to (a panel controller).
/// Null = the list accepts no drops. Retail: UIElement_ItemList::m_dragHandler.</summary>
public IItemListDragHandler? DragHandler { get; private set; }
@ -53,6 +70,7 @@ public sealed class UiItemList : UiElement
public void AddItem(UiItemSlot cell)
{
cell.SpriteResolve ??= SpriteResolve;
if (_cellEmptySprite != 0) cell.EmptySprite = _cellEmptySprite;
// The list lays cells out procedurally (grid offset + scroll clip), so cells must be
// EXEMPT from the parent anchor pass — UiElement.DrawSelfAndChildren runs ApplyAnchor
// on every child after OnDraw, which would otherwise reset the scroll offset to each