feat(ui): complete retail cursor state machine
Port every reachable ClientUISystem cursor branch through the production DAT enum map, preserve global-default versus widget-local event ordering, and surface the registered OS fallback. Route all four toolbar stance indicators through the same combat toggle command as the key binding, with golden DAT and transition conformance coverage. Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
parent
05f6222865
commit
6fcc510d5d
16 changed files with 535 additions and 164 deletions
|
|
@ -9,11 +9,23 @@ namespace AcDream.App.Tests.UI;
|
|||
public sealed class RetailCursorCatalogTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(CursorFeedbackKind.TargetPending, 0x27u, 14, 14)]
|
||||
[InlineData(CursorFeedbackKind.TargetValid, 0x28u, 14, 14)]
|
||||
[InlineData(CursorFeedbackKind.TargetInvalid, 0x29u, 14, 14)]
|
||||
public void TargetUseCursorSpecs_matchClientUISystemUpdateCursorState(
|
||||
CursorFeedbackKind kind,
|
||||
[InlineData(RetailGlobalCursorKind.Default, 0x01u, 0, 0)]
|
||||
[InlineData(RetailGlobalCursorKind.DefaultFound, 0x02u, 0, 0)]
|
||||
[InlineData(RetailGlobalCursorKind.MeleeOrMissile, 0x03u, 0, 0)]
|
||||
[InlineData(RetailGlobalCursorKind.MeleeOrMissileFound, 0x04u, 0, 0)]
|
||||
[InlineData(RetailGlobalCursorKind.Magic, 0x05u, 0, 0)]
|
||||
[InlineData(RetailGlobalCursorKind.MagicFound, 0x06u, 0, 0)]
|
||||
[InlineData(RetailGlobalCursorKind.Examine, 0x0Au, 0, 0)]
|
||||
[InlineData(RetailGlobalCursorKind.ExamineFound, 0x0Bu, 0, 0)]
|
||||
[InlineData(RetailGlobalCursorKind.Use, 0x0Cu, 14, 14)]
|
||||
[InlineData(RetailGlobalCursorKind.UseFound, 0x0Du, 14, 14)]
|
||||
[InlineData(RetailGlobalCursorKind.Busy, 0x0Eu, 0, 0)]
|
||||
[InlineData(RetailGlobalCursorKind.BusyFound, 0x0Fu, 0, 0)]
|
||||
[InlineData(RetailGlobalCursorKind.TargetPending, 0x27u, 14, 14)]
|
||||
[InlineData(RetailGlobalCursorKind.TargetValid, 0x28u, 14, 14)]
|
||||
[InlineData(RetailGlobalCursorKind.TargetInvalid, 0x29u, 14, 14)]
|
||||
public void GlobalCursorSpecs_matchClientUISystemUpdateCursorState(
|
||||
RetailGlobalCursorKind kind,
|
||||
uint expectedEnum,
|
||||
int expectedHotspotX,
|
||||
int expectedHotspotY)
|
||||
|
|
@ -28,7 +40,7 @@ public sealed class RetailCursorCatalogTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void TargetUseCursorSpecs_resolveGoldenDatSurfaces()
|
||||
public void ReachableGlobalCursorSpecs_resolveGoldenDatSurfaces()
|
||||
{
|
||||
string? datDir = ResolveDatDir();
|
||||
if (datDir is null)
|
||||
|
|
@ -37,13 +49,30 @@ public sealed class RetailCursorCatalogTests
|
|||
using var dats = new DatCollection(datDir, DatAccessType.Read);
|
||||
var resolver = new RetailCursorResolver(dats, new object());
|
||||
|
||||
Assert.True(resolver.TryResolve(new RetailCursorSpec(0x27u, 14, 14), out var pending));
|
||||
Assert.True(resolver.TryResolve(new RetailCursorSpec(0x28u, 14, 14), out var valid));
|
||||
Assert.True(resolver.TryResolve(new RetailCursorSpec(0x29u, 14, 14), out var invalid));
|
||||
var expected = new Dictionary<RetailGlobalCursorKind, UiCursorMedia>
|
||||
{
|
||||
[RetailGlobalCursorKind.Default] = new(0x06004D68u, 0, 0),
|
||||
[RetailGlobalCursorKind.DefaultFound] = new(0x06004D69u, 0, 0),
|
||||
[RetailGlobalCursorKind.MeleeOrMissile] = new(0x06004D6Au, 0, 0),
|
||||
[RetailGlobalCursorKind.MeleeOrMissileFound] = new(0x06004D6Bu, 0, 0),
|
||||
[RetailGlobalCursorKind.Magic] = new(0x06004D6Cu, 0, 0),
|
||||
[RetailGlobalCursorKind.MagicFound] = new(0x06004D6Du, 0, 0),
|
||||
[RetailGlobalCursorKind.Examine] = new(0x06004D71u, 0, 0),
|
||||
[RetailGlobalCursorKind.ExamineFound] = new(0x06004D71u, 0, 0),
|
||||
[RetailGlobalCursorKind.Use] = new(0x06004D72u, 14, 14),
|
||||
[RetailGlobalCursorKind.UseFound] = new(0x06004D72u, 14, 14),
|
||||
[RetailGlobalCursorKind.Busy] = new(0x06004D74u, 0, 0),
|
||||
[RetailGlobalCursorKind.BusyFound] = new(0x06004D75u, 0, 0),
|
||||
[RetailGlobalCursorKind.TargetPending] = new(0x06004D73u, 14, 14),
|
||||
[RetailGlobalCursorKind.TargetValid] = new(0x06005E6Bu, 14, 14),
|
||||
[RetailGlobalCursorKind.TargetInvalid] = new(0x06005E6Au, 14, 14),
|
||||
};
|
||||
|
||||
Assert.Equal(new UiCursorMedia(0x06004D73u, 14, 14), pending);
|
||||
Assert.Equal(new UiCursorMedia(0x06005E6Bu, 14, 14), valid);
|
||||
Assert.Equal(new UiCursorMedia(0x06005E6Au, 14, 14), invalid);
|
||||
foreach (var (kind, cursor) in expected)
|
||||
{
|
||||
Assert.True(resolver.TryResolve(kind, out var actual), kind.ToString());
|
||||
Assert.Equal(cursor, actual);
|
||||
}
|
||||
}
|
||||
|
||||
private static string? ResolveDatDir()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue