Working refactor of cleaned up card structure

This commit is contained in:
Michal Pikulski
2025-11-18 01:03:45 +01:00
parent 689e177c99
commit 64c304bb6d
18 changed files with 163 additions and 73 deletions

View File

@@ -56,11 +56,11 @@ namespace UI.CardSystem.StateMachine.States
{
if (_isFlipping) return true; // Already handling
// Step 1: Find AlbumViewPage
AlbumViewPage albumPage = Object.FindFirstObjectByType<AlbumViewPage>();
// Get AlbumViewPage from context (injected dependency)
var albumPage = context.AlbumViewPage;
if (albumPage == null)
{
Logging.Warning("[CardPendingFaceDownState] AlbumViewPage not found!");
Logging.Warning("[CardPendingFaceDownState] AlbumViewPage not injected!");
return true;
}
@@ -143,11 +143,11 @@ namespace UI.CardSystem.StateMachine.States
private void OnFlipComplete()
{
// Transition to dragging revealed state
// Pass target slot to next state (it will query AlbumViewPage for flip status)
// Pass target slot to next state (it will query AlbumService for flip status)
var card = _context.GetComponent<Card>();
if (card != null)
{
var draggingState = card.GetStateComponent<CardDraggingRevealedState>("DraggingRevealedState");
var draggingState = card.GetStateComponent<CardDraggingRevealedState>(CardStateNames.DraggingRevealed);
if (draggingState != null)
{
draggingState.SetTargetSlot(_targetSlot);
@@ -161,7 +161,7 @@ namespace UI.CardSystem.StateMachine.States
}
}
_context.StateMachine.ChangeState("DraggingRevealedState");
_context.StateMachine.ChangeState(CardStateNames.DraggingRevealed);
}
private void OnDisable()