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

@@ -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());
}