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
|
|
@ -93,7 +93,8 @@ public sealed class CombatUiController : IRetainedPanelController
|
|||
|
||||
_powerControl.SetScalarPosition(_attacks.DesiredPower);
|
||||
_powerControl.ScalarChanged = _attacks.SetDesiredPower;
|
||||
_powerControl.ScalarFill = () => _attacks.PowerBarLevel;
|
||||
_powerControl.ScalarFill = () => null;
|
||||
_powerControl.ScalarFillFollowsThumb = true;
|
||||
|
||||
BindAttackButton(_high, AttackHeight.High);
|
||||
BindAttackButton(_medium, AttackHeight.Medium);
|
||||
|
|
@ -201,12 +202,14 @@ public sealed class CombatUiController : IRetainedPanelController
|
|||
// the meter between the authored text rectangles leaves the base gray
|
||||
// track behind Speed/Power while the dark/live red textures occupy the
|
||||
// semantic power range between them.
|
||||
float left = speedLabel.Left + speedLabel.Width - _powerControl.Left;
|
||||
float right = powerLabel.Left - _powerControl.Left;
|
||||
_powerControl.ScalarRangeLeft = Math.Clamp(left, 0f, _powerControl.Width);
|
||||
_powerControl.ScalarRangeWidth = Math.Max(
|
||||
0f, Math.Clamp(right, 0f, _powerControl.Width)
|
||||
- _powerControl.ScalarRangeLeft);
|
||||
_powerControl.ScalarRangeProvider = () =>
|
||||
{
|
||||
float left = speedLabel.Left + speedLabel.Width - _powerControl.Left;
|
||||
float right = powerLabel.Left - _powerControl.Left;
|
||||
float clampedLeft = Math.Clamp(left, 0f, _powerControl.Width);
|
||||
return (clampedLeft, Math.Max(
|
||||
0f, Math.Clamp(right, 0f, _powerControl.Width) - clampedLeft));
|
||||
};
|
||||
}
|
||||
|
||||
private static void SetStaticText(UiText? text, string value, bool rightAligned)
|
||||
|
|
@ -233,6 +236,8 @@ public sealed class CombatUiController : IRetainedPanelController
|
|||
_attacks.StateChanged -= OnAttackStateChanged;
|
||||
_powerControl.ScalarChanged = null;
|
||||
_powerControl.ScalarFill = () => null;
|
||||
_powerControl.ScalarFillFollowsThumb = false;
|
||||
_powerControl.ScalarRangeProvider = null;
|
||||
_high.OnPressed = null;
|
||||
_high.OnReleased = null;
|
||||
_medium.OnPressed = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue