2025-11-11 20:25:23 +01:00
|
|
|
|
using Core.SaveLoad;
|
2025-11-12 11:58:01 +01:00
|
|
|
|
using UnityEngine;
|
2025-11-11 20:25:23 +01:00
|
|
|
|
|
|
|
|
|
|
namespace UI.CardSystem.StateMachine.States
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2025-11-12 10:55:00 +01:00
|
|
|
|
/// Revealed state - card is flipped and visible at normal size.
|
|
|
|
|
|
/// This is the "waiting" state:
|
|
|
|
|
|
/// - In booster flow: waiting for all cards to finish before animating to album
|
|
|
|
|
|
/// - In album placement flow: waiting to be dragged to a slot
|
2025-11-12 11:58:01 +01:00
|
|
|
|
/// Shows small idle badges for NEW or REPEAT cards.
|
2025-11-11 20:25:23 +01:00
|
|
|
|
/// </summary>
|
2025-11-12 10:55:00 +01:00
|
|
|
|
public class CardRevealedState : AppleState
|
2025-11-11 20:25:23 +01:00
|
|
|
|
{
|
2025-11-12 11:58:01 +01:00
|
|
|
|
[Header("State-Owned Visuals")]
|
|
|
|
|
|
[SerializeField] private UnityEngine.GameObject newCardIdleBadge;
|
|
|
|
|
|
[SerializeField] private UnityEngine.GameObject repeatCardIdleBadge;
|
|
|
|
|
|
|
2025-11-11 20:25:23 +01:00
|
|
|
|
private CardContext _context;
|
|
|
|
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
|
|
{
|
|
|
|
|
|
_context = GetComponentInParent<CardContext>();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void OnEnterState()
|
|
|
|
|
|
{
|
2025-11-12 10:55:00 +01:00
|
|
|
|
// Card is at normal size, fully revealed
|
2025-11-12 11:58:01 +01:00
|
|
|
|
|
|
|
|
|
|
// Show appropriate idle badge
|
|
|
|
|
|
if (_context.IsNewCard)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (newCardIdleBadge != null)
|
|
|
|
|
|
newCardIdleBadge.SetActive(true);
|
|
|
|
|
|
if (repeatCardIdleBadge != null)
|
|
|
|
|
|
repeatCardIdleBadge.SetActive(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (_context.RepeatCardCount > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (newCardIdleBadge != null)
|
|
|
|
|
|
newCardIdleBadge.SetActive(false);
|
|
|
|
|
|
if (repeatCardIdleBadge != null)
|
|
|
|
|
|
repeatCardIdleBadge.SetActive(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
// Neither new nor repeat - hide both
|
|
|
|
|
|
if (newCardIdleBadge != null)
|
|
|
|
|
|
newCardIdleBadge.SetActive(false);
|
|
|
|
|
|
if (repeatCardIdleBadge != null)
|
|
|
|
|
|
repeatCardIdleBadge.SetActive(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-12 10:55:00 +01:00
|
|
|
|
// Fire interaction complete event (for BoosterOpeningPage tracking)
|
|
|
|
|
|
_context.FireCardInteractionComplete();
|
2025-11-11 20:25:23 +01:00
|
|
|
|
}
|
2025-11-12 11:58:01 +01:00
|
|
|
|
|
|
|
|
|
|
private void OnDisable()
|
|
|
|
|
|
{
|
|
|
|
|
|
// Hide badges when leaving state
|
|
|
|
|
|
if (newCardIdleBadge != null)
|
|
|
|
|
|
newCardIdleBadge.SetActive(false);
|
|
|
|
|
|
if (repeatCardIdleBadge != null)
|
|
|
|
|
|
repeatCardIdleBadge.SetActive(false);
|
|
|
|
|
|
}
|
2025-11-11 20:25:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|