feat(ui): D.2b item interaction + retail cursors + live character sheet
Lands the codex-worktree D.2b stream plus the extraction the 2026-07-02 UI architecture review mandated before commit: - ItemInteractionController: single owner of double-click use/equip/ container-open, targeted-use mode (health kits), drag-out drop; toolbar shortcut drags don't drop the real item. ItemEquipRules for multi-slot (coat) coverage via equip masks. - Cursor phase: CursorFeedbackController (semantic priority chain: drag > resize > window-move > target-mode > text) + RetailCursorCatalog (enums 0x27/0x28/0x29, hotspot 14,14; ClientUISystem::UpdateCursorState 0x00564630) resolved through the portal EnumIDMap chain by RetailCursorResolver; RetailCursorManager applies dat cursor art to the OS cursor. Register row AP-72 covers the OS standard-cursor fallback. - Character window goes live: CharacterSheetProvider owns sheet assembly, XP-curve/raise-cost math and the raise flow — extracted out of GameWindow per Code Structure Rule 1 instead of committing the ~430-line feature body there. Optimistic XP/credit debits go through eventful store APIs (new ClientObjectTable.UpdateInt64Property + LocalPlayerState.DebitIntProperty/DebitInt64Property) instead of raw property-dictionary writes; register row AP-73 covers the still-missing raise ledger (#163). - RetailWindowFrame: the shared nine-slice window mount recipe; the character window uses it, remaining windows migrate via #164. - Status-bar buttons toggle inventory/character windows; retail row-major backpack ordering; WorldSession.SendUseWithTarget + raise/train sends. GameWindow shrinks 14,214 -> 13,877 lines despite the new features; the sheet/raise logic is unit-tested in CharacterSheetProviderTests instead of trapped in the god object. Build green; full suite 3,286 tests pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
e3fc7ac5ba
commit
b7dc91a053
74 changed files with 6669 additions and 238 deletions
|
|
@ -3,6 +3,16 @@ using System.Collections.Generic;
|
|||
|
||||
namespace AcDream.App.UI;
|
||||
|
||||
/// <summary>Cell order for a multi-column <see cref="UiItemList"/>.</summary>
|
||||
public enum UiItemListFlow
|
||||
{
|
||||
/// <summary>Retail listbox bit 0 set: index advances across columns, then down rows.</summary>
|
||||
RowMajor,
|
||||
|
||||
/// <summary>Retail listbox bit 0 clear: index advances down rows, then across columns.</summary>
|
||||
ColumnMajor,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A container of item cells (port of retail UIElement_ItemList, class 0x10000031).
|
||||
/// Behavioral LEAF: it creates/owns its UiItemSlot children procedurally, so the
|
||||
|
|
@ -82,9 +92,16 @@ public sealed class UiItemList : UiElement
|
|||
LayoutCells();
|
||||
}
|
||||
|
||||
/// <summary>Grid columns (row-major). 1 = single column. Ignored in fill mode.</summary>
|
||||
/// <summary>Grid columns. 1 = single column. Ignored in fill mode.</summary>
|
||||
public int Columns { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Multi-column list flow. Retail UIElement_ListBox::UpdateLayout uses bit 0 of
|
||||
/// m_bitField: set = row-major, clear = column-major. Default preserves the
|
||||
/// existing toolbar/grid behavior; panel controllers select retail-specific flow.
|
||||
/// </summary>
|
||||
public UiItemListFlow Flow { get; set; } = UiItemListFlow.RowMajor;
|
||||
|
||||
/// <summary>Fixed cell width in grid mode. 0 = "fill the list" — the single cell sizes
|
||||
/// to the whole list (the toolbar single-slot legacy). Set >0 (with CellHeight) for a grid.</summary>
|
||||
public float CellWidth { get; set; }
|
||||
|
|
@ -107,8 +124,25 @@ public sealed class UiItemList : UiElement
|
|||
return (col * cellW, row * cellH);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pixel offset matching retail UIElement_ListBox::CalculateColumn/CalculateRow:
|
||||
/// row-major when bit 0 is set, column-major when it is clear.
|
||||
/// </summary>
|
||||
internal static (float x, float y) CellOffset(
|
||||
int index, int columns, int cellCount, UiItemListFlow flow, float cellW, float cellH)
|
||||
{
|
||||
int cols = columns < 1 ? 1 : columns;
|
||||
if (flow == UiItemListFlow.ColumnMajor)
|
||||
{
|
||||
int rows = Math.Max(1, RowCount(cellCount, cols));
|
||||
int col = index / rows, row = index % rows;
|
||||
return (col * cellW, row * cellH);
|
||||
}
|
||||
return CellOffset(index, cols, cellW, cellH);
|
||||
}
|
||||
|
||||
/// <summary>Position every cell per the current mode: fill (CellWidth<=0) sizes the single
|
||||
/// cell to the list; grid (CellWidth>0) tiles cells row-major, offset by the scroll position
|
||||
/// cell to the list; grid (CellWidth>0) tiles cells by <see cref="Flow"/>, offset by the scroll position
|
||||
/// with whole-row vertical clipping (cells fully outside the view are hidden).</summary>
|
||||
internal void LayoutCells()
|
||||
{
|
||||
|
|
@ -137,7 +171,7 @@ public sealed class UiItemList : UiElement
|
|||
|
||||
for (int i = 0; i < _cells.Count; i++)
|
||||
{
|
||||
var (x, baseY) = CellOffset(i, cols, CellWidth, CellHeight);
|
||||
var (x, baseY) = CellOffset(i, cols, _cells.Count, Flow, CellWidth, CellHeight);
|
||||
float top = baseY - scrollY;
|
||||
var cell = _cells[i];
|
||||
cell.Left = x; cell.Top = top; cell.Width = CellWidth; cell.Height = CellHeight;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue