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
|
|
@ -18,11 +18,14 @@ public class UiRootInputTests
|
|||
{
|
||||
private readonly bool _handlesClick;
|
||||
public bool Clicked;
|
||||
public int Clicks;
|
||||
public int DoubleClicks;
|
||||
public ClickRecorder(bool handlesClick) => _handlesClick = handlesClick;
|
||||
public override bool HandlesClick => _handlesClick;
|
||||
public override bool OnEvent(in UiEvent e)
|
||||
{
|
||||
if (e.Type == UiEventType.Click) { Clicked = true; return true; }
|
||||
if (e.Type == UiEventType.Click) { Clicked = true; Clicks++; return true; }
|
||||
if (e.Type == UiEventType.DoubleClick) { DoubleClicks++; return true; }
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -45,6 +48,51 @@ public class UiRootInputTests
|
|||
Assert.True(btn.Clicked);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DoubleClick_EmitsRealDoubleClickEvent()
|
||||
{
|
||||
var root = new UiRoot { Width = 800, Height = 600 };
|
||||
var btn = new ClickRecorder(handlesClick: true) { Left = 5, Top = 5, Width = 120, Height = 14 };
|
||||
root.AddChild(btn);
|
||||
|
||||
root.Tick(0, nowMs: 1_000);
|
||||
root.OnMouseDown(UiMouseButton.Left, 20, 10);
|
||||
root.OnMouseUp(UiMouseButton.Left, 20, 10);
|
||||
root.Tick(0, nowMs: 1_300);
|
||||
root.OnMouseDown(UiMouseButton.Left, 20, 10);
|
||||
root.OnMouseUp(UiMouseButton.Left, 20, 10);
|
||||
|
||||
Assert.Equal(2, btn.Clicks);
|
||||
Assert.Equal(1, btn.DoubleClicks);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ItemDragReleasedOutsideUi_raisesOutsideReleaseEvent()
|
||||
{
|
||||
var root = new UiRoot { Width = 800, Height = 600 };
|
||||
var cell = new UiItemSlot { Left = 0, Top = 0, Width = 32, Height = 32 };
|
||||
cell.SetItem(0x50000A01u, 0x99u);
|
||||
root.AddChild(cell);
|
||||
object? payload = null;
|
||||
int releaseX = 0;
|
||||
int releaseY = 0;
|
||||
root.DragReleasedOutsideUi += (p, x, y) =>
|
||||
{
|
||||
payload = p;
|
||||
releaseX = x;
|
||||
releaseY = y;
|
||||
};
|
||||
|
||||
root.OnMouseDown(UiMouseButton.Left, 5, 5);
|
||||
root.OnMouseMove(20, 20);
|
||||
root.OnMouseUp(UiMouseButton.Left, 200, 200);
|
||||
|
||||
var drag = Assert.IsType<ItemDragPayload>(payload);
|
||||
Assert.Equal(0x50000A01u, drag.ObjId);
|
||||
Assert.Equal(200, releaseX);
|
||||
Assert.Equal(200, releaseY);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PlainWidget_insideDraggableWindow_doesNotEmitClick()
|
||||
{
|
||||
|
|
@ -327,14 +375,18 @@ public class UiRootInputTests
|
|||
root.AddChild(win);
|
||||
root.RegisterWindow("inventory", win);
|
||||
|
||||
Assert.False(root.IsWindowVisible("inventory"));
|
||||
Assert.True(root.ShowWindow("inventory"));
|
||||
Assert.True(win.Visible);
|
||||
Assert.True(root.IsWindowVisible("inventory"));
|
||||
Assert.True(root.HideWindow("inventory"));
|
||||
Assert.False(win.Visible);
|
||||
Assert.False(root.IsWindowVisible("inventory"));
|
||||
|
||||
Assert.False(root.ShowWindow("nope"));
|
||||
Assert.False(root.HideWindow("nope"));
|
||||
Assert.False(root.ToggleWindow("nope"));
|
||||
Assert.False(root.IsWindowVisible("nope"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue