Update assets, working save kerfuffle
This commit is contained in:
@@ -4,35 +4,60 @@ using UnityEngine;
|
||||
namespace UI.CardSystem.StateMachine.States
|
||||
{
|
||||
/// <summary>
|
||||
/// Dragging revealed state for pending cards after flip; minimal overlay of CardDraggingState but no badges.
|
||||
/// Dragging revealed state for pending cards after flip.
|
||||
/// Shows card front without badges, handles placement or return to corner.
|
||||
/// </summary>
|
||||
public class CardDraggingRevealedState : AppleState
|
||||
public class CardDraggingRevealedState : AppleState, ICardStateDragHandler
|
||||
{
|
||||
private CardContext context;
|
||||
private Vector3 originalScale;
|
||||
private CardContext _context;
|
||||
private Vector3 _originalScale;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
context = GetComponentInParent<CardContext>();
|
||||
_context = GetComponentInParent<CardContext>();
|
||||
}
|
||||
|
||||
public override void OnEnterState()
|
||||
{
|
||||
if (context == null) return;
|
||||
if (context.CardDisplay != null)
|
||||
if (_context == null) return;
|
||||
if (_context.CardDisplay != null)
|
||||
{
|
||||
context.CardDisplay.gameObject.SetActive(true);
|
||||
context.CardDisplay.transform.localRotation = Quaternion.Euler(0,0,0);
|
||||
_context.CardDisplay.gameObject.SetActive(true);
|
||||
_context.CardDisplay.transform.localRotation = Quaternion.Euler(0,0,0);
|
||||
}
|
||||
originalScale = context.RootTransform.localScale;
|
||||
context.RootTransform.localScale = originalScale * 1.15f;
|
||||
_originalScale = _context.RootTransform.localScale;
|
||||
_context.RootTransform.localScale = _originalScale * 1.15f;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Already in dragging state, nothing to do
|
||||
/// </summary>
|
||||
public bool OnCardDragStarted(CardContext ctx)
|
||||
{
|
||||
return true; // Prevent default DraggingState transition
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle drag end - just let AlbumViewPage handle placement logic
|
||||
/// Stay in this state until AlbumViewPage transitions us after tween
|
||||
/// </summary>
|
||||
public bool OnCardDragEnded(CardContext ctx)
|
||||
{
|
||||
// Don't do anything - AlbumViewPage will:
|
||||
// 1. Wait for page flip to complete
|
||||
// 2. Find the correct slot
|
||||
// 3. Tween card to slot
|
||||
// 4. Transition to PlacedInSlotState
|
||||
|
||||
// Return true to prevent default behavior
|
||||
return true;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (context?.RootTransform != null)
|
||||
if (_context?.RootTransform != null)
|
||||
{
|
||||
context.RootTransform.localScale = originalScale;
|
||||
_context.RootTransform.localScale = _originalScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user