Almost working card state machine

This commit is contained in:
Michal Pikulski
2025-11-16 20:35:54 +01:00
parent 6fe7d012fc
commit 78aafb9275
42 changed files with 3057 additions and 3077 deletions

View File

@@ -1,4 +1,5 @@
using Core.SaveLoad;
using AppleHills.Data.CardSystem;
using Core.SaveLoad;
using UnityEngine;
namespace UI.CardSystem.StateMachine.States
@@ -32,34 +33,35 @@ namespace UI.CardSystem.StateMachine.States
_context.CardDisplay.transform.localRotation = Quaternion.Euler(0, 0, 0);
}
// Card is at normal size, fully revealed
// Show appropriate idle badge
if (_context.IsNewCard)
// Show appropriate idle badge unless suppressed
if (_context.SuppressRevealBadges)
{
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);
if (newCardIdleBadge != null) newCardIdleBadge.SetActive(false);
if (repeatCardIdleBadge != null) repeatCardIdleBadge.SetActive(false);
}
else
{
// Neither new nor repeat - hide both
if (newCardIdleBadge != null)
newCardIdleBadge.SetActive(false);
if (repeatCardIdleBadge != null)
repeatCardIdleBadge.SetActive(false);
bool isNew = Data.CardSystem.CardSystemManager.Instance.IsCardNew(_context.CardData, out CardData existingCard);
int currentOwnedCount = (existingCard != null) ? existingCard.CopiesOwned : 0;
if (isNew)
{
if (newCardIdleBadge != null) newCardIdleBadge.SetActive(true);
if (repeatCardIdleBadge != null) repeatCardIdleBadge.SetActive(false);
}
else if (currentOwnedCount > 0)
{
if (newCardIdleBadge != null) newCardIdleBadge.SetActive(false);
if (repeatCardIdleBadge != null) repeatCardIdleBadge.SetActive(true);
}
else
{
if (newCardIdleBadge != null) newCardIdleBadge.SetActive(false);
if (repeatCardIdleBadge != null) repeatCardIdleBadge.SetActive(false);
}
}
// Fire interaction complete event (for BoosterOpeningPage tracking)
_context.FireCardInteractionComplete();
// Fire reveal flow complete event (signals booster page that this card is done)
_context.NotifyRevealComplete();
}
private void OnDisable()
@@ -72,4 +74,3 @@ namespace UI.CardSystem.StateMachine.States
}
}
}