Clean up logging

This commit is contained in:
Michal Pikulski
2025-11-10 13:03:36 +01:00
parent c99aad49f3
commit 3ebbecc277
38 changed files with 234 additions and 300 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections;
using AppleHills.Data.CardSystem;
using Core;
using Data.CardSystem;
using Pixelplacement;
using UI.DragAndDrop.Core;
@@ -63,24 +64,15 @@ namespace UI.CardSystem
/// </summary>
public void RevealCard()
{
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);
}
@@ -91,7 +83,7 @@ namespace UI.CardSystem
{
if (_cardData == null)
{
Debug.LogWarning("[AlbumCardPlacementDraggable] Cannot snap to slot - no card data assigned.");
Logging.Warning("[AlbumCardPlacementDraggable] Cannot snap to slot - no card data assigned.");
return;
}
@@ -126,7 +118,7 @@ namespace UI.CardSystem
TweenExtractedCardToSlot(extractedCard, () =>
{
// After animation completes
Debug.Log($"[AlbumCardPlacementDraggable] Card placement animation complete for {_cardData.Name}");
Logging.Debug($"[AlbumCardPlacementDraggable] Card placement animation complete for {_cardData.Name}");
// Notify that card was placed
OnCardPlacedInAlbum?.Invoke(this, _cardData);
@@ -137,13 +129,13 @@ namespace UI.CardSystem
}
else
{
Debug.LogWarning("[AlbumCardPlacementDraggable] Failed to extract AlbumCard from wrapper!");
Logging.Warning("[AlbumCardPlacementDraggable] Failed to extract AlbumCard from wrapper!");
}
}
}
else
{
Debug.LogWarning($"[AlbumCardPlacementDraggable] Could not find matching slot for card '{_cardData.Name}' (Zone: {_cardData.Zone}, Index: {_cardData.CollectionIndex})");
Logging.Warning($"[AlbumCardPlacementDraggable] Could not find matching slot for card '{_cardData.Name}' (Zone: {_cardData.Zone}, Index: {_cardData.CollectionIndex})");
}
}
@@ -171,7 +163,7 @@ namespace UI.CardSystem
Tween.LocalRotation(cardTransform, Quaternion.identity, snapDuration, 0f, Tween.EaseOutBack,
completeCallback: () =>
{
Debug.Log($"[AlbumCardPlacementDraggable] Tween complete for extracted card {card.name}, final height: {cardRect.sizeDelta.y}");
Logging.Debug($"[AlbumCardPlacementDraggable] Tween complete for extracted card {card.name}, final height: {cardRect.sizeDelta.y}");
onComplete?.Invoke();
});
}
@@ -200,21 +192,16 @@ namespace UI.CardSystem
protected override void OnPointerUpHook(bool longPress)
{
base.OnPointerUpHook(longPress);
Debug.Log($"[CLICK-TRACE-PLACEMENT] OnPointerUpHook on {name}, _wasDragged={_wasDragged}, _isRevealed={_isRevealed}, _waitingForPlacementTap={_waitingForPlacementTap}, longPress={longPress}");
_isHolding = false;
// 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)
@@ -222,34 +209,26 @@ namespace UI.CardSystem
{
if (!_isRevealed)
{
Debug.Log($"[CLICK-TRACE-PLACEMENT] {name} - First tap, revealing card");
// First tap: reveal the card
RevealCard();
_waitingForPlacementTap = true;
}
else if (_waitingForPlacementTap)
{
Debug.Log($"[CLICK-TRACE-PLACEMENT] {name} - Second tap, snapping to slot");
// Second tap: snap to slot
_waitingForPlacementTap = false;
SnapToAlbumSlot();
}
else
{
Debug.Log($"[CLICK-TRACE-PLACEMENT] {name} - Tap after reveal but not waiting for placement tap");
}
}
else if (_isDragRevealing)
{
Debug.Log($"[CLICK-TRACE-PLACEMENT] {name} - Was drag-revealed, auto-snapping");
// Was drag-revealed, auto-snap on release
_isDragRevealing = false;
SnapToAlbumSlot();
}
else
{
Debug.Log($"[CLICK-TRACE-PLACEMENT] {name} - Was dragged but no special handling");
}
}
/// <summary>
@@ -257,22 +236,13 @@ 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;

View File

@@ -1,4 +1,5 @@
using AppleHills.Data.CardSystem;
using Core;
using Data.CardSystem;
using UI.DragAndDrop.Core;
using UnityEngine;
@@ -133,7 +134,7 @@ namespace UI.CardSystem
// Keep preview hidden - it'll show when user taps to enlarge
previewCardDisplay.gameObject.SetActive(false);
Debug.Log($"[AlbumCardSlot] Setup preview card for {targetCardDefinition.Name} (hidden until tap)");
Logging.Debug($"[AlbumCardSlot] Setup preview card for {targetCardDefinition.Name} (hidden until tap)");
}
/// <summary>
@@ -152,7 +153,7 @@ namespace UI.CardSystem
// Guard: need prefab to spawn
if (albumCardPrefab == null)
{
Debug.LogWarning($"[AlbumCardSlot] No albumCardPrefab assigned for slot targeting {targetCardDefinition.name}");
Logging.Warning($"[AlbumCardSlot] No albumCardPrefab assigned for slot targeting {targetCardDefinition.name}");
return;
}
@@ -213,11 +214,11 @@ namespace UI.CardSystem
albumPage.RegisterAlbumCard(albumCard);
}
Debug.Log($"[AlbumCardSlot] Spawned owned card '{cardData.Name}' ({cardData.Rarity}) in slot");
Logging.Debug($"[AlbumCardSlot] Spawned owned card '{cardData.Name}' ({cardData.Rarity}) in slot");
}
else
{
Debug.LogWarning($"[AlbumCardSlot] Spawned prefab has no AlbumCard component!");
Logging.Warning($"[AlbumCardSlot] Spawned prefab has no AlbumCard component!");
Destroy(cardObj);
}
}
@@ -235,30 +236,30 @@ namespace UI.CardSystem
/// </summary>
public void OnPointerClick(PointerEventData eventData)
{
Debug.Log($"[CLICK-TRACE-SLOT] OnPointerClick on {name}, _isOccupiedPermanently={_isOccupiedPermanently}, _placedCard={((_placedCard != null) ? _placedCard.name : "NULL")}, _isPreviewShowing={_isPreviewShowing}, position={eventData.position}");
Logging.Debug($"[CLICK-TRACE-SLOT] OnPointerClick on {name}, _isOccupiedPermanently={_isOccupiedPermanently}, _placedCard={((_placedCard != null) ? _placedCard.name : "NULL")}, _isPreviewShowing={_isPreviewShowing}, position={eventData.position}");
// Only handle clicks if slot is empty
if (_isOccupiedPermanently || _placedCard != null)
{
Debug.Log($"[CLICK-TRACE-SLOT] {name} - Slot is occupied, ignoring");
Logging.Debug($"[CLICK-TRACE-SLOT] {name} - Slot is occupied, ignoring");
return;
}
// Only handle if we have a preview card setup
if (previewCardDisplay == null || targetCardDefinition == null)
{
Debug.Log($"[CLICK-TRACE-SLOT] {name} - No preview setup, ignoring");
Logging.Debug($"[CLICK-TRACE-SLOT] {name} - No preview setup, ignoring");
return;
}
if (_isPreviewShowing)
{
Debug.Log($"[CLICK-TRACE-SLOT] {name} - Preview is showing, hiding it");
Logging.Debug($"[CLICK-TRACE-SLOT] {name} - Preview is showing, hiding it");
HidePreview();
}
else
{
Debug.Log($"[CLICK-TRACE-SLOT] {name} - Preview is hidden, showing it");
Logging.Debug($"[CLICK-TRACE-SLOT] {name} - Preview is hidden, showing it");
ShowPreview();
}
}
@@ -293,7 +294,7 @@ namespace UI.CardSystem
Pixelplacement.Tween.LocalScale(previewCardDisplay.transform, _previewOriginalScale * previewEnlargedScale,
previewScaleDuration, 0f, Pixelplacement.Tween.EaseOutBack);
Debug.Log($"[AlbumCardSlot] Showing preview for {targetCardDefinition.Name}");
Logging.Debug($"[AlbumCardSlot] Showing preview for {targetCardDefinition.Name}");
}
/// <summary>
@@ -340,11 +341,11 @@ namespace UI.CardSystem
// Hide the preview card after returning to slot
previewCardDisplay.gameObject.SetActive(false);
Debug.Log($"[AlbumCardSlot] Preview hidden and reset for {targetCardDefinition.Name}");
Logging.Debug($"[AlbumCardSlot] Preview hidden and reset for {targetCardDefinition.Name}");
});
}
Debug.Log($"[AlbumCardSlot] Hiding preview for {targetCardDefinition.Name}");
Logging.Debug($"[AlbumCardSlot] Hiding preview for {targetCardDefinition.Name}");
}
/// <summary>
@@ -352,7 +353,7 @@ namespace UI.CardSystem
/// </summary>
public void DismissPreview()
{
Debug.Log($"[CLICK-TRACE-SLOT] DismissPreview called on {name}");
Logging.Debug($"[CLICK-TRACE-SLOT] DismissPreview called on {name}");
HidePreview();
}

View File

@@ -1,4 +1,5 @@
using UI.DragAndDrop.Core;
using Core;
using UI.DragAndDrop.Core;
using UnityEngine;
namespace UI.CardSystem.DragDrop
@@ -127,10 +128,10 @@ namespace UI.CardSystem.DragDrop
/// </summary>
public void SetInOpeningSlot(bool inSlot)
{
Debug.Log($"[BoosterPackDraggable] SetInOpeningSlot({inSlot}) called on {name}");
Logging.Debug($"[BoosterPackDraggable] SetInOpeningSlot({inSlot}) called on {name}");
SetDraggingEnabled(!inSlot); // Disable dragging when in opening slot
Debug.Log($"[BoosterPackDraggable] SetDraggingEnabled({!inSlot}) called");
Logging.Debug($"[BoosterPackDraggable] SetDraggingEnabled({!inSlot}) called");
canTapToOpen = inSlot; // Enable tap-to-open when in opening slot