feat(combat): port retail basic combat bar
Mount authored gmCombatUI, share one press/hold/release request state machine across DAT buttons and keybindings, and recover the exact 1.0s/0.8s power timing from matching retail x86. The same timer fixes jump charge, while ready-stance, response queueing, auto-repeat, layout binding, migration, and conformance coverage keep behavior architectural rather than panel-local. Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
parent
9958458318
commit
2215c76c7e
22 changed files with 1265 additions and 46 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using AcDream.App.Plugins;
|
||||
using AcDream.App.Combat;
|
||||
using AcDream.App.Rendering;
|
||||
using AcDream.App.UI.Layout;
|
||||
using AcDream.App.UI.Testing;
|
||||
|
|
@ -35,6 +36,10 @@ public sealed record RadarRuntimeBindings(
|
|||
SelectionState Selection,
|
||||
Action<bool> SetUiLocked);
|
||||
|
||||
public sealed record CombatRuntimeBindings(
|
||||
CombatState State,
|
||||
CombatAttackController Attacks);
|
||||
|
||||
public sealed record ToolbarRuntimeBindings(
|
||||
ClientObjectTable Objects,
|
||||
Func<IReadOnlyList<ShortcutEntry>> Shortcuts,
|
||||
|
|
@ -96,6 +101,7 @@ public sealed record RetailUiRuntimeBindings(
|
|||
VitalsRuntimeBindings Vitals,
|
||||
ChatRuntimeBindings Chat,
|
||||
RadarRuntimeBindings Radar,
|
||||
CombatRuntimeBindings Combat,
|
||||
ToolbarRuntimeBindings Toolbar,
|
||||
CharacterRuntimeBindings Character,
|
||||
InventoryRuntimeBindings Inventory,
|
||||
|
|
@ -125,6 +131,7 @@ public sealed class RetailUiRuntime : IDisposable
|
|||
MountRadar();
|
||||
MountChat();
|
||||
MountToolbar();
|
||||
MountCombat();
|
||||
MountCharacter();
|
||||
MountPlugins();
|
||||
MountInventory();
|
||||
|
|
@ -160,6 +167,7 @@ public sealed class RetailUiRuntime : IDisposable
|
|||
public CharacterSheetProvider CharacterSheetProvider => _bindings.Character.Provider;
|
||||
public ToolbarController? ToolbarController { get; private set; }
|
||||
public ToolbarInputController? ToolbarInputController { get; private set; }
|
||||
public CombatUiController? CombatUiController { get; private set; }
|
||||
public SelectedObjectController? SelectedObjectController { get; private set; }
|
||||
public UiViewport? PaperdollViewportWidget { get; private set; }
|
||||
public UiNineSlicePanel? InventoryFrame { get; private set; }
|
||||
|
|
@ -439,6 +447,54 @@ public sealed class RetailUiRuntime : IDisposable
|
|||
Console.WriteLine("[D.5.1] retail toolbar window from LayoutDesc importer (0x21000016).");
|
||||
}
|
||||
|
||||
private void MountCombat()
|
||||
{
|
||||
ImportedLayout? layout = Import(CombatUiController.LayoutId);
|
||||
if (layout is null)
|
||||
{
|
||||
Console.WriteLine("[M2] combat: LayoutDesc 0x21000073 not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
CombatUiController? controller = Layout.CombatUiController.Bind(
|
||||
layout,
|
||||
_bindings.Combat.State,
|
||||
_bindings.Combat.Attacks,
|
||||
visible =>
|
||||
{
|
||||
if (visible) Host.ShowWindow(WindowNames.Combat);
|
||||
else Host.HideWindow(WindowNames.Combat);
|
||||
});
|
||||
if (controller is null)
|
||||
{
|
||||
Console.WriteLine("[M2] combat: required controls missing in LayoutDesc 0x21000073.");
|
||||
return;
|
||||
}
|
||||
|
||||
CombatUiController = controller;
|
||||
UiElement root = layout.Root;
|
||||
RetailWindowFrame.Mount(
|
||||
Host.Root,
|
||||
root,
|
||||
_bindings.Assets.ResolveSprite,
|
||||
new RetailWindowFrame.Options
|
||||
{
|
||||
WindowName = WindowNames.Combat,
|
||||
Chrome = RetailWindowChrome.Imported,
|
||||
Left = Math.Max(0f, (Host.Root.Width - root.Width) * 0.5f),
|
||||
Top = Math.Max(0f, Host.Root.Height - root.Height - 10f),
|
||||
Visible = false,
|
||||
Resizable = false,
|
||||
ResizeX = false,
|
||||
ResizeY = false,
|
||||
ConstrainDragToParent = true,
|
||||
ContentClickThrough = false,
|
||||
Controller = controller,
|
||||
});
|
||||
controller.SyncVisibility();
|
||||
Console.WriteLine("[M2] retail combat bar from gmCombatUI LayoutDesc 0x21000073.");
|
||||
}
|
||||
|
||||
private (uint[] Peace, uint[] War, uint[]? Empty) LoadToolbarDigits()
|
||||
{
|
||||
uint[]? peace = null, war = null, empty = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue