Stash work

This commit is contained in:
Michal Pikulski
2025-11-17 08:39:41 +01:00
parent 78aafb9275
commit 7aca1a17ac
13 changed files with 792 additions and 1845 deletions

View File

@@ -0,0 +1,39 @@
using Core.SaveLoad;
using UnityEngine;
namespace UI.CardSystem.StateMachine.States
{
/// <summary>
/// Dragging revealed state for pending cards after flip; minimal overlay of CardDraggingState but no badges.
/// </summary>
public class CardDraggingRevealedState : AppleState
{
private CardContext context;
private Vector3 originalScale;
private void Awake()
{
context = GetComponentInParent<CardContext>();
}
public override void OnEnterState()
{
if (context == null) return;
if (context.CardDisplay != null)
{
context.CardDisplay.gameObject.SetActive(true);
context.CardDisplay.transform.localRotation = Quaternion.Euler(0,0,0);
}
originalScale = context.RootTransform.localScale;
context.RootTransform.localScale = originalScale * 1.15f;
}
private void OnDisable()
{
if (context?.RootTransform != null)
{
context.RootTransform.localScale = originalScale;
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ce2483293cdd4680b5095afc1fcb2fde
timeCreated: 1763322199

View File

@@ -0,0 +1,57 @@
using Core;
using Core.SaveLoad;
using UnityEngine;
namespace UI.CardSystem.StateMachine.States
{
/// <summary>
/// Handles flipping a pending face-down card after data assignment.
/// Transitions to DraggingRevealedState when flip completes.
/// </summary>
public class CardFlippingPendingState : AppleState
{
private CardContext context;
private GameObject cardBack;
private void Awake()
{
context = GetComponentInParent<CardContext>();
if (context != null)
{
var backTransform = context.RootTransform.Find("CardBack");
if (backTransform != null) cardBack = backTransform.gameObject;
}
}
public override void OnEnterState()
{
if (context == null) return;
// Ensure card back visible and front hidden at start
if (cardBack != null) cardBack.SetActive(true);
if (context.CardDisplay != null) context.CardDisplay.gameObject.SetActive(false);
// Optional: album navigation
var albumPage = Object.FindObjectOfType<AlbumViewPage>();
if (albumPage != null && context.CardData != null)
{
int targetPage = albumPage.FindPageForCard(context.CardData); // placeholder; method may be private
}
if (context.Animator != null)
{
Transform back = cardBack != null ? cardBack.transform : null;
Transform front = context.CardDisplay != null ? context.CardDisplay.transform : null;
context.Animator.PlayFlip(back, front, onComplete: () =>
{
context.StateMachine.ChangeState("DraggingRevealedState");
});
}
else
{
if (cardBack != null) cardBack.SetActive(false);
if (context.CardDisplay != null) context.CardDisplay.gameObject.SetActive(true);
context.StateMachine.ChangeState("DraggingRevealedState");
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: edffabfce37d42ceac2194c23470acab
timeCreated: 1763322190

View File

@@ -0,0 +1,39 @@
using Core.SaveLoad;
using UnityEngine;
namespace UI.CardSystem.StateMachine.States
{
/// <summary>
/// Card is in pending face-down state in corner, awaiting drag.
/// Front hidden, back visible (assumes CardBack child exists).
/// </summary>
public class CardPendingFaceDownState : AppleState
{
private CardContext context;
private GameObject cardBack;
private void Awake()
{
context = GetComponentInParent<CardContext>();
if (context != null)
{
var backTransform = context.RootTransform.Find("CardBack");
if (backTransform != null) cardBack = backTransform.gameObject;
}
}
public override void OnEnterState()
{
if (context == null) return;
// Hide front
if (context.CardDisplay != null)
{
context.CardDisplay.gameObject.SetActive(false);
}
// Show back
if (cardBack != null) cardBack.SetActive(true);
// Scale
context.RootTransform.localScale = context.OriginalScale * 0.8f;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6fab9d595905435b82253cd4d1bf49de
timeCreated: 1763322180