Harden keyboard and camera routing, inventory and vendor interactions, chat/emotes, relog portal flow, and paperdoll rendering. Add retail research, connected gate coverage, and release-gate validation.
191 lines
7.5 KiB
C#
191 lines
7.5 KiB
C#
using System;
|
|
|
|
namespace AcDream.App.UI.Layout;
|
|
|
|
/// <summary>
|
|
/// Mounts retail's two-tab Map/House panel — LayoutDesc <c>0x2100006E</c>
|
|
/// slot <c>0x1000018C</c>, <see cref="AcDream.App.UI.RetailPanelCatalog"/>
|
|
/// id <b>16</b>. Batch C (overnight hover/UI round, 2026-08-17), built on
|
|
/// the <see cref="SocialPanelController"/>/<see cref="OptionsPanelController"/>
|
|
/// recipe (Type-8 tab host, <see cref="UiTabPanel.ActivateTabBehavior"/>,
|
|
/// per-page scoped controllers).
|
|
///
|
|
/// <para>
|
|
/// <b>Slot/panelId/button — resolved, not guessed.</b> The FA campaign's own
|
|
/// full 16-slot <c>gmPanelUI::SetupChildren</c> dump
|
|
/// (<c>docs/research/2026-08-11-fa-panel-structure.md:927-933</c>) already
|
|
/// named slot <c>0x1000018C</c> as "gmMapUI+gmHouseUI pages", panel id 16 —
|
|
/// this session's <c>MapHousePanelSlotProbeTests</c> re-confirmed it live.
|
|
/// The toolbar button is <c>0x1000019A</c> (own authored
|
|
/// <c>P0x10000029 = 16</c>), one of three currently-ghosted panel buttons
|
|
/// (see <c>docs/research/2026-08-17-map-house-recon.md</c>).
|
|
/// </para>
|
|
///
|
|
/// <para>
|
|
/// <b>Tab table — live-DAT-confirmed.</b>
|
|
/// <c>button 0x100001F3 -> page 0x100001F6 (Map, DEFAULT)</c>,
|
|
/// <c>button 0x100001F4 -> page 0x100001F7 (House)</c>. The page roots are
|
|
/// themselves typed <c>0x10000026</c> (gmMapUI) / <c>0x10000025</c>
|
|
/// (gmHouseUI) in the DAT — <see cref="DatWidgetFactory"/> has no special
|
|
/// case for either id, so they build as generic containers (same as every
|
|
/// other unmodeled retail UI class); <see cref="MapPageController"/> and
|
|
/// <see cref="HousePageController"/> find their own signature children by
|
|
/// id underneath.
|
|
/// </para>
|
|
///
|
|
/// <para>
|
|
/// <b>Close button</b>: <c>0x100001F5</c> (Type 1, top-right at
|
|
/// <c>(276,0) 24x25</c>) — same authored position/size as the Social
|
|
/// panel's own close button, the established <c>gmPanelUI</c> sibling
|
|
/// convention.
|
|
/// </para>
|
|
/// </summary>
|
|
public sealed class MapHousePanelController : IRetainedPanelController
|
|
{
|
|
public const uint HostLayoutId = 0x2100006Eu;
|
|
public const uint SlotElementId = 0x1000018Cu;
|
|
|
|
private const uint MapButtonId = 0x100001F3u;
|
|
private const uint MapPageId = 0x100001F6u;
|
|
private const uint HouseButtonId = 0x100001F4u;
|
|
private const uint HousePageId = 0x100001F7u;
|
|
private const uint CloseButtonId = 0x100001F5u;
|
|
|
|
public sealed record Callbacks(
|
|
Action Toggle,
|
|
MapPageController.Bindings Map,
|
|
HousePageController.Bindings House);
|
|
|
|
private readonly UiTabPanel _tabPanel;
|
|
private readonly MapPageController? _map;
|
|
private readonly HousePageController? _house;
|
|
private readonly Action<uint, uint> _onActivePageChanged;
|
|
private bool _visible;
|
|
private bool _disposed;
|
|
|
|
public UiElement Root => _tabPanel;
|
|
public UiTabPanel TabPanel => _tabPanel;
|
|
|
|
private MapHousePanelController(
|
|
UiTabPanel tabPanel, MapPageController? map, HousePageController? house)
|
|
{
|
|
_tabPanel = tabPanel;
|
|
_map = map;
|
|
_house = house;
|
|
|
|
// Night-round review F2 (2026-08-17): this used to be House's
|
|
// outbound-HouseQuery fire-when-shown trigger; that trigger is
|
|
// REMOVED (former register row AD-107) now that HouseQuery is
|
|
// byte-decoded confirmed to fire once at retail's login-complete
|
|
// edge instead (see HousePageController.Bindings.OnShown's own
|
|
// updated doc). The "window shown AND my tab active" plumbing stays
|
|
// — it mirrors the social panel's Fellowship/Allegiance page-shown
|
|
// convention and remains available for a genuinely page-shown
|
|
// concern — but HousePageController.Bindings.OnShown is unwired
|
|
// (null) in production, so this call chain is currently a no-op.
|
|
_onActivePageChanged = (_, _) => FireHouseShownIfActive();
|
|
_tabPanel.ActivePageChanged += _onActivePageChanged;
|
|
}
|
|
|
|
/// <param name="rootInfo">The pre-Build <see cref="ElementInfo"/> tree
|
|
/// <paramref name="layout"/> was built from — <see cref="MapPageController"/>
|
|
/// needs it to read <c>m_pMap</c>'s own authored int/enum attrs, which
|
|
/// only exist on <see cref="ElementInfo"/>, not the built
|
|
/// <see cref="UiElement"/> tree.</param>
|
|
public static MapHousePanelController? Bind(
|
|
ElementInfo rootInfo, ImportedLayout layout, Callbacks callbacks)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(rootInfo);
|
|
ArgumentNullException.ThrowIfNull(layout);
|
|
ArgumentNullException.ThrowIfNull(callbacks);
|
|
|
|
if (layout.Root is not UiTabPanel tabPanel)
|
|
{
|
|
Console.WriteLine(
|
|
"[D.2b] MapHousePanelController.Bind: root did not build as UiTabPanel "
|
|
+ $"(actual type {layout.Root.GetType().Name}) — Map/House panel will not open.");
|
|
return null;
|
|
}
|
|
|
|
if (layout.FindElement(CloseButtonId) is UiButton close)
|
|
close.OnClick = callbacks.Toggle;
|
|
else
|
|
Console.WriteLine(
|
|
$"[D.2b] MapHousePanelController: close button 0x{CloseButtonId:X8} not found.");
|
|
|
|
UiElement? mapPage = UiElement.FindDescendant(tabPanel, MapPageId);
|
|
UiElement? housePage = UiElement.FindDescendant(tabPanel, HousePageId);
|
|
|
|
MapPageController? map = null;
|
|
if (mapPage is not null)
|
|
{
|
|
ElementInfo? mapPageInfo = FindInfo(rootInfo, MapPageId);
|
|
map = mapPageInfo is null
|
|
? null
|
|
: MapPageController.Bind(mapPage, mapPageInfo, callbacks.Map);
|
|
}
|
|
HousePageController? house = housePage is null
|
|
? null
|
|
: HousePageController.Bind(housePage, callbacks.House);
|
|
|
|
if (mapPage is null)
|
|
Console.WriteLine($"[D.2b] MapHousePanelController: Map page 0x{MapPageId:X8} not found.");
|
|
if (housePage is null)
|
|
Console.WriteLine($"[D.2b] MapHousePanelController: House page 0x{HousePageId:X8} not found.");
|
|
|
|
return new MapHousePanelController(tabPanel, map, house);
|
|
}
|
|
|
|
public void ActivateTabs() => _tabPanel.ActivateTabBehavior();
|
|
|
|
public bool IsShowingHouse => _tabPanel.ActivePageElementId == HousePageId;
|
|
|
|
public bool IsShowingMap => _tabPanel.ActivePageElementId == MapPageId;
|
|
|
|
public void ShowMap() => _tabPanel.SwitchTo(MapPageId);
|
|
|
|
public void ShowHouse() => _tabPanel.SwitchTo(HousePageId);
|
|
|
|
public void OnShown()
|
|
{
|
|
_visible = true;
|
|
FireHouseShownIfActive();
|
|
}
|
|
|
|
public void OnHidden() => _visible = false;
|
|
|
|
private void FireHouseShownIfActive()
|
|
{
|
|
if (_visible && IsShowingHouse)
|
|
_house?.OnShown();
|
|
}
|
|
|
|
/// <summary>Per-frame poll: Map's 5 s-gated refresh (cheap when not due)
|
|
/// and House's revision-gated row rebuild. Both stay unconditional
|
|
/// (unlike Friends/Squelch's DAT-locked rebuild) — Map's own cadence
|
|
/// gate and House's list compare are both cheap even while hidden.</summary>
|
|
public void Tick(double deltaSeconds)
|
|
{
|
|
if (_disposed) return;
|
|
_map?.Tick(deltaSeconds);
|
|
_house?.Tick();
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
if (_disposed) return;
|
|
_disposed = true;
|
|
_tabPanel.ActivePageChanged -= _onActivePageChanged;
|
|
}
|
|
|
|
private static ElementInfo? FindInfo(ElementInfo info, uint id)
|
|
{
|
|
if (info.Id == id) return info;
|
|
foreach (ElementInfo child in info.Children)
|
|
{
|
|
ElementInfo? found = FindInfo(child, id);
|
|
if (found is not null) return found;
|
|
}
|
|
return null;
|
|
}
|
|
}
|