Almost working card state machine
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using Core;
|
||||
using Core.SaveLoad;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using AppleHills.Core.Settings;
|
||||
|
||||
namespace UI.CardSystem.StateMachine.States
|
||||
@@ -10,7 +9,7 @@ namespace UI.CardSystem.StateMachine.States
|
||||
/// Album enlarged state - card is enlarged when clicked from album slot.
|
||||
/// Different from EnlargedNewState as it doesn't show "NEW" badge.
|
||||
/// </summary>
|
||||
public class CardAlbumEnlargedState : AppleState, IPointerClickHandler
|
||||
public class CardAlbumEnlargedState : AppleState, ICardClickHandler
|
||||
{
|
||||
private CardContext _context;
|
||||
private ICardSystemSettings _settings;
|
||||
@@ -56,7 +55,7 @@ namespace UI.CardSystem.StateMachine.States
|
||||
Logging.Debug($"[CardAlbumEnlargedState] Card enlarged from album: {_context.CardData?.Name}");
|
||||
}
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
public void OnCardClicked(CardContext context)
|
||||
{
|
||||
// Click to shrink back
|
||||
Logging.Debug($"[CardAlbumEnlargedState] Card clicked while enlarged, shrinking back");
|
||||
@@ -65,13 +64,17 @@ namespace UI.CardSystem.StateMachine.States
|
||||
OnShrinkRequested?.Invoke(this);
|
||||
|
||||
// Shrink animation, then transition back
|
||||
if (_context.Animator != null)
|
||||
if (context.Animator != null)
|
||||
{
|
||||
_context.Animator.PlayShrink(_originalScale, onComplete: () =>
|
||||
context.Animator.PlayShrink(_originalScale, onComplete: () =>
|
||||
{
|
||||
_context.StateMachine.ChangeState("PlacedInSlotState");
|
||||
context.StateMachine.ChangeState("PlacedInSlotState");
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
context.StateMachine.ChangeState("PlacedInSlotState");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user