Fix tab navigation on card select less wonky

This commit is contained in:
Michal Pikulski
2025-11-10 12:29:17 +01:00
parent a6e3413499
commit e369660a8f
5 changed files with 135 additions and 4 deletions

View File

@@ -63,15 +63,24 @@ namespace UI.CardSystem
/// </summary>
public void RevealCard()
{
if (_isRevealed) return;
Debug.Log($"[PAGE-NAV-DEBUG] RevealCard() called - _isRevealed: {_isRevealed}");
if (_isRevealed)
{
Debug.LogWarning($"[PAGE-NAV-DEBUG] Card already revealed, skipping reveal");
return;
}
_isRevealed = true;
Debug.Log($"[PAGE-NAV-DEBUG] Setting _isRevealed = true, card zone: {(_cardData != null ? _cardData.Zone.ToString() : "NULL")}");
if (flippableCard != null)
{
flippableCard.FlipToReveal();
}
Debug.Log($"[PAGE-NAV-DEBUG] Invoking OnCardRevealed event (subscribers: {(OnCardRevealed != null ? OnCardRevealed.GetInvocationList().Length : 0)})");
OnCardRevealed?.Invoke(this, _cardData);
}
@@ -199,9 +208,14 @@ namespace UI.CardSystem
// Cancel hold timer if running
if (_holdRevealCoroutine != null)
{
Debug.LogWarning($"[PAGE-NAV-DEBUG] OnPointerUpHook - CANCELLING HoldRevealTimer coroutine! Card was released before reveal completed.");
StopCoroutine(_holdRevealCoroutine);
_holdRevealCoroutine = null;
}
else
{
Debug.Log($"[PAGE-NAV-DEBUG] OnPointerUpHook - No hold timer to cancel (either completed or never started)");
}
// Handle tap (not dragged)
if (!_wasDragged)
@@ -243,15 +257,23 @@ namespace UI.CardSystem
/// </summary>
private IEnumerator HoldRevealTimer()
{
Debug.Log($"[PAGE-NAV-DEBUG] HoldRevealTimer started, waiting {holdRevealDelay}s...");
yield return new WaitForSeconds(holdRevealDelay);
Debug.Log($"[PAGE-NAV-DEBUG] HoldRevealTimer completed - _isRevealed: {_isRevealed}, _isHolding: {_isHolding}");
// If still holding after delay, reveal the card
if (!_isRevealed && _isHolding)
{
Debug.Log($"[PAGE-NAV-DEBUG] Hold timer conditions met - calling RevealCard() for zone: {(_cardData != null ? _cardData.Zone.ToString() : "NULL")}");
RevealCard();
_isDragRevealing = true;
Debug.Log("[AlbumCardDraggable] Card revealed via hold");
}
else
{
Debug.LogWarning($"[PAGE-NAV-DEBUG] Hold timer completed but conditions NOT met - _isRevealed: {_isRevealed}, _isHolding: {_isHolding}. Card will NOT reveal!");
}
_holdRevealCoroutine = null;
}