Make cards use settings
This commit is contained in:
@@ -10,7 +10,7 @@ namespace AppleHills.Core.Settings.Editor
|
|||||||
{
|
{
|
||||||
private Vector2 scrollPosition;
|
private Vector2 scrollPosition;
|
||||||
private List<BaseSettings> allSettings = new List<BaseSettings>();
|
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 int selectedTab = 0;
|
||||||
private Dictionary<string, SerializedObject> serializedSettingsObjects = new Dictionary<string, SerializedObject>();
|
private Dictionary<string, SerializedObject> serializedSettingsObjects = new Dictionary<string, SerializedObject>();
|
||||||
private GUIStyle headerStyle;
|
private GUIStyle headerStyle;
|
||||||
@@ -48,6 +48,7 @@ namespace AppleHills.Core.Settings.Editor
|
|||||||
CreateSettingsIfMissing<PlayerFollowerSettings>("PlayerFollowerSettings");
|
CreateSettingsIfMissing<PlayerFollowerSettings>("PlayerFollowerSettings");
|
||||||
CreateSettingsIfMissing<InteractionSettings>("InteractionSettings");
|
CreateSettingsIfMissing<InteractionSettings>("InteractionSettings");
|
||||||
CreateSettingsIfMissing<DivingMinigameSettings>("DivingMinigameSettings");
|
CreateSettingsIfMissing<DivingMinigameSettings>("DivingMinigameSettings");
|
||||||
|
CreateSettingsIfMissing<CardSystemSettings>("CardSystemSettings");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateSettingsIfMissing<T>(string fileName) where T : BaseSettings
|
private void CreateSettingsIfMissing<T>(string fileName) where T : BaseSettings
|
||||||
@@ -114,6 +115,9 @@ namespace AppleHills.Core.Settings.Editor
|
|||||||
case 2: // Minigames
|
case 2: // Minigames
|
||||||
DrawSettingsEditor<DivingMinigameSettings>();
|
DrawSettingsEditor<DivingMinigameSettings>();
|
||||||
break;
|
break;
|
||||||
|
case 3: // Card System
|
||||||
|
DrawSettingsEditor<CardSystemSettings>();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorGUILayout.EndScrollView();
|
EditorGUILayout.EndScrollView();
|
||||||
|
|||||||
@@ -169,6 +169,7 @@ namespace Core
|
|||||||
var playerSettings = SettingsProvider.Instance.LoadSettingsSynchronous<PlayerFollowerSettings>();
|
var playerSettings = SettingsProvider.Instance.LoadSettingsSynchronous<PlayerFollowerSettings>();
|
||||||
var interactionSettings = SettingsProvider.Instance.LoadSettingsSynchronous<InteractionSettings>();
|
var interactionSettings = SettingsProvider.Instance.LoadSettingsSynchronous<InteractionSettings>();
|
||||||
var minigameSettings = SettingsProvider.Instance.LoadSettingsSynchronous<DivingMinigameSettings>();
|
var minigameSettings = SettingsProvider.Instance.LoadSettingsSynchronous<DivingMinigameSettings>();
|
||||||
|
var cardSystemSettings = SettingsProvider.Instance.LoadSettingsSynchronous<CardSystemSettings>();
|
||||||
|
|
||||||
// Register settings with service locator
|
// Register settings with service locator
|
||||||
if (playerSettings != null)
|
if (playerSettings != null)
|
||||||
@@ -200,9 +201,19 @@ namespace Core
|
|||||||
{
|
{
|
||||||
Debug.LogError("Failed to load MinigameSettings");
|
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
|
// Log success
|
||||||
_settingsLoaded = playerSettings != null && interactionSettings != null && minigameSettings != null;
|
_settingsLoaded = playerSettings != null && interactionSettings != null && minigameSettings != null && cardSystemSettings != null;
|
||||||
if (_settingsLoaded)
|
if (_settingsLoaded)
|
||||||
{
|
{
|
||||||
Logging.Debug("All settings loaded and registered with ServiceLocator");
|
Logging.Debug("All settings loaded and registered with ServiceLocator");
|
||||||
|
|||||||
102
Assets/Scripts/Core/Settings/CardSystemSettings.cs
Normal file
102
Assets/Scripts/Core/Settings/CardSystemSettings.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
3
Assets/Scripts/Core/Settings/CardSystemSettings.cs.meta
Normal file
3
Assets/Scripts/Core/Settings/CardSystemSettings.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ce6f8e26f4e74a9ab16c190529e67638
|
||||||
|
timeCreated: 1762934668
|
||||||
@@ -128,9 +128,36 @@ namespace AppleHills.Core.Settings
|
|||||||
float[] ViewfinderProgressThresholds { get; }
|
float[] ViewfinderProgressThresholds { get; }
|
||||||
float PaddingFactor { get; }
|
float PaddingFactor { get; }
|
||||||
float MaxSizePercent { 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
|
// Flip Animations
|
||||||
PhotoInputModes PhotoInputMode { get; }
|
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; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Core;
|
|||||||
using Pixelplacement;
|
using Pixelplacement;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
|
using AppleHills.Core.Settings;
|
||||||
|
|
||||||
namespace UI.CardSystem
|
namespace UI.CardSystem
|
||||||
{
|
{
|
||||||
@@ -20,10 +21,6 @@ namespace UI.CardSystem
|
|||||||
[Header("References")]
|
[Header("References")]
|
||||||
[SerializeField] private CardDisplay cardDisplay;
|
[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
|
// Events for AlbumViewPage to manage backdrop and reparenting
|
||||||
public event Action<AlbumCard> OnEnlargeRequested;
|
public event Action<AlbumCard> OnEnlargeRequested;
|
||||||
public event Action<AlbumCard> OnShrinkRequested;
|
public event Action<AlbumCard> OnShrinkRequested;
|
||||||
@@ -35,9 +32,12 @@ namespace UI.CardSystem
|
|||||||
private Transform _originalParent;
|
private Transform _originalParent;
|
||||||
private Vector3 _originalLocalPosition;
|
private Vector3 _originalLocalPosition;
|
||||||
private Quaternion _originalLocalRotation;
|
private Quaternion _originalLocalRotation;
|
||||||
|
private ICardSystemSettings _settings;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
|
_settings = GameManager.GetSettingsObject<ICardSystemSettings>();
|
||||||
|
|
||||||
// Auto-find CardDisplay if not assigned
|
// Auto-find CardDisplay if not assigned
|
||||||
if (cardDisplay == null)
|
if (cardDisplay == null)
|
||||||
{
|
{
|
||||||
@@ -133,7 +133,7 @@ namespace UI.CardSystem
|
|||||||
_originalLocalRotation = transform.localRotation;
|
_originalLocalRotation = transform.localRotation;
|
||||||
|
|
||||||
// Scale up with snappy tween
|
// 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>
|
/// <summary>
|
||||||
@@ -147,7 +147,7 @@ namespace UI.CardSystem
|
|||||||
_isEnlarged = false;
|
_isEnlarged = false;
|
||||||
|
|
||||||
// Scale back down with snappy tween, invoke callback when done
|
// 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());
|
completeCallback: () => onComplete?.Invoke());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Pixelplacement;
|
|||||||
using Pixelplacement.TweenSystem;
|
using Pixelplacement.TweenSystem;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
|
using AppleHills.Core.Settings;
|
||||||
|
|
||||||
namespace UI.CardSystem
|
namespace UI.CardSystem
|
||||||
{
|
{
|
||||||
@@ -22,23 +23,15 @@ namespace UI.CardSystem
|
|||||||
|
|
||||||
[Header("Idle Hover Animation")]
|
[Header("Idle Hover Animation")]
|
||||||
[SerializeField] private bool enableIdleHover = true;
|
[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")]
|
[Header("New/Repeat Card Display")]
|
||||||
[SerializeField] private GameObject newCardText;
|
[SerializeField] private GameObject newCardText;
|
||||||
[SerializeField] private GameObject newCardIdleText;
|
[SerializeField] private GameObject newCardIdleText;
|
||||||
[SerializeField] private GameObject repeatText;
|
[SerializeField] private GameObject repeatText;
|
||||||
[SerializeField] private GameObject progressBarContainer;
|
[SerializeField] private GameObject progressBarContainer;
|
||||||
[SerializeField] private int cardsToUpgrade = 5;
|
|
||||||
[SerializeField] private float enlargedScale = 1.5f;
|
|
||||||
|
|
||||||
// State
|
// State
|
||||||
|
private ICardSystemSettings _settings;
|
||||||
private bool _isFlipped = false;
|
private bool _isFlipped = false;
|
||||||
private bool _isFlipping = false;
|
private bool _isFlipping = false;
|
||||||
private TweenBase _idleHoverTween;
|
private TweenBase _idleHoverTween;
|
||||||
@@ -57,10 +50,12 @@ namespace UI.CardSystem
|
|||||||
|
|
||||||
public bool IsFlipped => _isFlipped;
|
public bool IsFlipped => _isFlipped;
|
||||||
public CardData CardData => _cardData;
|
public CardData CardData => _cardData;
|
||||||
public int CardsToUpgrade => cardsToUpgrade; // Expose upgrade threshold
|
public int CardsToUpgrade => _settings?.CardsToUpgrade ?? 5;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
|
_settings = GameManager.GetSettingsObject<ICardSystemSettings>();
|
||||||
|
|
||||||
// Auto-find CardDisplay if not assigned
|
// Auto-find CardDisplay if not assigned
|
||||||
if (cardDisplay == null && cardFrontObject != null)
|
if (cardDisplay == null && cardFrontObject != null)
|
||||||
{
|
{
|
||||||
@@ -149,15 +144,18 @@ namespace UI.CardSystem
|
|||||||
// Card back: 0° → 90° (rotates away)
|
// Card back: 0° → 90° (rotates away)
|
||||||
// Card front: 180° → 90° → 0° (rotates into view)
|
// 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)
|
// Phase 1: Rotate both to 90 degrees (edge view)
|
||||||
if (cardBackObject != null)
|
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)
|
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: () =>
|
completeCallback: () =>
|
||||||
{
|
{
|
||||||
// At edge (90°), switch visibility
|
// At edge (90°), switch visibility
|
||||||
@@ -167,7 +165,7 @@ namespace UI.CardSystem
|
|||||||
cardFrontObject.SetActive(true);
|
cardFrontObject.SetActive(true);
|
||||||
|
|
||||||
// Phase 2: Rotate front from 90 to 0 (show at correct orientation)
|
// 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: () =>
|
completeCallback: () =>
|
||||||
{
|
{
|
||||||
_isFlipped = true;
|
_isFlipped = true;
|
||||||
@@ -181,10 +179,10 @@ namespace UI.CardSystem
|
|||||||
|
|
||||||
// Scale punch during flip for extra juice
|
// Scale punch during flip for extra juice
|
||||||
Vector3 originalScale = transform.localScale;
|
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: () =>
|
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;
|
return;
|
||||||
|
|
||||||
Vector2 originalPos = rectTransform.anchoredPosition;
|
Vector2 originalPos = rectTransform.anchoredPosition;
|
||||||
Vector2 targetPos = originalPos + Vector2.up * idleHoverHeight;
|
Vector2 targetPos = originalPos + Vector2.up * _settings.IdleHoverHeight;
|
||||||
|
|
||||||
_idleHoverTween = Tween.Value(0f, 1f,
|
_idleHoverTween = Tween.Value(0f, 1f,
|
||||||
(val) =>
|
(val) =>
|
||||||
@@ -212,7 +210,7 @@ namespace UI.CardSystem
|
|||||||
rectTransform.anchoredPosition = Vector2.Lerp(originalPos, targetPos, t);
|
rectTransform.anchoredPosition = Vector2.Lerp(originalPos, targetPos, t);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
idleHoverDuration, 0f, Tween.EaseInOut, Tween.LoopType.Loop);
|
_settings.IdleHoverDuration, 0f, Tween.EaseInOut, Tween.LoopType.Loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -242,7 +240,7 @@ namespace UI.CardSystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Scale up slightly on hover
|
// 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)
|
public void OnPointerExit(PointerEventData eventData)
|
||||||
@@ -492,7 +490,7 @@ namespace UI.CardSystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void EnlargeCard()
|
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>
|
/// <summary>
|
||||||
@@ -500,7 +498,7 @@ namespace UI.CardSystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void ReturnToNormalSize()
|
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
|
// After returning to normal, hide new card text, show idle text
|
||||||
if (_isNew)
|
if (_isNew)
|
||||||
@@ -531,6 +529,8 @@ namespace UI.CardSystem
|
|||||||
// Get all child Image components
|
// Get all child Image components
|
||||||
UnityEngine.UI.Image[] progressElements = progressBarContainer.GetComponentsInChildren<UnityEngine.UI.Image>(true);
|
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)
|
// Check if we have the required number of elements (should match cardsToUpgrade)
|
||||||
if (progressElements.Length < cardsToUpgrade)
|
if (progressElements.Length < cardsToUpgrade)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ddd745ae12984de9974292d201c89d9c
|
|
||||||
timeCreated: 1762884650
|
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
using Pixelplacement.TweenSystem;
|
using Pixelplacement.TweenSystem;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System;
|
using System;
|
||||||
|
using AppleHills.Core.Settings;
|
||||||
|
using Core;
|
||||||
|
|
||||||
namespace UI.CardSystem.StateMachine
|
namespace UI.CardSystem.StateMachine
|
||||||
{
|
{
|
||||||
@@ -12,16 +14,15 @@ namespace UI.CardSystem.StateMachine
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class CardAnimator : MonoBehaviour
|
public class CardAnimator : MonoBehaviour
|
||||||
{
|
{
|
||||||
[Header("Animation Settings")]
|
|
||||||
[SerializeField] private float defaultDuration = 0.3f;
|
|
||||||
|
|
||||||
private Transform _transform;
|
private Transform _transform;
|
||||||
private RectTransform _rectTransform;
|
private RectTransform _rectTransform;
|
||||||
|
private ICardSystemSettings _settings;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
_transform = transform;
|
_transform = transform;
|
||||||
_rectTransform = GetComponent<RectTransform>();
|
_rectTransform = GetComponent<RectTransform>();
|
||||||
|
_settings = GameManager.GetSettingsObject<ICardSystemSettings>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Scale Animations
|
#region Scale Animations
|
||||||
@@ -31,7 +32,7 @@ namespace UI.CardSystem.StateMachine
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public TweenBase AnimateScale(Vector3 targetScale, float? duration = null, Action onComplete = null)
|
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);
|
Tween.EaseInOut, completeCallback: onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +86,7 @@ namespace UI.CardSystem.StateMachine
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Tween.AnchoredPosition(_rectTransform, targetPosition, duration ?? defaultDuration, 0f,
|
return Tween.AnchoredPosition(_rectTransform, targetPosition, duration ?? _settings.DefaultAnimationDuration, 0f,
|
||||||
Tween.EaseInOut, completeCallback: onComplete);
|
Tween.EaseInOut, completeCallback: onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +95,7 @@ namespace UI.CardSystem.StateMachine
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public TweenBase AnimateLocalPosition(Vector3 targetPosition, float? duration = null, Action onComplete = null)
|
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);
|
Tween.EaseInOut, completeCallback: onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +108,7 @@ namespace UI.CardSystem.StateMachine
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public TweenBase AnimateLocalRotation(Quaternion targetRotation, float? duration = null, Action onComplete = null)
|
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);
|
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°
|
/// Play card flip animation - rotates card back from 0° to 90°, then card front from 180° to 0°
|
||||||
/// Based on FlippableCard.FlipToReveal()
|
/// Based on FlippableCard.FlipToReveal()
|
||||||
/// </summary>
|
/// </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)
|
// Phase 1: Rotate both to 90 degrees (edge view)
|
||||||
if (cardBack != null)
|
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)
|
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: () =>
|
completeCallback: () =>
|
||||||
{
|
{
|
||||||
// At edge (90°), switch visibility
|
// At edge (90°), switch visibility
|
||||||
@@ -149,7 +152,7 @@ namespace UI.CardSystem.StateMachine
|
|||||||
cardFront.gameObject.SetActive(true);
|
cardFront.gameObject.SetActive(true);
|
||||||
|
|
||||||
// Phase 2: Rotate front from 90 to 0 (show at correct orientation)
|
// 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);
|
completeCallback: onComplete);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -159,14 +162,16 @@ namespace UI.CardSystem.StateMachine
|
|||||||
/// Play scale punch during flip animation for extra juice
|
/// Play scale punch during flip animation for extra juice
|
||||||
/// Based on FlippableCard.FlipToReveal()
|
/// Based on FlippableCard.FlipToReveal()
|
||||||
/// </summary>
|
/// </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;
|
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: () =>
|
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
|
/// Enlarge card to specified scale
|
||||||
/// Based on FlippableCard.EnlargeCard() and AlbumCard.EnlargeCard()
|
/// Based on FlippableCard.EnlargeCard() and AlbumCard.EnlargeCard()
|
||||||
/// </summary>
|
/// </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);
|
completeCallback: onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,9 +196,11 @@ namespace UI.CardSystem.StateMachine
|
|||||||
/// Shrink card back to original scale
|
/// Shrink card back to original scale
|
||||||
/// Based on AlbumCard.ShrinkCard() and FlippableCard.ReturnToNormalSize()
|
/// Based on AlbumCard.ShrinkCard() and FlippableCard.ReturnToNormalSize()
|
||||||
/// </summary>
|
/// </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);
|
completeCallback: onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
using Core.SaveLoad;
|
using Core.SaveLoad;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UI.CardSystem.StateMachine;
|
using AppleHills.Core.Settings;
|
||||||
|
|
||||||
namespace UI.CardSystem.StateMachine.States
|
namespace UI.CardSystem.StateMachine.States
|
||||||
{
|
{
|
||||||
@@ -13,6 +13,7 @@ namespace UI.CardSystem.StateMachine.States
|
|||||||
public class CardAlbumEnlargedState : AppleState, IPointerClickHandler
|
public class CardAlbumEnlargedState : AppleState, IPointerClickHandler
|
||||||
{
|
{
|
||||||
private CardContext _context;
|
private CardContext _context;
|
||||||
|
private ICardSystemSettings _settings;
|
||||||
private Vector3 _originalScale;
|
private Vector3 _originalScale;
|
||||||
private Transform _originalParent;
|
private Transform _originalParent;
|
||||||
private Vector3 _originalLocalPosition;
|
private Vector3 _originalLocalPosition;
|
||||||
@@ -25,6 +26,7 @@ namespace UI.CardSystem.StateMachine.States
|
|||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
_context = GetComponentInParent<CardContext>();
|
_context = GetComponentInParent<CardContext>();
|
||||||
|
_settings = GameManager.GetSettingsObject<ICardSystemSettings>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnEnterState()
|
public override void OnEnterState()
|
||||||
@@ -38,10 +40,10 @@ namespace UI.CardSystem.StateMachine.States
|
|||||||
// Notify page to show backdrop and reparent card to top layer
|
// Notify page to show backdrop and reparent card to top layer
|
||||||
OnEnlargeRequested?.Invoke(this);
|
OnEnlargeRequested?.Invoke(this);
|
||||||
|
|
||||||
// Enlarge the card
|
// Enlarge the card using album scale setting
|
||||||
if (_context.Animator != null)
|
if (_context.Animator != null)
|
||||||
{
|
{
|
||||||
_context.Animator.PlayEnlarge();
|
_context.Animator.PlayEnlarge(_settings.AlbumCardEnlargedScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logging.Debug($"[CardAlbumEnlargedState] Card enlarged from album: {_context.CardData?.Name}");
|
Logging.Debug($"[CardAlbumEnlargedState] Card enlarged from album: {_context.CardData?.Name}");
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Core.SaveLoad;
|
using Core.SaveLoad;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
|
||||||
using Core;
|
using Core;
|
||||||
|
using AppleHills.Core.Settings;
|
||||||
|
|
||||||
namespace UI.CardSystem.StateMachine.States
|
namespace UI.CardSystem.StateMachine.States
|
||||||
{
|
{
|
||||||
@@ -11,16 +11,15 @@ namespace UI.CardSystem.StateMachine.States
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class CardDraggingState : AppleState
|
public class CardDraggingState : AppleState
|
||||||
{
|
{
|
||||||
[Header("Drag Settings")]
|
|
||||||
[SerializeField] private float dragScale = 1.1f;
|
|
||||||
|
|
||||||
private CardContext _context;
|
private CardContext _context;
|
||||||
|
private ICardSystemSettings _settings;
|
||||||
private Vector3 _originalScale;
|
private Vector3 _originalScale;
|
||||||
private Vector3 _dragStartPosition;
|
private Vector3 _dragStartPosition;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
_context = GetComponentInParent<CardContext>();
|
_context = GetComponentInParent<CardContext>();
|
||||||
|
_settings = GameManager.GetSettingsObject<ICardSystemSettings>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnEnterState()
|
public override void OnEnterState()
|
||||||
@@ -30,7 +29,7 @@ namespace UI.CardSystem.StateMachine.States
|
|||||||
_dragStartPosition = _context.RootTransform.position;
|
_dragStartPosition = _context.RootTransform.position;
|
||||||
|
|
||||||
// Scale up slightly during drag for visual feedback
|
// 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}");
|
Logging.Debug($"[CardDraggingState] Entered drag state for card: {_context.CardData?.Name}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using Core.SaveLoad;
|
using Core.SaveLoad;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
|
using AppleHills.Core.Settings;
|
||||||
|
using Core;
|
||||||
|
|
||||||
namespace UI.CardSystem.StateMachine.States
|
namespace UI.CardSystem.StateMachine.States
|
||||||
{
|
{
|
||||||
@@ -14,11 +16,13 @@ namespace UI.CardSystem.StateMachine.States
|
|||||||
[SerializeField] private GameObject newCardBadge;
|
[SerializeField] private GameObject newCardBadge;
|
||||||
|
|
||||||
private CardContext _context;
|
private CardContext _context;
|
||||||
|
private ICardSystemSettings _settings;
|
||||||
private Vector3 _originalScale;
|
private Vector3 _originalScale;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
_context = GetComponentInParent<CardContext>();
|
_context = GetComponentInParent<CardContext>();
|
||||||
|
_settings = GameManager.GetSettingsObject<ICardSystemSettings>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnEnterState()
|
public override void OnEnterState()
|
||||||
@@ -35,7 +39,7 @@ namespace UI.CardSystem.StateMachine.States
|
|||||||
// Enlarge the card
|
// Enlarge the card
|
||||||
if (_context.Animator != null)
|
if (_context.Animator != null)
|
||||||
{
|
{
|
||||||
_context.Animator.PlayEnlarge();
|
_context.Animator.PlayEnlarge(_settings.NewCardEnlargedScale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ using TMPro;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using AppleHills.Core.Settings;
|
||||||
|
using Core;
|
||||||
|
|
||||||
namespace UI.CardSystem.StateMachine.States
|
namespace UI.CardSystem.StateMachine.States
|
||||||
{
|
{
|
||||||
@@ -16,14 +18,15 @@ namespace UI.CardSystem.StateMachine.States
|
|||||||
[SerializeField] private GameObject progressBarContainer;
|
[SerializeField] private GameObject progressBarContainer;
|
||||||
[SerializeField] private Image progressBarFill;
|
[SerializeField] private Image progressBarFill;
|
||||||
[SerializeField] private TextMeshProUGUI progressText;
|
[SerializeField] private TextMeshProUGUI progressText;
|
||||||
[SerializeField] private int cardsToUpgrade = 5;
|
|
||||||
|
|
||||||
private CardContext _context;
|
private CardContext _context;
|
||||||
|
private ICardSystemSettings _settings;
|
||||||
private Vector3 _originalScale;
|
private Vector3 _originalScale;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
_context = GetComponentInParent<CardContext>();
|
_context = GetComponentInParent<CardContext>();
|
||||||
|
_settings = GameManager.GetSettingsObject<ICardSystemSettings>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnEnterState()
|
public override void OnEnterState()
|
||||||
@@ -41,13 +44,14 @@ namespace UI.CardSystem.StateMachine.States
|
|||||||
// Enlarge the card
|
// Enlarge the card
|
||||||
if (_context.Animator != null)
|
if (_context.Animator != null)
|
||||||
{
|
{
|
||||||
_context.Animator.PlayEnlarge();
|
_context.Animator.PlayEnlarge(_settings.NewCardEnlargedScale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateProgressBar()
|
private void UpdateProgressBar()
|
||||||
{
|
{
|
||||||
int currentCount = _context.RepeatCardCount;
|
int currentCount = _context.RepeatCardCount;
|
||||||
|
int cardsToUpgrade = _settings.CardsToUpgrade;
|
||||||
float progress = (float)currentCount / cardsToUpgrade;
|
float progress = (float)currentCount / cardsToUpgrade;
|
||||||
|
|
||||||
if (progressBarFill != null)
|
if (progressBarFill != null)
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
using Pixelplacement.TweenSystem;
|
using Pixelplacement.TweenSystem;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
|
using AppleHills.Core.Settings;
|
||||||
|
using Core;
|
||||||
|
|
||||||
namespace UI.CardSystem.StateMachine.States
|
namespace UI.CardSystem.StateMachine.States
|
||||||
{
|
{
|
||||||
@@ -17,17 +19,16 @@ namespace UI.CardSystem.StateMachine.States
|
|||||||
|
|
||||||
[Header("Idle Hover Settings")]
|
[Header("Idle Hover Settings")]
|
||||||
[SerializeField] private bool enableIdleHover = true;
|
[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 CardContext _context;
|
||||||
|
private ICardSystemSettings _settings;
|
||||||
private TweenBase _idleHoverTween;
|
private TweenBase _idleHoverTween;
|
||||||
private Vector2 _originalPosition;
|
private Vector2 _originalPosition;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
_context = GetComponentInParent<CardContext>();
|
_context = GetComponentInParent<CardContext>();
|
||||||
|
_settings = GameManager.GetSettingsObject<ICardSystemSettings>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnEnterState()
|
public override void OnEnterState()
|
||||||
@@ -57,7 +58,7 @@ namespace UI.CardSystem.StateMachine.States
|
|||||||
// Start idle hover animation
|
// Start idle hover animation
|
||||||
if (enableIdleHover && _context.Animator != null)
|
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
|
// Scale up slightly on hover
|
||||||
if (_context.Animator != null)
|
if (_context.Animator != null)
|
||||||
{
|
{
|
||||||
_context.Animator.AnimateScale(Vector3.one * hoverScaleMultiplier, 0.2f);
|
_context.Animator.AnimateScale(Vector3.one * _settings.HoverScaleMultiplier, 0.2f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user