Enhance ChargeProgressBar and Marketplace functionality; add owner exit handling and update skill button states
This commit is contained in:
@@ -14,6 +14,8 @@ public partial class ChargeProgressBar : ProgressBar
|
||||
public override void _Ready()
|
||||
{
|
||||
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()
|
||||
{
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user