namespace AcDream.App.UI;
///
/// Narrow numeric-state bridge for widgets imported from retail LayoutDesc data.
/// Controllers use retail state ids without knowing how names/media are stored.
///
public interface IUiDatStateful
{
uint ActiveRetailStateId { get; }
bool TrySetRetailState(uint stateId);
}
public static class RetailUiStateIds
{
public const uint Closed = 11u;
public const uint Open = 12u;
public const uint HideDetail = 0x10000006u;
public const uint ShowDetail = 0x10000007u;
public const uint ObjectSelected = 0x1000000Bu;
public const uint StackedItemSelected = 0x1000000Cu;
public const uint ItemSlotEmpty = 0x1000001Cu;
public const uint Maximized = 0x10000047u;
public const uint Minimized = 0x10000048u;
public const uint LockedUi = 0x10000063u;
public const uint UnlockedUi = 0x10000064u;
///
/// Campaign CC gate round 1 Batch B (GF-1/GF-8): retail's custom
/// radio-selection state pair, live-DAT-probe-confirmed on the Heritage
/// row (0x100003BF), Profession template (0x100003D9),
/// Appearance Face/Clothes sub-tabs (0x100003A9/0x100003AA),
/// and gender buttons (0x100003A7/0x100003A8). Named
/// UiStateInfo.Name strings, not media file ids — the buttons
/// author their state DESCRIPTORS under these two ids, with the actual
/// per-state art living either directly on the button (gender) or on a
/// single stateful face-segment child (heritage/template/sub-tabs).
/// See 's custom-selection-pair
/// bypass in UpdateVisualState.
///
public const uint Unselected = 0x10000016u;
public const uint Selected = 0x10000017u;
public static string StateName(uint stateId)
=> stateId switch
{
Closed => "Closed",
Open => "Open",
HideDetail => "HideDetail",
ShowDetail => "ShowDetail",
ObjectSelected => "ObjectSelected",
StackedItemSelected => "StackedItemSelected",
ItemSlotEmpty => "ItemSlot_Empty",
Maximized => "Maximized",
Minimized => "Minimized",
LockedUi => "LockedUI",
UnlockedUi => "UnlockedUI",
Unselected => "Unselected",
Selected => "Selected",
_ => "",
};
public static bool TryStateId(string stateName, out uint stateId)
{
stateId = stateName switch
{
"Closed" => Closed,
"Open" => Open,
"HideDetail" => HideDetail,
"ShowDetail" => ShowDetail,
"ObjectSelected" => ObjectSelected,
"StackedItemSelected" => StackedItemSelected,
"ItemSlot_Empty" => ItemSlotEmpty,
"Maximized" => Maximized,
"Minimized" => Minimized,
"LockedUI" => LockedUi,
"UnlockedUI" => UnlockedUi,
"Unselected" => Unselected,
"Selected" => Selected,
_ => 0u,
};
return stateId != 0;
}
}