62 lines
1.9 KiB
C#
62 lines
1.9 KiB
C#
using Core;
|
|
using Core.SaveLoad;
|
|
using UnityEngine;
|
|
|
|
namespace UI.CardSystem.StateMachine.States
|
|
{
|
|
/// <summary>
|
|
/// Placed in slot state - card is in an album slot and can be clicked to enlarge.
|
|
/// Manages the parent slot reference.
|
|
/// </summary>
|
|
public class CardPlacedInSlotState : AppleState, ICardClickHandler
|
|
{
|
|
private CardContext _context;
|
|
private AlbumCardSlot _parentSlot;
|
|
|
|
private void Awake()
|
|
{
|
|
_context = GetComponentInParent<CardContext>();
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
/// <summary>
|
|
/// Set the parent slot this card belongs to
|
|
/// </summary>
|
|
public void SetParentSlot(AlbumCardSlot slot)
|
|
{
|
|
_parentSlot = slot;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the parent slot
|
|
/// </summary>
|
|
public AlbumCardSlot GetParentSlot()
|
|
{
|
|
return _parentSlot;
|
|
}
|
|
|
|
public void OnCardClicked(CardContext context)
|
|
{
|
|
// Click to enlarge when in album
|
|
Logging.Debug($"[CardPlacedInSlotState] Card clicked in slot, transitioning to enlarged state");
|
|
context.StateMachine.ChangeState("AlbumEnlargedState");
|
|
}
|
|
}
|
|
}
|
|
|