modify scripts

This commit is contained in:
2025-11-08 19:04:38 +08:00
parent 4f782a638e
commit df7dc04cf1
33 changed files with 2929 additions and 17 deletions

View File

@ -36,6 +36,7 @@ namespace WordsToolkit.Scripts.GUI.Buttons.Boosts
private bool isActive;
private bool isAnimating;
protected override bool ShouldShowRewarded() => isRewarded && resourseToHoldBoost.GetValue() == 0;
protected override void OnEnable()
{
@ -70,6 +71,11 @@ namespace WordsToolkit.Scripts.GUI.Buttons.Boosts
priceObject.gameObject.SetActive(false);
countText.text = resourseToHoldBoost.GetValue().ToString();
}
else if (ShouldShowRewarded())
{
countTextObject.gameObject.SetActive(false);
priceObject.gameObject.SetActive(false);
}
else
{
countTextObject.gameObject.SetActive(false);
@ -96,6 +102,10 @@ namespace WordsToolkit.Scripts.GUI.Buttons.Boosts
{
ActivateBoost();
}
else if (ShouldShowRewarded())
{
return;
}
// If not, consume from the regular resource
else if (resourceManager.ConsumeWithEffects(resourceToPay, count))
{
@ -110,6 +120,13 @@ namespace WordsToolkit.Scripts.GUI.Buttons.Boosts
UpdatePriceDisplay();
}
protected override void ExecuteEvent()
{
if(isRewarded)
resourseToHoldBoost.Add(1);
base.ExecuteEvent();
}
protected virtual void ActivateBoost(bool hideButtons = true)
{
isAnimating = true;