fix(combat): restore retail power bar layers

Preserve the authored gray track, trained-Recklessness range, live bright charge meter, and independent desired-power thumb while keeping Speed and Power over gray side regions. Correct retail text justification value 2 to left alignment and retain direct RenderSurface decoding in the texture inspection tool used to verify the assets.

Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-12 21:14:14 +02:00
parent 0f2d98c501
commit 256c1930bd
18 changed files with 200 additions and 32 deletions

View file

@ -21,6 +21,7 @@ public sealed class CombatUiControllerTests
GameplaySettings gameplay = GameplaySettings.Default;
using var controller = CombatUiController.Bind(
layout, combat, attacks, () => gameplay, value => gameplay = value,
() => false,
Labels, visibility.Add)!;
controller.SyncVisibility();
@ -45,12 +46,16 @@ public sealed class CombatUiControllerTests
GameplaySettings gameplay = GameplaySettings.Default;
using var controller = CombatUiController.Bind(
layout, combat, attacks, () => gameplay, value => gameplay = value,
() => true,
Labels, _ => { })!;
combat.SetCombatMode(CombatMode.Melee);
high.OnEvent(new UiEvent(0, high, UiEventType.MouseDown, Data1: 2, Data2: 2));
now = 4.5d;
Assert.Equal(0.5f, power.ScalarFill()!.Value, 3);
Assert.True(power.ScalarRangeVisible());
Assert.Equal(104f, power.ScalarRangeLeft, 3);
Assert.Equal(299f, power.ScalarRangeWidth, 3);
high.OnEvent(new UiEvent(0, high, UiEventType.MouseUp, Data1: 2, Data2: 2));
var attack = Assert.Single(sent);
@ -69,6 +74,7 @@ public sealed class CombatUiControllerTests
GameplaySettings gameplay = GameplaySettings.Default;
using var controller = CombatUiController.Bind(
layout, combat, attacks, () => gameplay, value => gameplay = value,
() => false,
Labels, _ => { })!;
var autoTarget = Assert.IsType<UiButton>(layout.FindElement(CombatUiController.AutoTargetId));
@ -79,6 +85,28 @@ public sealed class CombatUiControllerTests
Assert.False(gameplay.AutoTarget);
}
[Fact]
public void AuthoredPowerLabels_KeepGrayTrackAtSides_AndUseRetailAlignment()
{
var combat = new CombatState();
using var attacks = CreateAttacks(combat, () => 0d, []);
var (layout, _, _, power, _, _, _) = BuildLayout();
GameplaySettings gameplay = GameplaySettings.Default;
using var controller = CombatUiController.Bind(
layout, combat, attacks, () => gameplay, value => gameplay = value,
() => true, Labels, _ => { })!;
var speed = Assert.IsType<UiText>(layout.FindElement(CombatUiController.SpeedLabelId));
var powerLabel = Assert.IsType<UiText>(layout.FindElement(CombatUiController.PowerLabelId));
Assert.False(speed.Centered);
Assert.False(speed.RightAligned);
Assert.False(powerLabel.Centered);
Assert.True(powerLabel.RightAligned);
Assert.Equal(speed.Left + speed.Width - power.Left, power.ScalarRangeLeft, 3);
Assert.Equal(powerLabel.Left - power.Left - power.ScalarRangeLeft,
power.ScalarRangeWidth, 3);
}
private static readonly CombatUiLabels Labels = new(
"Speed", "Power", "Repeat Attacks", "Auto Target", "Keep in View",
"High", "Medium", "Low");
@ -110,7 +138,16 @@ public sealed class CombatUiControllerTests
var root = new UiPanel { Width = 610, Height = 90 };
var basic = new UiPanel();
var advanced = new UiPanel();
var power = new UiScrollbar { Width = 507, Height = 14, Horizontal = true };
var power = new UiScrollbar
{
Left = 13,
Top = 14,
Width = 507,
Height = 14,
Horizontal = true,
};
var speedLabel = new UiText { Left = 17, Top = 14, Width = 100, Height = 15 };
var powerLabel = new UiText { Left = 416, Top = 14, Width = 100, Height = 15 };
UiButton Button(uint id) => new(
new ElementInfo { Id = id, Type = 1, Width = 72, Height = 19 }, NoTex)
{
@ -137,6 +174,8 @@ public sealed class CombatUiControllerTests
[CombatUiController.BasicPanelId] = basic,
[CombatUiController.AdvancedPanelId] = advanced,
[CombatUiController.PowerControlId] = power,
[CombatUiController.SpeedLabelId] = speedLabel,
[CombatUiController.PowerLabelId] = powerLabel,
[CombatUiController.HighButtonId] = high,
[CombatUiController.MediumButtonId] = medium,
[CombatUiController.LowButtonId] = low,