Make cards use settings

This commit is contained in:
Michal Pikulski
2025-11-12 09:24:27 +01:00
parent e0a7bbaee4
commit 8a3471bd1a
15 changed files with 232 additions and 69 deletions

View File

@@ -10,7 +10,7 @@ namespace AppleHills.Core.Settings.Editor
{
private Vector2 scrollPosition;
private List<BaseSettings> allSettings = new List<BaseSettings>();
private string[] tabNames = new string[] { "Player & Follower", "Interaction & Items", "Diving Minigame" };
private string[] tabNames = new string[] { "Player & Follower", "Interaction & Items", "Diving Minigame", "Card System" };
private int selectedTab = 0;
private Dictionary<string, SerializedObject> serializedSettingsObjects = new Dictionary<string, SerializedObject>();
private GUIStyle headerStyle;
@@ -48,6 +48,7 @@ namespace AppleHills.Core.Settings.Editor
CreateSettingsIfMissing<PlayerFollowerSettings>("PlayerFollowerSettings");
CreateSettingsIfMissing<InteractionSettings>("InteractionSettings");
CreateSettingsIfMissing<DivingMinigameSettings>("DivingMinigameSettings");
CreateSettingsIfMissing<CardSystemSettings>("CardSystemSettings");
}
private void CreateSettingsIfMissing<T>(string fileName) where T : BaseSettings
@@ -114,6 +115,9 @@ namespace AppleHills.Core.Settings.Editor
case 2: // Minigames
DrawSettingsEditor<DivingMinigameSettings>();
break;
case 3: // Card System
DrawSettingsEditor<CardSystemSettings>();
break;
}
EditorGUILayout.EndScrollView();

View File

@@ -169,6 +169,7 @@ namespace Core
var playerSettings = SettingsProvider.Instance.LoadSettingsSynchronous<PlayerFollowerSettings>();
var interactionSettings = SettingsProvider.Instance.LoadSettingsSynchronous<InteractionSettings>();
var minigameSettings = SettingsProvider.Instance.LoadSettingsSynchronous<DivingMinigameSettings>();
var cardSystemSettings = SettingsProvider.Instance.LoadSettingsSynchronous<CardSystemSettings>();
// Register settings with service locator
if (playerSettings != null)
@@ -201,8 +202,18 @@ namespace Core
Debug.LogError("Failed to load MinigameSettings");
}
if (cardSystemSettings != null)
{
ServiceLocator.Register<ICardSystemSettings>(cardSystemSettings);
Logging.Debug("CardSystemSettings registered successfully");
}
else
{
Debug.LogError("Failed to load CardSystemSettings");
}
// Log success
_settingsLoaded = playerSettings != null && interactionSettings != null && minigameSettings != null;
_settingsLoaded = playerSettings != null && interactionSettings != null && minigameSettings != null && cardSystemSettings != null;
if (_settingsLoaded)
{
Logging.Debug("All settings loaded and registered with ServiceLocator");

View File

@@ -0,0 +1,102 @@
using UnityEngine;
namespace AppleHills.Core.Settings
{
/// <summary>
/// Settings for the card system - controls animations, interactions, and progression
/// </summary>
[CreateAssetMenu(fileName = "CardSystemSettings", menuName = "AppleHills/Settings/Card System", order = 4)]
public class CardSystemSettings : BaseSettings, ICardSystemSettings
{
[Header("Idle Hover Animations")]
[Tooltip("Height of the idle hover animation in pixels")]
[SerializeField] private float idleHoverHeight = 10f;
[Tooltip("Duration of one complete hover cycle in seconds")]
[SerializeField] private float idleHoverDuration = 1.5f;
[Tooltip("Scale multiplier when hovering over a card (1.05 = 5% larger)")]
[SerializeField] private float hoverScaleMultiplier = 1.05f;
[Header("Flip Animations")]
[Tooltip("Duration of the card flip animation in seconds")]
[SerializeField] private float flipDuration = 0.6f;
[Tooltip("Scale punch amount during flip (1.1 = 10% larger at peak)")]
[SerializeField] private float flipScalePunch = 1.1f;
[Header("Enlarge/Shrink Animations")]
[Tooltip("Scale for new cards when enlarged (1.5 = 150% of normal size)")]
[SerializeField] private float newCardEnlargedScale = 1.5f;
[Tooltip("Scale for album cards when enlarged (2.5 = 250% of normal size)")]
[SerializeField] private float albumCardEnlargedScale = 2.5f;
[Tooltip("Duration of scale animations in seconds")]
[SerializeField] private float scaleDuration = 0.3f;
[Header("Drag & Drop")]
[Tooltip("Scale multiplier when dragging a card (1.1 = 10% larger)")]
[SerializeField] private float dragScale = 1.1f;
[Header("Progression System")]
[Tooltip("Number of duplicate cards needed to upgrade rarity")]
[SerializeField] private int cardsToUpgrade = 5;
[Header("General Animation")]
[Tooltip("Default animation duration when not specified in seconds")]
[SerializeField] private float defaultAnimationDuration = 0.3f;
// ICardSystemSettings implementation - Idle Hover Animations
public float IdleHoverHeight => idleHoverHeight;
public float IdleHoverDuration => idleHoverDuration;
public float HoverScaleMultiplier => hoverScaleMultiplier;
// ICardSystemSettings implementation - Flip Animations
public float FlipDuration => flipDuration;
public float FlipScalePunch => flipScalePunch;
// ICardSystemSettings implementation - Enlarge/Shrink Animations
public float NewCardEnlargedScale => newCardEnlargedScale;
public float AlbumCardEnlargedScale => albumCardEnlargedScale;
public float ScaleDuration => scaleDuration;
// ICardSystemSettings implementation - Drag & Drop
public float DragScale => dragScale;
// ICardSystemSettings implementation - Progression System
public int CardsToUpgrade => cardsToUpgrade;
// ICardSystemSettings implementation - General Animation
public float DefaultAnimationDuration => defaultAnimationDuration;
public override void OnValidate()
{
base.OnValidate();
// Validate idle hover animations
idleHoverHeight = Mathf.Max(0f, idleHoverHeight);
idleHoverDuration = Mathf.Max(0.1f, idleHoverDuration);
hoverScaleMultiplier = Mathf.Max(1.0f, hoverScaleMultiplier);
// Validate flip animations
flipDuration = Mathf.Max(0.1f, flipDuration);
flipScalePunch = Mathf.Max(1.0f, flipScalePunch);
// Validate enlarge/shrink animations
newCardEnlargedScale = Mathf.Max(1.0f, newCardEnlargedScale);
albumCardEnlargedScale = Mathf.Max(1.0f, albumCardEnlargedScale);
scaleDuration = Mathf.Max(0.1f, scaleDuration);
// Validate drag & drop
dragScale = Mathf.Max(1.0f, dragScale);
// Validate progression system
cardsToUpgrade = Mathf.Max(1, cardsToUpgrade);
// Validate general animation
defaultAnimationDuration = Mathf.Max(0.1f, defaultAnimationDuration);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ce6f8e26f4e74a9ab16c190529e67638
timeCreated: 1762934668

View File

@@ -128,9 +128,36 @@ namespace AppleHills.Core.Settings
float[] ViewfinderProgressThresholds { get; }
float PaddingFactor { get; }
float MaxSizePercent { get; }
float MinSizePercent { get; }
public float MinSizePercent { get; }
public PhotoInputModes PhotoInputMode { get; }
}
// Photo Input Settings
PhotoInputModes PhotoInputMode { get; }
/// <summary>
/// Interface for card system settings
/// </summary>
public interface ICardSystemSettings
{
// Idle Hover Animations
float IdleHoverHeight { get; }
float IdleHoverDuration { get; }
float HoverScaleMultiplier { get; }
// Flip Animations
float FlipDuration { get; }
float FlipScalePunch { get; }
// Enlarge/Shrink Animations
float NewCardEnlargedScale { get; }
float AlbumCardEnlargedScale { get; }
float ScaleDuration { get; }
// Drag & Drop
float DragScale { get; }
// Progression System
int CardsToUpgrade { get; }
// General Animation
float DefaultAnimationDuration { get; }
}
}

View File

@@ -4,6 +4,7 @@ using Core;
using Pixelplacement;
using UnityEngine;
using UnityEngine.EventSystems;
using AppleHills.Core.Settings;
namespace UI.CardSystem
{
@@ -20,10 +21,6 @@ namespace UI.CardSystem
[Header("References")]
[SerializeField] private CardDisplay cardDisplay;
[Header("Enlarge Settings")]
[SerializeField] private float enlargedScale = 2.5f;
[SerializeField] private float scaleDuration = 0.3f;
// Events for AlbumViewPage to manage backdrop and reparenting
public event Action<AlbumCard> OnEnlargeRequested;
public event Action<AlbumCard> OnShrinkRequested;
@@ -35,9 +32,12 @@ namespace UI.CardSystem
private Transform _originalParent;
private Vector3 _originalLocalPosition;
private Quaternion _originalLocalRotation;
private ICardSystemSettings _settings;
private void Awake()
{
_settings = GameManager.GetSettingsObject<ICardSystemSettings>();
// Auto-find CardDisplay if not assigned
if (cardDisplay == null)
{
@@ -133,7 +133,7 @@ namespace UI.CardSystem
_originalLocalRotation = transform.localRotation;
// Scale up with snappy tween
Tween.LocalScale(transform, _originalScale * enlargedScale, scaleDuration, 0f, Tween.EaseOutBack);
Tween.LocalScale(transform, _originalScale * _settings.AlbumCardEnlargedScale, _settings.ScaleDuration, 0f, Tween.EaseOutBack);
}
/// <summary>
@@ -147,7 +147,7 @@ namespace UI.CardSystem
_isEnlarged = false;
// Scale back down with snappy tween, invoke callback when done
Tween.LocalScale(transform, _originalScale, scaleDuration, 0f, Tween.EaseInBack,
Tween.LocalScale(transform, _originalScale, _settings.ScaleDuration, 0f, Tween.EaseInBack,
completeCallback: () => onComplete?.Invoke());
}

View File

@@ -5,6 +5,7 @@ using Pixelplacement;
using Pixelplacement.TweenSystem;
using UnityEngine;
using UnityEngine.EventSystems;
using AppleHills.Core.Settings;
namespace UI.CardSystem
{
@@ -22,23 +23,15 @@ namespace UI.CardSystem
[Header("Idle Hover Animation")]
[SerializeField] private bool enableIdleHover = true;
[SerializeField] private float idleHoverHeight = 10f;
[SerializeField] private float idleHoverDuration = 1.5f;
[SerializeField] private float hoverScaleMultiplier = 1.05f;
[Header("Flip Animation")]
[SerializeField] private float flipDuration = 0.6f;
[SerializeField] private float flipScalePunch = 1.1f;
[Header("New/Repeat Card Display")]
[SerializeField] private GameObject newCardText;
[SerializeField] private GameObject newCardIdleText;
[SerializeField] private GameObject repeatText;
[SerializeField] private GameObject progressBarContainer;
[SerializeField] private int cardsToUpgrade = 5;
[SerializeField] private float enlargedScale = 1.5f;
// State
private ICardSystemSettings _settings;
private bool _isFlipped = false;
private bool _isFlipping = false;
private TweenBase _idleHoverTween;
@@ -57,10 +50,12 @@ namespace UI.CardSystem
public bool IsFlipped => _isFlipped;
public CardData CardData => _cardData;
public int CardsToUpgrade => cardsToUpgrade; // Expose upgrade threshold
public int CardsToUpgrade => _settings?.CardsToUpgrade ?? 5;
private void Awake()
{
_settings = GameManager.GetSettingsObject<ICardSystemSettings>();
// Auto-find CardDisplay if not assigned
if (cardDisplay == null && cardFrontObject != null)
{
@@ -149,15 +144,18 @@ namespace UI.CardSystem
// Card back: 0° → 90° (rotates away)
// Card front: 180° → 90° → 0° (rotates into view)
float flipDur = _settings.FlipDuration;
float flipPunch = _settings.FlipScalePunch;
// Phase 1: Rotate both to 90 degrees (edge view)
if (cardBackObject != null)
{
Tween.LocalRotation(cardBackObject.transform, Quaternion.Euler(0, 90, 0), flipDuration * 0.5f, 0f, Tween.EaseInOut);
Tween.LocalRotation(cardBackObject.transform, Quaternion.Euler(0, 90, 0), flipDur * 0.5f, 0f, Tween.EaseInOut);
}
if (cardFrontObject != null)
{
Tween.LocalRotation(cardFrontObject.transform, Quaternion.Euler(0, 90, 0), flipDuration * 0.5f, 0f, Tween.EaseInOut,
Tween.LocalRotation(cardFrontObject.transform, Quaternion.Euler(0, 90, 0), flipDur * 0.5f, 0f, Tween.EaseInOut,
completeCallback: () =>
{
// At edge (90°), switch visibility
@@ -167,7 +165,7 @@ namespace UI.CardSystem
cardFrontObject.SetActive(true);
// Phase 2: Rotate front from 90 to 0 (show at correct orientation)
Tween.LocalRotation(cardFrontObject.transform, Quaternion.Euler(0, 0, 0), flipDuration * 0.5f, 0f, Tween.EaseInOut,
Tween.LocalRotation(cardFrontObject.transform, Quaternion.Euler(0, 0, 0), flipDur * 0.5f, 0f, Tween.EaseInOut,
completeCallback: () =>
{
_isFlipped = true;
@@ -181,10 +179,10 @@ namespace UI.CardSystem
// Scale punch during flip for extra juice
Vector3 originalScale = transform.localScale;
Tween.LocalScale(transform, originalScale * flipScalePunch, flipDuration * 0.5f, 0f, Tween.EaseOutBack,
Tween.LocalScale(transform, originalScale * flipPunch, flipDur * 0.5f, 0f, Tween.EaseOutBack,
completeCallback: () =>
{
Tween.LocalScale(transform, originalScale, flipDuration * 0.5f, 0f, Tween.EaseInBack);
Tween.LocalScale(transform, originalScale, flipDur * 0.5f, 0f, Tween.EaseInBack);
});
}
@@ -201,7 +199,7 @@ namespace UI.CardSystem
return;
Vector2 originalPos = rectTransform.anchoredPosition;
Vector2 targetPos = originalPos + Vector2.up * idleHoverHeight;
Vector2 targetPos = originalPos + Vector2.up * _settings.IdleHoverHeight;
_idleHoverTween = Tween.Value(0f, 1f,
(val) =>
@@ -212,7 +210,7 @@ namespace UI.CardSystem
rectTransform.anchoredPosition = Vector2.Lerp(originalPos, targetPos, t);
}
},
idleHoverDuration, 0f, Tween.EaseInOut, Tween.LoopType.Loop);
_settings.IdleHoverDuration, 0f, Tween.EaseInOut, Tween.LoopType.Loop);
}
/// <summary>
@@ -242,7 +240,7 @@ namespace UI.CardSystem
return;
// Scale up slightly on hover
Tween.LocalScale(transform, Vector3.one * hoverScaleMultiplier, 0.2f, 0f, Tween.EaseOutBack);
Tween.LocalScale(transform, Vector3.one * _settings.HoverScaleMultiplier, 0.2f, 0f, Tween.EaseOutBack);
}
public void OnPointerExit(PointerEventData eventData)
@@ -492,7 +490,7 @@ namespace UI.CardSystem
/// </summary>
private void EnlargeCard()
{
Tween.LocalScale(transform, Vector3.one * enlargedScale, 0.3f, 0f, Tween.EaseOutBack);
Tween.LocalScale(transform, Vector3.one * _settings.NewCardEnlargedScale, _settings.ScaleDuration, 0f, Tween.EaseOutBack);
}
/// <summary>
@@ -500,7 +498,7 @@ namespace UI.CardSystem
/// </summary>
public void ReturnToNormalSize()
{
Tween.LocalScale(transform, Vector3.one, 0.3f, 0f, Tween.EaseOutBack, completeCallback: () =>
Tween.LocalScale(transform, Vector3.one, _settings.ScaleDuration, 0f, Tween.EaseOutBack, completeCallback: () =>
{
// After returning to normal, hide new card text, show idle text
if (_isNew)
@@ -531,6 +529,8 @@ namespace UI.CardSystem
// Get all child Image components
UnityEngine.UI.Image[] progressElements = progressBarContainer.GetComponentsInChildren<UnityEngine.UI.Image>(true);
int cardsToUpgrade = _settings.CardsToUpgrade;
// Check if we have the required number of elements (should match cardsToUpgrade)
if (progressElements.Length < cardsToUpgrade)
{

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: ddd745ae12984de9974292d201c89d9c
timeCreated: 1762884650

View File

@@ -2,6 +2,8 @@
using Pixelplacement.TweenSystem;
using UnityEngine;
using System;
using AppleHills.Core.Settings;
using Core;
namespace UI.CardSystem.StateMachine
{
@@ -12,16 +14,15 @@ namespace UI.CardSystem.StateMachine
/// </summary>
public class CardAnimator : MonoBehaviour
{
[Header("Animation Settings")]
[SerializeField] private float defaultDuration = 0.3f;
private Transform _transform;
private RectTransform _rectTransform;
private ICardSystemSettings _settings;
private void Awake()
{
_transform = transform;
_rectTransform = GetComponent<RectTransform>();
_settings = GameManager.GetSettingsObject<ICardSystemSettings>();
}
#region Scale Animations
@@ -31,7 +32,7 @@ namespace UI.CardSystem.StateMachine
/// </summary>
public TweenBase AnimateScale(Vector3 targetScale, float? duration = null, Action onComplete = null)
{
return Tween.LocalScale(_transform, targetScale, duration ?? defaultDuration, 0f,
return Tween.LocalScale(_transform, targetScale, duration ?? _settings.DefaultAnimationDuration, 0f,
Tween.EaseInOut, completeCallback: onComplete);
}
@@ -85,7 +86,7 @@ namespace UI.CardSystem.StateMachine
return null;
}
return Tween.AnchoredPosition(_rectTransform, targetPosition, duration ?? defaultDuration, 0f,
return Tween.AnchoredPosition(_rectTransform, targetPosition, duration ?? _settings.DefaultAnimationDuration, 0f,
Tween.EaseInOut, completeCallback: onComplete);
}
@@ -94,7 +95,7 @@ namespace UI.CardSystem.StateMachine
/// </summary>
public TweenBase AnimateLocalPosition(Vector3 targetPosition, float? duration = null, Action onComplete = null)
{
return Tween.LocalPosition(_transform, targetPosition, duration ?? defaultDuration, 0f,
return Tween.LocalPosition(_transform, targetPosition, duration ?? _settings.DefaultAnimationDuration, 0f,
Tween.EaseInOut, completeCallback: onComplete);
}
@@ -107,7 +108,7 @@ namespace UI.CardSystem.StateMachine
/// </summary>
public TweenBase AnimateLocalRotation(Quaternion targetRotation, float? duration = null, Action onComplete = null)
{
return Tween.LocalRotation(_transform, targetRotation, duration ?? defaultDuration, 0f,
return Tween.LocalRotation(_transform, targetRotation, duration ?? _settings.DefaultAnimationDuration, 0f,
Tween.EaseInOut, completeCallback: onComplete);
}
@@ -129,17 +130,19 @@ namespace UI.CardSystem.StateMachine
/// Play card flip animation - rotates card back from 0° to 90°, then card front from 180° to 0°
/// Based on FlippableCard.FlipToReveal()
/// </summary>
public void PlayFlip(Transform cardBack, Transform cardFront, float duration = 0.6f, Action onComplete = null)
public void PlayFlip(Transform cardBack, Transform cardFront, float? duration = null, Action onComplete = null)
{
float flipDuration = duration ?? _settings.FlipDuration;
// Phase 1: Rotate both to 90 degrees (edge view)
if (cardBack != null)
{
Tween.LocalRotation(cardBack, Quaternion.Euler(0, 90, 0), duration * 0.5f, 0f, Tween.EaseInOut);
Tween.LocalRotation(cardBack, Quaternion.Euler(0, 90, 0), flipDuration * 0.5f, 0f, Tween.EaseInOut);
}
if (cardFront != null)
{
Tween.LocalRotation(cardFront, Quaternion.Euler(0, 90, 0), duration * 0.5f, 0f, Tween.EaseInOut,
Tween.LocalRotation(cardFront, Quaternion.Euler(0, 90, 0), flipDuration * 0.5f, 0f, Tween.EaseInOut,
completeCallback: () =>
{
// At edge (90°), switch visibility
@@ -149,7 +152,7 @@ namespace UI.CardSystem.StateMachine
cardFront.gameObject.SetActive(true);
// Phase 2: Rotate front from 90 to 0 (show at correct orientation)
Tween.LocalRotation(cardFront, Quaternion.Euler(0, 0, 0), duration * 0.5f, 0f, Tween.EaseInOut,
Tween.LocalRotation(cardFront, Quaternion.Euler(0, 0, 0), flipDuration * 0.5f, 0f, Tween.EaseInOut,
completeCallback: onComplete);
});
}
@@ -159,14 +162,16 @@ namespace UI.CardSystem.StateMachine
/// Play scale punch during flip animation for extra juice
/// Based on FlippableCard.FlipToReveal()
/// </summary>
public void PlayFlipScalePunch(float punchScale = 1.1f, float duration = 0.6f)
public void PlayFlipScalePunch(float? punchScale = null, float? duration = null)
{
float punch = punchScale ?? _settings.FlipScalePunch;
float flipDuration = duration ?? _settings.FlipDuration;
Vector3 originalScale = _transform.localScale;
Tween.LocalScale(_transform, originalScale * punchScale, duration * 0.5f, 0f, Tween.EaseOutBack,
Tween.LocalScale(_transform, originalScale * punch, flipDuration * 0.5f, 0f, Tween.EaseOutBack,
completeCallback: () =>
{
Tween.LocalScale(_transform, originalScale, duration * 0.5f, 0f, Tween.EaseInBack);
Tween.LocalScale(_transform, originalScale, flipDuration * 0.5f, 0f, Tween.EaseInBack);
});
}
@@ -178,9 +183,12 @@ namespace UI.CardSystem.StateMachine
/// Enlarge card to specified scale
/// Based on FlippableCard.EnlargeCard() and AlbumCard.EnlargeCard()
/// </summary>
public void PlayEnlarge(float targetScale = 2.5f, float duration = 0.3f, Action onComplete = null)
public void PlayEnlarge(float? targetScale = null, float? duration = null, Action onComplete = null)
{
Tween.LocalScale(_transform, Vector3.one * targetScale, duration, 0f, Tween.EaseOutBack,
float scale = targetScale ?? _settings.NewCardEnlargedScale;
float scaleDuration = duration ?? _settings.ScaleDuration;
Tween.LocalScale(_transform, Vector3.one * scale, scaleDuration, 0f, Tween.EaseOutBack,
completeCallback: onComplete);
}
@@ -188,9 +196,11 @@ namespace UI.CardSystem.StateMachine
/// Shrink card back to original scale
/// Based on AlbumCard.ShrinkCard() and FlippableCard.ReturnToNormalSize()
/// </summary>
public void PlayShrink(Vector3 targetScale, float duration = 0.3f, Action onComplete = null)
public void PlayShrink(Vector3 targetScale, float? duration = null, Action onComplete = null)
{
Tween.LocalScale(_transform, targetScale, duration, 0f, Tween.EaseInBack,
float scaleDuration = duration ?? _settings.ScaleDuration;
Tween.LocalScale(_transform, targetScale, scaleDuration, 0f, Tween.EaseInBack,
completeCallback: onComplete);
}

View File

@@ -2,7 +2,7 @@
using Core.SaveLoad;
using UnityEngine;
using UnityEngine.EventSystems;
using UI.CardSystem.StateMachine;
using AppleHills.Core.Settings;
namespace UI.CardSystem.StateMachine.States
{
@@ -13,6 +13,7 @@ namespace UI.CardSystem.StateMachine.States
public class CardAlbumEnlargedState : AppleState, IPointerClickHandler
{
private CardContext _context;
private ICardSystemSettings _settings;
private Vector3 _originalScale;
private Transform _originalParent;
private Vector3 _originalLocalPosition;
@@ -25,6 +26,7 @@ namespace UI.CardSystem.StateMachine.States
private void Awake()
{
_context = GetComponentInParent<CardContext>();
_settings = GameManager.GetSettingsObject<ICardSystemSettings>();
}
public override void OnEnterState()
@@ -38,10 +40,10 @@ namespace UI.CardSystem.StateMachine.States
// Notify page to show backdrop and reparent card to top layer
OnEnlargeRequested?.Invoke(this);
// Enlarge the card
// Enlarge the card using album scale setting
if (_context.Animator != null)
{
_context.Animator.PlayEnlarge();
_context.Animator.PlayEnlarge(_settings.AlbumCardEnlargedScale);
}
Logging.Debug($"[CardAlbumEnlargedState] Card enlarged from album: {_context.CardData?.Name}");

View File

@@ -1,7 +1,7 @@
using Core.SaveLoad;
using UnityEngine;
using UnityEngine.EventSystems;
using Core;
using AppleHills.Core.Settings;
namespace UI.CardSystem.StateMachine.States
{
@@ -11,16 +11,15 @@ namespace UI.CardSystem.StateMachine.States
/// </summary>
public class CardDraggingState : AppleState
{
[Header("Drag Settings")]
[SerializeField] private float dragScale = 1.1f;
private CardContext _context;
private ICardSystemSettings _settings;
private Vector3 _originalScale;
private Vector3 _dragStartPosition;
private void Awake()
{
_context = GetComponentInParent<CardContext>();
_settings = GameManager.GetSettingsObject<ICardSystemSettings>();
}
public override void OnEnterState()
@@ -30,7 +29,7 @@ namespace UI.CardSystem.StateMachine.States
_dragStartPosition = _context.RootTransform.position;
// Scale up slightly during drag for visual feedback
_context.RootTransform.localScale = _originalScale * dragScale;
_context.RootTransform.localScale = _originalScale * _settings.DragScale;
Logging.Debug($"[CardDraggingState] Entered drag state for card: {_context.CardData?.Name}");
}

View File

@@ -1,6 +1,8 @@
using Core.SaveLoad;
using UnityEngine;
using UnityEngine.EventSystems;
using AppleHills.Core.Settings;
using Core;
namespace UI.CardSystem.StateMachine.States
{
@@ -14,11 +16,13 @@ namespace UI.CardSystem.StateMachine.States
[SerializeField] private GameObject newCardBadge;
private CardContext _context;
private ICardSystemSettings _settings;
private Vector3 _originalScale;
private void Awake()
{
_context = GetComponentInParent<CardContext>();
_settings = GameManager.GetSettingsObject<ICardSystemSettings>();
}
public override void OnEnterState()
@@ -35,7 +39,7 @@ namespace UI.CardSystem.StateMachine.States
// Enlarge the card
if (_context.Animator != null)
{
_context.Animator.PlayEnlarge();
_context.Animator.PlayEnlarge(_settings.NewCardEnlargedScale);
}
}

View File

@@ -3,6 +3,8 @@ using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using AppleHills.Core.Settings;
using Core;
namespace UI.CardSystem.StateMachine.States
{
@@ -16,14 +18,15 @@ namespace UI.CardSystem.StateMachine.States
[SerializeField] private GameObject progressBarContainer;
[SerializeField] private Image progressBarFill;
[SerializeField] private TextMeshProUGUI progressText;
[SerializeField] private int cardsToUpgrade = 5;
private CardContext _context;
private ICardSystemSettings _settings;
private Vector3 _originalScale;
private void Awake()
{
_context = GetComponentInParent<CardContext>();
_settings = GameManager.GetSettingsObject<ICardSystemSettings>();
}
public override void OnEnterState()
@@ -41,13 +44,14 @@ namespace UI.CardSystem.StateMachine.States
// Enlarge the card
if (_context.Animator != null)
{
_context.Animator.PlayEnlarge();
_context.Animator.PlayEnlarge(_settings.NewCardEnlargedScale);
}
}
private void UpdateProgressBar()
{
int currentCount = _context.RepeatCardCount;
int cardsToUpgrade = _settings.CardsToUpgrade;
float progress = (float)currentCount / cardsToUpgrade;
if (progressBarFill != null)

View File

@@ -2,6 +2,8 @@
using Pixelplacement.TweenSystem;
using UnityEngine;
using UnityEngine.EventSystems;
using AppleHills.Core.Settings;
using Core;
namespace UI.CardSystem.StateMachine.States
{
@@ -17,17 +19,16 @@ namespace UI.CardSystem.StateMachine.States
[Header("Idle Hover Settings")]
[SerializeField] private bool enableIdleHover = true;
[SerializeField] private float idleHoverHeight = 10f;
[SerializeField] private float idleHoverDuration = 1.5f;
[SerializeField] private float hoverScaleMultiplier = 1.05f;
private CardContext _context;
private ICardSystemSettings _settings;
private TweenBase _idleHoverTween;
private Vector2 _originalPosition;
private void Awake()
{
_context = GetComponentInParent<CardContext>();
_settings = GameManager.GetSettingsObject<ICardSystemSettings>();
}
public override void OnEnterState()
@@ -57,7 +58,7 @@ namespace UI.CardSystem.StateMachine.States
// Start idle hover animation
if (enableIdleHover && _context.Animator != null)
{
_idleHoverTween = _context.Animator.StartIdleHover(idleHoverHeight, idleHoverDuration);
_idleHoverTween = _context.Animator.StartIdleHover(_settings.IdleHoverHeight, _settings.IdleHoverDuration);
}
}
@@ -66,7 +67,7 @@ namespace UI.CardSystem.StateMachine.States
// Scale up slightly on hover
if (_context.Animator != null)
{
_context.Animator.AnimateScale(Vector3.one * hoverScaleMultiplier, 0.2f);
_context.Animator.AnimateScale(Vector3.one * _settings.HoverScaleMultiplier, 0.2f);
}
}