Mounts gmCharGenMainUI (enum 0x10000039, root 0x100003CC) via CharacterCreationUiController/CharacterCreationUiMountCoordinator, cloning CharacterManagementUiController's recipe. Master shell ports SetProgressState @0x004e7a10 (Olthoi tab-hide + redirect) and ListenToElementMessage @0x004e9450 (Back/Next/Finish/Help/Exit/Random nav) verbatim, with free tab navigation over all six pages. Heritage, Profession, Skills, and Town pages bind to CC3's RuntimeCharacterCreationState commands; Appearance and Summary mount as content-inert placeholders for CC6b/CC5. Live-DAT probing (CharacterCreationLiveDatTests) found two widget- mapping surprises the decomp's DynamicCast hints don't predict: the Profession slider's value field imports as an editable UiField (wired for direct numeric entry), and the avail/health/stamina/mana/credits displays author as UIElement_Button hosts whose Type-12 value child is swallowed by UiButton.ConsumesDatChildren — substituted with the button's own Label. No new DatWidgetFactory widget types were needed. Threads the installed DAT's real ChargenOptions into Runtime via the new RuntimeCharacterCreationState.InstallOptions, called from ContentEffectsAudioCompositionPhase.Compose (mirrors InstallSpellMetadata's pattern); headless keeps ChargenOptions.Empty unchanged. Wires CC3's F14 status-hook gap (ApplyCharacterCreated/ ApplyCreationFailed) to SessionStatusWriter for both graphical and headless hosts, and adds the CharacterCreation view/command seam through CurrentGameRuntimeAdapter and DeferredGameRuntimeStateCommands alongside CharacterSelection's existing shape. Register: AD-101/102/103, AP-212/213, TS-82 filed for the auto-gender- select interim default, the omitted ToD-account gate, the button-Label widget substitution, the Random-button approximation, the flat-listbox Skills simplification, and the Appearance/Summary placeholders. Runtime 1713/0 (was 1707), App 5117/13 skips (was 5101/6), Headless 165/0 unaffected, full solution Release build green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
86 lines
3.5 KiB
C#
86 lines
3.5 KiB
C#
using AcDream.Core.Net;
|
|
|
|
namespace AcDream.Runtime.Session;
|
|
|
|
public sealed record LiveSessionLifecycleBindings(
|
|
Func<WorldSession, LiveSessionBinding> Bind,
|
|
Action<RuntimeGenerationToken> Reset,
|
|
Action<string, int, string> Connecting,
|
|
Action Connected,
|
|
Action<LiveSessionRosterReport> Roster,
|
|
Action<LiveSessionCharacterSelection> Selected,
|
|
Action<LiveSessionCharacterSelection> Entered,
|
|
/// <summary>Campaign CC slice CC4: forwards
|
|
/// <see cref="ILiveSessionLifecycleHost.ApplyCharacterCreated"/>. Default
|
|
/// no-op preserves every existing positional/named construction site
|
|
/// that predates this field.</summary>
|
|
Action<RuntimeCharacterCreationIdentity>? CharacterCreated = null,
|
|
/// <summary>Campaign CC slice CC4: forwards
|
|
/// <see cref="ILiveSessionLifecycleHost.ApplyCreationFailed"/>.</summary>
|
|
Action<RuntimeCharacterCreationRejection>? CreationFailed = null);
|
|
|
|
/// <summary>
|
|
/// Focused adapter between the session lifetime owner and its composition
|
|
/// callbacks. It tracks only the exact borrowed session attached to the host;
|
|
/// domain and presentation state remain behind the supplied callbacks.
|
|
/// </summary>
|
|
public sealed class LiveSessionLifecycleHost : ILiveSessionLifecycleHost
|
|
{
|
|
private readonly LiveSessionLifecycleBindings _bindings;
|
|
private WorldSession? _boundSession;
|
|
|
|
public LiveSessionLifecycleHost(LiveSessionLifecycleBindings bindings)
|
|
{
|
|
_bindings = bindings ?? throw new ArgumentNullException(nameof(bindings));
|
|
ArgumentNullException.ThrowIfNull(bindings.Bind);
|
|
ArgumentNullException.ThrowIfNull(bindings.Reset);
|
|
ArgumentNullException.ThrowIfNull(bindings.Connecting);
|
|
ArgumentNullException.ThrowIfNull(bindings.Connected);
|
|
ArgumentNullException.ThrowIfNull(bindings.Roster);
|
|
ArgumentNullException.ThrowIfNull(bindings.Selected);
|
|
ArgumentNullException.ThrowIfNull(bindings.Entered);
|
|
}
|
|
|
|
public LiveSessionBinding BindSession(WorldSession session)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(session);
|
|
if (_boundSession is not null)
|
|
throw new InvalidOperationException("A live session is already attached to this host.");
|
|
|
|
LiveSessionBinding binding = _bindings.Bind(session);
|
|
_boundSession = session;
|
|
return binding;
|
|
}
|
|
|
|
public void ResetSessionState(
|
|
RuntimeGenerationToken retiringGeneration) =>
|
|
_bindings.Reset(retiringGeneration);
|
|
|
|
public void ReportConnecting(string host, int port, string user) =>
|
|
_bindings.Connecting(host, port, user);
|
|
|
|
public void ReportConnected() => _bindings.Connected();
|
|
|
|
public void ReportRoster(LiveSessionRosterReport roster) =>
|
|
_bindings.Roster(roster);
|
|
|
|
public void ApplySelectedCharacter(LiveSessionCharacterSelection selection) =>
|
|
_bindings.Selected(selection);
|
|
|
|
public void ApplyEnteredWorld(LiveSessionCharacterSelection selection) =>
|
|
_bindings.Entered(selection);
|
|
|
|
public void ApplyCharacterCreated(RuntimeCharacterCreationIdentity identity) =>
|
|
_bindings.CharacterCreated?.Invoke(identity);
|
|
|
|
public void ApplyCreationFailed(RuntimeCharacterCreationRejection rejection) =>
|
|
_bindings.CreationFailed?.Invoke(rejection);
|
|
|
|
public void DetachSession(WorldSession session)
|
|
{
|
|
if (!ReferenceEquals(_boundSession, session))
|
|
throw new InvalidOperationException(
|
|
"The live-session controller attempted to detach a session that is not bound.");
|
|
_boundSession = null;
|
|
}
|
|
}
|