using Core; using Core.SaveLoad; using UnityEngine; using UnityEngine.EventSystems; namespace UI.CardSystem.StateMachine.States { /// /// Placed in slot state - card is in an album slot and can be clicked to enlarge. /// Manages the parent slot reference. /// public class CardPlacedInSlotState : AppleState, IPointerClickHandler { private CardContext _context; private AlbumCardSlot _parentSlot; private void Awake() { _context = GetComponentInParent(); } public override void OnEnterState() { // Ensure card front is visible and facing camera // This is important when spawning cards directly into album (skipping booster flow) if (_context.CardDisplay != null) { _context.CardDisplay.gameObject.SetActive(true); _context.CardDisplay.transform.localRotation = Quaternion.Euler(0, 0, 0); } Logging.Debug($"[CardPlacedInSlotState] Card placed in slot: {_context.CardData?.Name}"); // Card is now part of the album, no special visuals needed // Just wait for interaction } /// /// Set the parent slot this card belongs to /// public void SetParentSlot(AlbumCardSlot slot) { _parentSlot = slot; } /// /// Get the parent slot /// public AlbumCardSlot GetParentSlot() { return _parentSlot; } public void OnPointerClick(PointerEventData eventData) { // Click to enlarge when in album Logging.Debug($"[CardPlacedInSlotState] Card clicked in slot, transitioning to enlarged state"); _context.StateMachine.ChangeState("AlbumEnlargedState"); } } }