Merge campaign-enter-portal into the round branch: login portal-space presentation

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-17 11:21:46 +02:00
commit 2f8c046aba
9 changed files with 568 additions and 17 deletions

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Numerics;
using System.Text;
using AcDream.Core.Items;
@ -163,7 +164,9 @@ public sealed class RetailUiAutomationProbe
{
var target = FindByDatElementId(datElementId);
if (target is null) return Fail($"element 0x{datElementId:X8} not found");
_root.OnMouseMove((int)target.CenterX, (int)target.CenterY);
// Same canvas→window conversion as ClickAt — see CanvasToWindow.
(int x, int y) = CanvasToWindow((int)target.CenterX, (int)target.CenterY);
_root.OnMouseMove(x, y);
return true;
}
@ -298,8 +301,30 @@ public sealed class RetailUiAutomationProbe
}
}
/// <summary>
/// Enter-world round (2026-08-17): element coordinates from the probe's
/// tree walk are CANVAS coordinates, but <see cref="UiRoot.OnMouseMove"/>/
/// <c>OnMouseDown</c>/<c>OnMouseUp</c> take WINDOW coordinates and map
/// window→canvas internally (<c>UiRoot.MapWindowToCanvas</c>). The two
/// spaces are identical on every ordinary screen (no
/// <see cref="UiRoot.FixedCanvasSize"/>), which is why every prior probe
/// gate passed — the character-select/chargen screens are the first
/// STRETCHED canvases this apparatus drove, and there the mismatch sent
/// every synthetic click to canvas·(canvas/window), i.e. nowhere near the
/// target element. Element-derived pointer paths therefore convert
/// canvas→window here before touching the root.
/// </summary>
private (int x, int y) CanvasToWindow(int x, int y)
{
Vector2 scale = _root.CanvasScale;
return scale == Vector2.One
? (x, y)
: ((int)MathF.Round(x * scale.X), (int)MathF.Round(y * scale.Y));
}
private void ClickAt(int x, int y)
{
(x, y) = CanvasToWindow(x, y);
Advance(16);
_root.OnMouseMove(x, y);
_root.OnMouseDown(UiMouseButton.Left, x, y);
@ -310,6 +335,8 @@ public sealed class RetailUiAutomationProbe
private void DragAt(int startX, int startY, int endX, int endY)
{
(startX, startY) = CanvasToWindow(startX, startY);
(endX, endY) = CanvasToWindow(endX, endY);
Advance(16);
_root.OnMouseMove(startX, startY);
_root.OnMouseDown(UiMouseButton.Left, startX, startY);