fix(combat): resolve power spans after layout
Derive the dark middle range from live post-anchor sibling geometry instead of freezing the inherited 800-pixel prototype during controller binding. Render the user-directed bright desired-power band independently from the absolute bar-left edge to the green thumb center. Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
parent
707add8539
commit
f8c174d707
8 changed files with 129 additions and 24 deletions
|
|
@ -21,6 +21,7 @@ public sealed class CombatLayoutConformanceTests
|
|||
_ => (0u, 0, 0),
|
||||
datFont: null,
|
||||
stringResolve: _ => "localized");
|
||||
ApplyAnchors(layout.Root);
|
||||
|
||||
var power = Assert.IsType<UiScrollbar>(
|
||||
layout.FindElement(CombatUiController.PowerControlId));
|
||||
|
|
@ -30,6 +31,15 @@ public sealed class CombatLayoutConformanceTests
|
|||
Assert.Equal(0x0600715Eu, power.ScalarRangeSprite);
|
||||
Assert.False(power.ScalarFillFromRight);
|
||||
|
||||
var speed = Assert.IsType<UiText>(
|
||||
layout.FindElement(CombatUiController.SpeedLabelId));
|
||||
var powerLabel = Assert.IsType<UiText>(
|
||||
layout.FindElement(CombatUiController.PowerLabelId));
|
||||
Assert.Equal(
|
||||
(8f, 507f, 12f, 100f, 411f, 100f),
|
||||
(power.Left, power.Width, speed.Left, speed.Width,
|
||||
powerLabel.Left, powerLabel.Width));
|
||||
|
||||
var repeat = Assert.IsType<UiButton>(
|
||||
layout.FindElement(CombatUiController.RepeatAttacksId));
|
||||
Assert.Equal(13f, repeat.FaceWidth);
|
||||
|
|
@ -42,4 +52,13 @@ public sealed class CombatLayoutConformanceTests
|
|||
Assert.Equal("localized", high.Label);
|
||||
Assert.IsType<UiText>(layout.FindElement(CombatUiController.SpeedLabelId));
|
||||
}
|
||||
|
||||
private static void ApplyAnchors(UiElement parent)
|
||||
{
|
||||
foreach (UiElement child in parent.Children)
|
||||
{
|
||||
child.ApplyAnchor(parent.Width, parent.Height);
|
||||
ApplyAnchors(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue