Enhance ChargeProgressBar and Marketplace functionality; add owner exit handling and update skill button states

This commit is contained in:
2025-08-26 23:52:30 +02:00
parent 55c3ae212b
commit 421a31917d
2 changed files with 23 additions and 1 deletions

View File

@@ -13,7 +13,9 @@ public partial class ChargeProgressBar : ProgressBar
public override void _Ready()
{
Owner.ChildEnteredTree += OnNodeEntered;
Owner.ChildEnteredTree += OnNodeEntered;
Owner.TreeExiting += OnOwnerExiting;
ProgressBar.Hide();
SetupDependencies();
}
@@ -24,6 +26,18 @@ public partial class ChargeProgressBar : ProgressBar
ThrowComponent = throwComponent;
SetupDependencies();
}
private void OnOwnerExiting()
{
if (_throwInput != null)
{
_throwInput.ChargeStarted -= OnChargeStarted;
_throwInput.ChargeStopped -= OnChargeStopped;
_throwInput.ChargeUpdated -= OnChargeUpdated;
_throwInput = null;
}
ThrowComponent = null;
}
private void SetupDependencies()
{

View File

@@ -128,5 +128,13 @@ public partial class Marketplace : Control
private void OnSkillButtonPressed(SkillButton button)
{
SkillUnlockerComponent.SkillManager.ToggleSkillActivation(button.Data);
foreach (var btn in _skillButtons)
{
if (btn.Data.IsActive)
btn.Activate();
else
btn.Deactivate();
}
}
}