feat(ui): port retail jump power bar

Import gmFloatyPowerBarUI LayoutDesc 0x21000072, teach the meter factory its stateful single-image shape, and project the movement-owned retail jump charge through a focused retained controller. Preserve authored resize constraints and state-managed visibility, with named-decomp pseudocode plus controller, movement, and production-DAT conformance coverage.

Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-13 10:22:03 +02:00
parent 27619b2328
commit db03b4bda8
18 changed files with 3045 additions and 10 deletions

View file

@ -0,0 +1,73 @@
using AcDream.App.Input;
using AcDream.App.UI;
using AcDream.App.UI.Layout;
namespace AcDream.App.Tests.UI.Layout;
public sealed class JumpPowerbarControllerTests
{
private const uint JumpFill = 0x06001354u;
[Fact]
public void MovementCharge_ShowsUpdatesAndHidesAuthoredJumpMeter()
{
JumpChargeSnapshot state = default;
ImportedLayout layout = BuildLayout();
var visibility = new List<bool>();
using var controller = JumpPowerbarController.Bind(
layout, () => state, visibility.Add)!;
var meter = Assert.IsType<UiMeter>(layout.FindElement(JumpPowerbarController.MeterId));
Assert.Equal([false], visibility);
Assert.Equal(0f, meter.Fill());
Assert.Equal(JumpPowerbarController.JumpModeState, meter.ActiveRetailStateId);
Assert.Equal(JumpFill, meter.FrontTile);
state = new JumpChargeSnapshot(true, 0.35f);
controller.Tick();
Assert.Equal([false, true], visibility);
Assert.Equal(0.35f, meter.Fill());
state = new JumpChargeSnapshot(true, 1.4f);
controller.Tick();
Assert.Equal([false, true], visibility);
Assert.Equal(1f, meter.Fill());
state = default;
controller.Tick();
Assert.Equal([false, true, false], visibility);
Assert.Equal(0f, meter.Fill());
}
[Fact]
public void Bind_RejectsLayoutWithoutJumpModeMeter()
{
var root = new UiPanel();
var meter = new UiMeter { ElementId = JumpPowerbarController.MeterId };
var layout = new ImportedLayout(root, new Dictionary<uint, UiElement>
{
[JumpPowerbarController.MeterId] = meter,
});
Assert.Null(JumpPowerbarController.Bind(layout, () => default, _ => { }));
}
private static ImportedLayout BuildLayout()
{
var root = new UiPanel { Width = 610, Height = 25 };
var meter = new UiMeter
{
ElementId = JumpPowerbarController.MeterId,
Left = 5,
Top = 5,
Width = 600,
Height = 15,
};
meter.ConfigureStateFill(JumpPowerbarController.JumpModeState, JumpFill);
root.AddChild(meter);
return new ImportedLayout(root, new Dictionary<uint, UiElement>
{
[JumpPowerbarController.MeterId] = meter,
});
}
}