acdream/src/AcDream.App/UI/Layout/SocialPanelRowText.cs
Erik ae77270939 fix(ui): fellowship checkbox count, row-text + ListBox Flush doc corrections, promote probe findings to assertions
Mechanism SHOULD-FIX 4: SocialFellowshipPageController's class doc said
0x1000026B holds "all three visible option checkboxes" — the fixture and
the decomp both authors FOUR (Ignore Fellowship Requests / Auto-Accept
Requests / Share XP / Share Loot, 0x10000270-0x10000273). Corrected.

Mechanism SHOULD-FIX 9: SocialPanelRowText.FindDeepest's doc promised
"the deepest UiText descendant" but the implementation returns the LAST
match in pre-order traversal order, which only equals the deepest when
the subtree is a single chain. Both real row templates ARE single
chains today, so behavior is unaffected — the doc now describes what the
code actually does instead of a stronger guarantee it doesn't implement.

Blast SHOULD-FIX 5: UiTemplateListBox.Flush()'s doc only mentioned the
ContentHeight reset; UiScrollablePanel.ClearContent() also resets scroll
position to 0, which the sibling UiItemList.Flush() (same method name,
different semantics) does NOT do. Documented explicitly, including the
UX cost this creates for a scrolled-in Friends/Squelch roster once its
scrollbar is wired (this fix round's blast MF-1) — flagged for whoever
revisits Friends/Squelch scrolling next rather than silently fixed as an
unasked behavior change.

Mechanism SHOULD-FIX 3: SocialPanelLiveMountProbeTests printed two
headline findings (the 0x10000492-authored-twice count, page exclusivity
after ActivateTabBehavior) without ever asserting them — a future
importer regression collapsing/dropping an instance, or breaking
exclusivity, could not fail this test. Both are now real assertions
(Assert.Equal(2, passupCount); exactly one page Visible and it is
Allegiance).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-12 03:44:05 +02:00

43 lines
2.1 KiB
C#

namespace AcDream.App.UI.Layout;
/// <summary>
/// Campaign FA slice FA3: shared row-text lookup for the social panel's
/// Friends/Squelch read-only list rows. Both row templates
/// (<c>0x2100005D</c>/<c>0x10000519</c> for Friends,
/// <c>0x21000060</c>/<c>0x10000541</c> for Squelch — FA3 live-mount probe)
/// author the SAME two-deep nested-text shape: a Type-3 row root, one
/// Type-0xC text child, and ONE MORE Type-0xC text grandchild at the
/// identical rect. Neither <c>gmFriendsUI</c> nor <c>gmSquelchUI</c> is in
/// this campaign's decompiled scope (lane A/B/C/D cover only Fellowship/
/// Allegiance), so which of the two carries the actual glyph flow is not
/// established from retail decomp — the innermost leaf is used here
/// (deepest-first is the common "structural wrapper, then label leaf"
/// shape elsewhere in this dat format).
/// </summary>
internal static class SocialPanelRowText
{
/// <summary>
/// Returns the LAST <see cref="UiText"/> found by a pre-order walk of
/// <paramref name="row"/> (row itself, then each child's own subtree in
/// order), or null if the built row contains no text element at all.
/// <b>Fix-round mechanism SF-9:</b> this equals the truly DEEPEST match
/// only when the subtree is a single chain — both real row templates
/// (Friends <c>0x10000519</c>, Squelch <c>0x10000541</c>) ARE single
/// chains (row root -&gt; one Type-0xC text child -&gt; one more Type-0xC
/// text grandchild, per the FA3 live-mount probe), so this method's
/// actual "last match in traversal order" behavior and the class doc's
/// "deepest" framing agree for both templates in production today. A
/// row template with a BRANCHING subtree (multiple text leaves at
/// different depths) would expose the difference.
/// </summary>
public static UiText? FindDeepest(UiElement row)
{
UiText? found = row as UiText;
foreach (UiElement child in row.Children)
{
if (FindDeepest(child) is { } deeper)
found = deeper;
}
return found;
}
}