namespace AcDream.App.UI.Layout;
///
/// Campaign FA slice FA3: shared row-text lookup for the social panel's
/// Friends/Squelch read-only list rows. Both row templates
/// (0x2100005D/0x10000519 for Friends,
/// 0x21000060/0x10000541 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 gmFriendsUI nor gmSquelchUI 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).
///
internal static class SocialPanelRowText
{
///
/// Returns the LAST found by a pre-order walk of
/// (row itself, then each child's own subtree in
/// order), or null if the built row contains no text element at all.
/// Fix-round mechanism SF-9: this equals the truly DEEPEST match
/// only when the subtree is a single chain — both real row templates
/// (Friends 0x10000519, Squelch 0x10000541) ARE single
/// chains (row root -> one Type-0xC text child -> 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.
///
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;
}
}