Updates to testing scene

This commit is contained in:
Michal Pikulski
2025-11-12 20:26:51 +01:00
parent 42b67167eb
commit 4f5fba8b50
11 changed files with 8621 additions and 25 deletions

View File

@@ -17,6 +17,7 @@ namespace UI.CardSystem.StateMachine
private Transform _transform;
private RectTransform _rectTransform;
private ICardSystemSettings _settings;
private TweenBase _activeIdleHoverTween;
private void Awake()
{
@@ -257,16 +258,31 @@ namespace UI.CardSystem.StateMachine
/// <summary>
/// Idle hover animation (gentle bobbing loop)
/// Returns the TweenBase so caller can stop it later
/// Returns the TweenBase so caller can stop it later.
/// Only starts if not already running, or kills and restarts.
/// </summary>
public TweenBase StartIdleHover(float hoverHeight = 10f, float duration = 1.5f)
public TweenBase StartIdleHover(float hoverHeight = 10f, float duration = 1.5f, bool restartIfActive = false)
{
// If already running, either skip or restart
if (_activeIdleHoverTween != null)
{
if (!restartIfActive)
{
// Already running, skip
return _activeIdleHoverTween;
}
// Kill existing and restart
_activeIdleHoverTween.Stop();
_activeIdleHoverTween = null;
}
if (_rectTransform != null)
{
Vector2 originalPos = _rectTransform.anchoredPosition;
Vector2 targetPos = originalPos + Vector2.up * hoverHeight;
return Tween.Value(0f, 1f,
_activeIdleHoverTween = Tween.Value(0f, 1f,
(val) =>
{
if (_rectTransform != null)
@@ -276,11 +292,32 @@ namespace UI.CardSystem.StateMachine
}
},
duration, 0f, Tween.EaseInOut, Tween.LoopType.Loop);
return _activeIdleHoverTween;
}
return null;
}
/// <summary>
/// Stop idle hover animation and return to original position
/// </summary>
public void StopIdleHover(Vector2 originalPosition, float duration = 0.3f)
{
// Stop the tracked tween if it exists
if (_activeIdleHoverTween != null)
{
_activeIdleHoverTween.Stop();
_activeIdleHoverTween = null;
}
// Return to original position
if (_rectTransform != null)
{
Tween.AnchoredPosition(_rectTransform, originalPosition, duration, 0f, Tween.EaseInOut);
}
}
#endregion
#region Flip Animations (Two-Phase)

View File

@@ -31,6 +31,13 @@ namespace UI.CardSystem.StateMachine.States
public override void OnEnterState()
{
// Ensure card front is visible and facing camera
if (_context.CardDisplay != null)
{
_context.CardDisplay.gameObject.SetActive(true);
_context.CardDisplay.transform.localRotation = Quaternion.Euler(0, 0, 0);
}
// Store original transform for restoration
_originalScale = _context.RootTransform.localScale;
_originalParent = _context.RootTransform.parent;

View File

@@ -24,6 +24,13 @@ namespace UI.CardSystem.StateMachine.States
public override void OnEnterState()
{
// Ensure card front is visible and facing camera (in case we transitioned from an unexpected state)
if (_context.CardDisplay != null)
{
_context.CardDisplay.gameObject.SetActive(true);
_context.CardDisplay.transform.localRotation = Quaternion.Euler(0, 0, 0);
}
// Store original scale
_originalScale = _context.RootTransform.localScale;

View File

@@ -27,6 +27,13 @@ namespace UI.CardSystem.StateMachine.States
public override void OnEnterState()
{
// Ensure card front is visible and facing camera
if (_context.CardDisplay != null)
{
_context.CardDisplay.gameObject.SetActive(true);
_context.CardDisplay.transform.localRotation = Quaternion.Euler(0, 0, 0);
}
// Store original scale
_originalScale = _context.RootTransform.localScale;

View File

@@ -30,6 +30,13 @@ namespace UI.CardSystem.StateMachine.States
public override void OnEnterState()
{
// Ensure card front is visible and facing camera
if (_context.CardDisplay != null)
{
_context.CardDisplay.gameObject.SetActive(true);
_context.CardDisplay.transform.localRotation = Quaternion.Euler(0, 0, 0);
}
// Store original scale
_originalScale = _context.RootTransform.localScale;
_waitingForTap = false;

View File

@@ -1,5 +1,6 @@
using Core;
using Core.SaveLoad;
using UnityEngine;
using UnityEngine.EventSystems;
namespace UI.CardSystem.StateMachine.States
@@ -20,6 +21,14 @@ namespace UI.CardSystem.StateMachine.States
public override void OnEnterState()
{
// Ensure card front is visible and facing camera
// This is important when spawning cards directly into album (skipping booster flow)
if (_context.CardDisplay != null)
{
_context.CardDisplay.gameObject.SetActive(true);
_context.CardDisplay.transform.localRotation = Quaternion.Euler(0, 0, 0);
}
Logging.Debug($"[CardPlacedInSlotState] Card placed in slot: {_context.CardData?.Name}");
// Card is now part of the album, no special visuals needed

View File

@@ -25,6 +25,13 @@ namespace UI.CardSystem.StateMachine.States
public override void OnEnterState()
{
// Ensure card front is visible and facing camera
if (_context.CardDisplay != null)
{
_context.CardDisplay.gameObject.SetActive(true);
_context.CardDisplay.transform.localRotation = Quaternion.Euler(0, 0, 0);
}
// Card is at normal size, fully revealed
// Show appropriate idle badge