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

@@ -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; }
}
/// <summary>
/// Interface for card system settings
/// </summary>
public interface ICardSystemSettings
{
// Idle Hover Animations
float IdleHoverHeight { get; }
float IdleHoverDuration { get; }
float HoverScaleMultiplier { get; }
// Photo Input Settings
PhotoInputModes PhotoInputMode { 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; }
}
}