Working bottom-corner card display

This commit is contained in:
Michal Pikulski
2025-11-17 23:38:34 +01:00
parent b5364a2bbc
commit e18f1b9963
7 changed files with 49467 additions and 15232 deletions

View File

@@ -163,6 +163,25 @@ namespace UI.CardSystem.StateMachine
}
}
/// <summary>
/// Update card data without re-capturing original transform values.
/// Use this when assigning data to an already-initialized card (e.g., pending cards on drag).
/// This prevents changing OriginalScale when the card is already correctly sized.
/// </summary>
public void UpdateCardData(CardData data)
{
cardData = data;
_hasCompletedReveal = false; // Reset completion flag
// Don't re-capture OriginalScale/Position/Rotation
// This preserves the transform values captured during initial setup
if (cardDisplay != null)
{
cardDisplay.SetupCard(data);
}
}
/// <summary>
/// Get the card display component
/// </summary>

View File

@@ -32,6 +32,9 @@ namespace UI.CardSystem.StateMachine.States
_targetSlot = null;
_dragEndedDuringFlip = false;
// Reset scale to normal (in case transitioning from scaled state)
_context.RootTransform.localScale = Vector3.one;
// Show card back, hide card front
if (cardBackVisual != null)
{
@@ -70,7 +73,9 @@ namespace UI.CardSystem.StateMachine.States
}
// Step 3: Apply card data to context
context.SetupCard(cardData);
// Use UpdateCardData instead of SetupCard to preserve OriginalScale
// (card was already initialized with correct scale in SpawnCardInSlot)
context.UpdateCardData(cardData);
Logging.Debug($"[CardPendingFaceDownState] Assigned card data: {cardData.Name} ({cardData.Zone})");
// Step 4: Ask AlbumViewPage for target slot