feat(ui): Gameplay tab — 14 retail CharacterOption-derived toggles
Phase L.0 (cont.) — third tab on the Settings shell, in the Easy-wins build order. Subset of retail's CharacterOption + CharacterOptions2 bitfield flags ported as bools (see acclient.h:3404+ enum). Local- only this phase per the brainstorm — server sync deferred to a later phase that will marshal the draft into the retail CharacterOption packet. GameplaySettings record exposes 14 named flags grouped by usage: · Combat: AutoTarget, AutoRepeatAttack, ToggleRun, AdvancedCombatUI, VividTargetingIndicator · Display: ShowTooltips, SideBySideVitals, CoordinatesOnRadar, SpellDuration, ShowHelm, ShowCloak · Interface: AllowGive, LockUI, UseMouseTurning Retail names + bit values are documented in field-level comments so the future server-sync phase has a 1:1 mapping. Defaults are typical-user starting points (NOT bit-exact to retail's 0x50C4A54A / 0x948700 masks); class-level remarks call out that defaults will be re-anchored to retail values once the wire-format is the load-bearing source. SettingsStore grows LoadGameplay / SaveGameplay using the existing SaveSection generic helper (added in the audio commit). All three non-keybind sections (display, audio, gameplay) now coexist in settings.json with non-destructive cross-section saves — verified by a new "all three sections coexist" round-trip test. SettingsVM grows the parallel gameplay state machine (gameplayPersisted / gameplayDraft / SetGameplay / onSaveGameplay). HasUnsavedChanges, Save, Cancel, ResetAllToDefaults all cover gameplay too. Constructor signature adds two more params; existing call sites (App startup + tests) updated. SettingsPanel.RenderGameplayTab replaces the L.0-shell placeholder — 14 Checkbox calls grouped under three Text+Separator headers, plus a footer note explaining the local-only-this-phase scope. The "Coming soon" placeholder test was retargeted from "Gameplay" to "Chat" since Gameplay is no longer a placeholder. GameWindow construction site loads gameplay on startup + writes via the SettingsStore on Save. Server-sync packet wiring is left as a TODO comment in the onSaveGameplay callback (next phase, after the protocol round-trip is in place). 14 new tests: · GameplaySettings record (3) — defaults pinned, value equality, with-expressions · SettingsStore gameplay (4) — missing-file → defaults, round-trip, partial-file fallback, all-three-sections coexist · SettingsVM gameplay (5) — initial draft, SetGameplay marks dirty, Save invokes callback, Cancel reverts, ResetAllToDefaults covers · SettingsPanel gameplay tab (2) — 8 spot-checked Checkboxes render only when active dotnet build green (0 warnings); dotnet test 1,276 / 1,276 green (243 Core.Net + 360 UI.Abstractions + 673 Core). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
53b1878c5c
commit
b7165e5b17
9 changed files with 539 additions and 59 deletions
|
|
@ -41,6 +41,11 @@ public sealed class SettingsVM
|
|||
private AudioSettings _audioDraft;
|
||||
private readonly Action<AudioSettings> _onSaveAudio;
|
||||
|
||||
// L.0 — Gameplay tab (subset of retail CharacterOption flags).
|
||||
private GameplaySettings _gameplayPersisted;
|
||||
private GameplaySettings _gameplayDraft;
|
||||
private readonly Action<GameplaySettings> _onSaveGameplay;
|
||||
|
||||
/// <summary>The action currently being rebound, or null when idle.</summary>
|
||||
public InputAction? RebindInProgress { get; private set; }
|
||||
|
||||
|
|
@ -63,8 +68,9 @@ public sealed class SettingsVM
|
|||
/// rebinds are pending.</summary>
|
||||
public bool HasUnsavedChanges
|
||||
=> !KeyBindingsEqual(_persisted, _draft)
|
||||
|| _displayPersisted != _displayDraft
|
||||
|| _audioPersisted != _audioDraft;
|
||||
|| _displayPersisted != _displayDraft
|
||||
|| _audioPersisted != _audioDraft
|
||||
|| _gameplayPersisted != _gameplayDraft;
|
||||
|
||||
/// <summary>The current Display draft. Panel reads from here;
|
||||
/// mutation goes through <see cref="SetDisplay"/>.</summary>
|
||||
|
|
@ -74,6 +80,10 @@ public sealed class SettingsVM
|
|||
/// mutation goes through <see cref="SetAudio"/>.</summary>
|
||||
public AudioSettings AudioDraft => _audioDraft;
|
||||
|
||||
/// <summary>The current Gameplay draft. Panel reads from here;
|
||||
/// mutation goes through <see cref="SetGameplay"/>.</summary>
|
||||
public GameplaySettings GameplayDraft => _gameplayDraft;
|
||||
|
||||
public SettingsVM(
|
||||
KeyBindings persisted,
|
||||
InputDispatcher dispatcher,
|
||||
|
|
@ -81,18 +91,23 @@ public sealed class SettingsVM
|
|||
DisplaySettings persistedDisplay,
|
||||
Action<DisplaySettings> onSaveDisplay,
|
||||
AudioSettings persistedAudio,
|
||||
Action<AudioSettings> onSaveAudio)
|
||||
Action<AudioSettings> onSaveAudio,
|
||||
GameplaySettings persistedGameplay,
|
||||
Action<GameplaySettings> onSaveGameplay)
|
||||
{
|
||||
_persisted = persisted ?? throw new ArgumentNullException(nameof(persisted));
|
||||
_dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
|
||||
_onSave = onSave ?? throw new ArgumentNullException(nameof(onSave));
|
||||
_displayPersisted = persistedDisplay ?? throw new ArgumentNullException(nameof(persistedDisplay));
|
||||
_onSaveDisplay = onSaveDisplay ?? throw new ArgumentNullException(nameof(onSaveDisplay));
|
||||
_audioPersisted = persistedAudio ?? throw new ArgumentNullException(nameof(persistedAudio));
|
||||
_onSaveAudio = onSaveAudio ?? throw new ArgumentNullException(nameof(onSaveAudio));
|
||||
_draft = CloneBindings(persisted);
|
||||
_displayDraft = persistedDisplay;
|
||||
_audioDraft = persistedAudio;
|
||||
_persisted = persisted ?? throw new ArgumentNullException(nameof(persisted));
|
||||
_dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
|
||||
_onSave = onSave ?? throw new ArgumentNullException(nameof(onSave));
|
||||
_displayPersisted = persistedDisplay ?? throw new ArgumentNullException(nameof(persistedDisplay));
|
||||
_onSaveDisplay = onSaveDisplay ?? throw new ArgumentNullException(nameof(onSaveDisplay));
|
||||
_audioPersisted = persistedAudio ?? throw new ArgumentNullException(nameof(persistedAudio));
|
||||
_onSaveAudio = onSaveAudio ?? throw new ArgumentNullException(nameof(onSaveAudio));
|
||||
_gameplayPersisted = persistedGameplay ?? throw new ArgumentNullException(nameof(persistedGameplay));
|
||||
_onSaveGameplay = onSaveGameplay ?? throw new ArgumentNullException(nameof(onSaveGameplay));
|
||||
_draft = CloneBindings(persisted);
|
||||
_displayDraft = persistedDisplay;
|
||||
_audioDraft = persistedAudio;
|
||||
_gameplayDraft = persistedGameplay;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -117,6 +132,18 @@ public sealed class SettingsVM
|
|||
_audioDraft = value ?? throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replace the entire Gameplay draft with <paramref name="value"/>.
|
||||
/// Local-only this phase — values persist on Save but don't yet
|
||||
/// flow to the server. When server-sync ships, the host's
|
||||
/// <c>onSaveGameplay</c> callback will marshal the draft into the
|
||||
/// retail <c>CharacterOption</c> wire bitmask.
|
||||
/// </summary>
|
||||
public void SetGameplay(GameplaySettings value)
|
||||
{
|
||||
_gameplayDraft = value ?? throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Begin rebinding <paramref name="action"/>. The supplied
|
||||
/// <paramref name="original"/> binding will be removed when the new
|
||||
|
|
@ -224,9 +251,10 @@ public sealed class SettingsVM
|
|||
/// </summary>
|
||||
public void ResetAllToDefaults()
|
||||
{
|
||||
_draft = KeyBindings.RetailDefaults();
|
||||
_displayDraft = DisplaySettings.Default;
|
||||
_audioDraft = AudioSettings.Default;
|
||||
_draft = KeyBindings.RetailDefaults();
|
||||
_displayDraft = DisplaySettings.Default;
|
||||
_audioDraft = AudioSettings.Default;
|
||||
_gameplayDraft = GameplaySettings.Default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -242,9 +270,11 @@ public sealed class SettingsVM
|
|||
_onSave(_draft);
|
||||
_onSaveDisplay(_displayDraft);
|
||||
_onSaveAudio(_audioDraft);
|
||||
_persisted = CloneBindings(_draft);
|
||||
_displayPersisted = _displayDraft;
|
||||
_audioPersisted = _audioDraft;
|
||||
_onSaveGameplay(_gameplayDraft);
|
||||
_persisted = CloneBindings(_draft);
|
||||
_displayPersisted = _displayDraft;
|
||||
_audioPersisted = _audioDraft;
|
||||
_gameplayPersisted = _gameplayDraft;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -254,9 +284,10 @@ public sealed class SettingsVM
|
|||
/// </summary>
|
||||
public void Cancel()
|
||||
{
|
||||
_draft = CloneBindings(_persisted);
|
||||
_displayDraft = _displayPersisted;
|
||||
_audioDraft = _audioPersisted;
|
||||
_draft = CloneBindings(_persisted);
|
||||
_displayDraft = _displayPersisted;
|
||||
_audioDraft = _audioPersisted;
|
||||
_gameplayDraft = _gameplayPersisted;
|
||||
CancelRebind();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue