Enhance ChargeProgressBar and Marketplace functionality; add owner exit handling and update skill button states
This commit is contained in:
@@ -13,7 +13,9 @@ public partial class ChargeProgressBar : ProgressBar
|
|||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
Owner.ChildEnteredTree += OnNodeEntered;
|
Owner.ChildEnteredTree += OnNodeEntered;
|
||||||
|
Owner.TreeExiting += OnOwnerExiting;
|
||||||
|
|
||||||
ProgressBar.Hide();
|
ProgressBar.Hide();
|
||||||
SetupDependencies();
|
SetupDependencies();
|
||||||
}
|
}
|
||||||
@@ -24,6 +26,18 @@ public partial class ChargeProgressBar : ProgressBar
|
|||||||
ThrowComponent = throwComponent;
|
ThrowComponent = throwComponent;
|
||||||
SetupDependencies();
|
SetupDependencies();
|
||||||
}
|
}
|
||||||
|
private void OnOwnerExiting()
|
||||||
|
{
|
||||||
|
if (_throwInput != null)
|
||||||
|
{
|
||||||
|
_throwInput.ChargeStarted -= OnChargeStarted;
|
||||||
|
_throwInput.ChargeStopped -= OnChargeStopped;
|
||||||
|
_throwInput.ChargeUpdated -= OnChargeUpdated;
|
||||||
|
_throwInput = null;
|
||||||
|
}
|
||||||
|
ThrowComponent = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void SetupDependencies()
|
private void SetupDependencies()
|
||||||
{
|
{
|
||||||
|
@@ -128,5 +128,13 @@ public partial class Marketplace : Control
|
|||||||
private void OnSkillButtonPressed(SkillButton button)
|
private void OnSkillButtonPressed(SkillButton button)
|
||||||
{
|
{
|
||||||
SkillUnlockerComponent.SkillManager.ToggleSkillActivation(button.Data);
|
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