Boosters giving now auto-proceeds

This commit is contained in:
Michal Pikulski
2025-12-19 16:46:30 +01:00
parent f19f87ce95
commit d1c7cc9645
2 changed files with 16 additions and 170 deletions

View File

@@ -4,7 +4,6 @@ using Core;
using Data.CardSystem;
using Pixelplacement;
using UnityEngine;
using UnityEngine.UI;
namespace UI.CardSystem
{
@@ -21,7 +20,6 @@ namespace UI.CardSystem
[SerializeField] private GameObject visualContainer;
[SerializeField] private RectTransform[] boosterImages; // Up to 3 booster pack visuals
[SerializeField] private RectTransform glowImage; // Single glow effect for all boosters
[SerializeField] private Button continueButton;
[Header("Animation Settings")]
[SerializeField] private float hoverAmount = 20f;
@@ -34,6 +32,10 @@ namespace UI.CardSystem
[SerializeField] private float tweenDuration = 0.8f;
[SerializeField] private float delayBetweenTweens = 0.2f;
[SerializeField] private float disappearScale = 0.2f;
[Header("Auto-Proceed Settings")]
[Tooltip("Time in seconds to display boosters before automatically proceeding with animation")]
[SerializeField] private float autoProceedDelay = 1f;
private Vector3[] _boosterInitialPositions;
private Vector3[] _boosterInitialScales;
@@ -75,12 +77,6 @@ namespace UI.CardSystem
_glowInitialScale = glowImage.localScale;
}
// Setup button listener
if (continueButton != null)
{
continueButton.onClick.AddListener(OnContinueClicked);
}
// Start hidden
if (visualContainer != null)
{
@@ -118,11 +114,6 @@ namespace UI.CardSystem
{
Instance = null;
}
if (continueButton != null)
{
continueButton.onClick.RemoveListener(OnContinueClicked);
}
}
/// <summary>
@@ -167,12 +158,6 @@ namespace UI.CardSystem
glowImage.localScale = _glowInitialScale;
}
// Enable the continue button
if (continueButton != null)
{
continueButton.interactable = true;
}
// Start idle hovering animation on all visible boosters (ping-pong)
for (int i = 0; i < visualCount; i++)
{
@@ -190,26 +175,13 @@ namespace UI.CardSystem
Tween.LocalScale(glowImage, glowPulseScale, glowPulseDuration, 0f, Tween.EaseOut, Tween.LoopType.PingPong);
}
// Wait for button click (handled by OnContinueClicked)
yield return null;
}
// Wait for configured delay before auto-proceeding
Logging.Debug($"[MinigameBoosterGiver] Displaying boosters for {autoProceedDelay} seconds");
yield return new WaitForSeconds(autoProceedDelay);
private void OnContinueClicked()
{
if (_currentSequence == null)
{
return; // Not in a sequence
}
// Disable and hide button to prevent double-clicks
if (continueButton != null)
{
continueButton.interactable = false;
continueButton.gameObject.SetActive(false);
}
// Start moving all boosters to backpack
StartCoroutine(MoveAllBoostersToBackpack());
// Auto-proceed with animation
Logging.Debug("[MinigameBoosterGiver] Auto-proceeding with booster animation");
yield return StartCoroutine(MoveAllBoostersToBackpack());
}
private IEnumerator MoveAllBoostersToBackpack()
@@ -301,12 +273,7 @@ namespace UI.CardSystem
{
visualContainer.SetActive(false);
}
// Show button again for next use
if (continueButton != null)
{
continueButton.gameObject.SetActive(true);
}
// Invoke completion callback
_onCompleteCallback?.Invoke();