Stash half-assed work on testing scene

This commit is contained in:
Michal Pikulski
2025-11-12 11:58:01 +01:00
parent a9f102b3c4
commit 6fd1a10eb6
18 changed files with 3065 additions and 321 deletions

View File

@@ -82,13 +82,61 @@ namespace UI.CardSystem.StateMachine.States
public void OnPointerClick(PointerEventData eventData)
{
// Click to flip - transition to flipping state
_context.StateMachine.ChangeState("FlippingState");
// Check if card is clickable (prevents multi-flip in booster opening)
if (!_context.IsClickable)
{
Logging.Debug($"[CardIdleState] Card is not clickable, ignoring click");
return;
}
// Stop idle hover and pointer interactions
StopIdleHover();
// Play flip animation directly (no state transition yet)
if (_context.Animator != null)
{
_context.Animator.PlayFlip(
cardBack: cardBackVisual != null ? cardBackVisual.transform : null,
cardFront: _context.CardDisplay != null ? _context.CardDisplay.transform : null,
onComplete: OnFlipComplete
);
_context.Animator.PlayFlipScalePunch();
}
}
private void OnDisable()
private void OnFlipComplete()
{
// Fire flip complete event
_context.FireFlipComplete();
// Transition based on whether this is a new card or repeat
if (_context.IsNewCard)
{
_context.StateMachine.ChangeState("EnlargedNewState");
}
else if (_context.CardData != null && _context.CardData.Rarity == AppleHills.Data.CardSystem.CardRarity.Legendary)
{
// Legendary repeat - skip enlarge, they can't upgrade
// Add to inventory and move to revealed state
if (Data.CardSystem.CardSystemManager.Instance != null)
{
Data.CardSystem.CardSystemManager.Instance.AddCardToInventoryDelayed(_context.CardData);
}
_context.StateMachine.ChangeState("RevealedState");
}
else if (_context.RepeatCardCount > 0)
{
_context.StateMachine.ChangeState("EnlargedRepeatState");
}
else
{
_context.StateMachine.ChangeState("RevealedState");
}
}
private void StopIdleHover()
{
// Stop idle hover animation when leaving state
if (_idleHoverTween != null)
{
_idleHoverTween.Stop();
@@ -101,9 +149,15 @@ namespace UI.CardSystem.StateMachine.States
_context.Animator.AnimateAnchoredPosition(_originalPosition, 0.3f);
}
}
}
private void OnDisable()
{
// Stop idle hover animation when leaving state
StopIdleHover();
// Reset scale
if (_context.Animator != null)
if (_context?.Animator != null)
{
_context.Animator.AnimateScale(Vector3.one, 0.2f);
}