feat(ui): D.2b empty-slot art — InventoryController applies per-list empty sprites
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
4785232523
commit
8c719cd3e9
2 changed files with 29 additions and 3 deletions
|
|
@ -62,7 +62,10 @@ public sealed class InventoryController
|
||||||
Func<uint> playerGuid,
|
Func<uint> playerGuid,
|
||||||
Func<ItemType, uint, uint, uint, uint, uint> iconIds,
|
Func<ItemType, uint, uint, uint, uint, uint> iconIds,
|
||||||
Func<int?> strength,
|
Func<int?> strength,
|
||||||
UiDatFont? datFont)
|
UiDatFont? datFont,
|
||||||
|
uint contentsEmptySprite,
|
||||||
|
uint sideBagEmptySprite,
|
||||||
|
uint mainPackEmptySprite)
|
||||||
{
|
{
|
||||||
_objects = objects;
|
_objects = objects;
|
||||||
_playerGuid = playerGuid;
|
_playerGuid = playerGuid;
|
||||||
|
|
@ -101,6 +104,12 @@ public sealed class InventoryController
|
||||||
_containerList.CellHeight = BackpackCellPx;
|
_containerList.CellHeight = BackpackCellPx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Per-list empty-slot art, resolved from the dat cell template (retail attr 0x1000000e
|
||||||
|
// -> catalog 0x21000037 prototype's ItemSlot_Empty). 0 = leave the UiItemSlot default.
|
||||||
|
if (_contentsGrid is not null) _contentsGrid.CellEmptySprite = contentsEmptySprite;
|
||||||
|
if (_containerList is not null) _containerList.CellEmptySprite = sideBagEmptySprite;
|
||||||
|
if (_topContainer is not null) _topContainer.CellEmptySprite = mainPackEmptySprite;
|
||||||
|
|
||||||
// Burden meter: vertical 11×58 bar (gmBackpackUI m_burdenMeter, retail direction 4).
|
// Burden meter: vertical 11×58 bar (gmBackpackUI m_burdenMeter, retail direction 4).
|
||||||
_burdenMeter = layout.FindElement(BurdenMeterId) as UiMeter;
|
_burdenMeter = layout.FindElement(BurdenMeterId) as UiMeter;
|
||||||
if (_burdenMeter is not null)
|
if (_burdenMeter is not null)
|
||||||
|
|
@ -132,8 +141,12 @@ public sealed class InventoryController
|
||||||
Func<uint> playerGuid,
|
Func<uint> playerGuid,
|
||||||
Func<ItemType, uint, uint, uint, uint, uint> iconIds,
|
Func<ItemType, uint, uint, uint, uint, uint> iconIds,
|
||||||
Func<int?> strength,
|
Func<int?> strength,
|
||||||
UiDatFont? datFont)
|
UiDatFont? datFont,
|
||||||
=> new InventoryController(layout, objects, playerGuid, iconIds, strength, datFont);
|
uint contentsEmptySprite = 0u,
|
||||||
|
uint sideBagEmptySprite = 0u,
|
||||||
|
uint mainPackEmptySprite = 0u)
|
||||||
|
=> new InventoryController(layout, objects, playerGuid, iconIds, strength, datFont,
|
||||||
|
contentsEmptySprite, sideBagEmptySprite, mainPackEmptySprite);
|
||||||
|
|
||||||
private void OnObjectChanged(ClientObject o) { if (Concerns(o)) Populate(); }
|
private void OnObjectChanged(ClientObject o) { if (Concerns(o)) Populate(); }
|
||||||
private void OnObjectMoved(ClientObject o, uint from, uint to)
|
private void OnObjectMoved(ClientObject o, uint from, uint to)
|
||||||
|
|
|
||||||
|
|
@ -240,6 +240,19 @@ public class InventoryControllerTests
|
||||||
Assert.Equal(0u, containers.GetItem(2)!.ItemId); // empty frame
|
Assert.Equal(0u, containers.GetItem(2)!.ItemId); // empty frame
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Empty_sprites_are_applied_to_the_three_lists()
|
||||||
|
{
|
||||||
|
var (layout, grid, containers, top, _, _, _, _) = BuildLayout();
|
||||||
|
InventoryController.Bind(layout, new ClientObjectTable(), () => Player,
|
||||||
|
iconIds: (_, _, _, _, _) => 0u, strength: () => 100, datFont: null,
|
||||||
|
contentsEmptySprite: 0x06004D20u, sideBagEmptySprite: 0x06005D9Cu, mainPackEmptySprite: 0x06005D9Cu);
|
||||||
|
|
||||||
|
Assert.Equal(0x06004D20u, grid.GetItem(0)!.EmptySprite); // a padded empty contents cell
|
||||||
|
Assert.Equal(0x06005D9Cu, containers.GetItem(0)!.EmptySprite); // a padded empty side-bag cell
|
||||||
|
Assert.Equal(0x06005D9Cu, top.GetItem(0)!.EmptySprite); // the main-pack cell
|
||||||
|
}
|
||||||
|
|
||||||
// Reads the text of the UiText caption child attached by the controller.
|
// Reads the text of the UiText caption child attached by the controller.
|
||||||
private static string CaptionText(UiElement host)
|
private static string CaptionText(UiElement host)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue