Files
AppleHillsProduction/Assets/Scripts/CardSystem/StateMachine/BoosterCardContext.cs

52 lines
1.5 KiB
C#
Raw Permalink Normal View History

Merge a card refresh (#59) - **Refactored Card Placement Flow** - Separated card presentation from orchestration logic - Extracted `CornerCardManager` for pending card lifecycle (spawn, shuffle, rebuild) - Extracted `AlbumNavigationService` for book page navigation and zone mapping - Extracted `CardEnlargeController` for backdrop management and card reparenting - Implemented controller pattern (non-MonoBehaviour) for complex logic - Cards now unparent from slots before rebuild to prevent premature destruction - **Improved Corner Card Display** - Fixed cards spawning on top of each other during rebuild - Implemented shuffle-to-front logic (remaining cards occupy slots 0→1→2) - Added smart card selection (prioritizes cards matching current album page) - Pending cards now removed from queue immediately on drag start - Corner cards rebuild after each placement with proper slot reassignment - **Enhanced Album Card Viewing** - Added dramatic scale increase when viewing cards from album slots - Implemented shrink animation when dismissing enlarged cards - Cards transition: `PlacedInSlotState` → `AlbumEnlargedState` → `PlacedInSlotState` - Backdrop shows/hides with card enlarge/shrink cycle - Cards reparent to enlarged container while viewing, return to slot after - **State Machine Improvements** - Added `CardStateNames` constants for type-safe state transitions - Implemented `ICardClickHandler` and `ICardStateDragHandler` interfaces - State transitions now use cached property indices - `BoosterCardContext` separated from `CardContext` for single responsibility - **Code Cleanup** - Identified unused `SlotContainerHelper.cs` (superseded by `CornerCardManager`) - Identified unused `BoosterPackDraggable.canOpenOnDrop` field - Identified unused `AlbumViewPage._previousInputMode` (hardcoded value) - Identified unused `Card.OnPlacedInAlbumSlot` event (no subscribers) Co-authored-by: Michal Pikulski <michal.a.pikulski@gmail.com> Co-authored-by: Michal Pikulski <michal@foolhardyhorizons.com> Reviewed-on: https://homelab.tailf7f81b.ts.net/tschesky/AppleHillsProduction/pulls/59
2025-11-18 08:40:59 +00:00
using System;
namespace UI.CardSystem.StateMachine
{
/// <summary>
/// Booster-specific card context for reveal flow coordination.
/// Separated from generic CardContext to maintain single responsibility.
/// </summary>
public class BoosterCardContext
{
// Booster reveal workflow state
private bool _hasCompletedReveal = false;
/// <summary>
/// Has this card completed its booster reveal flow?
/// </summary>
public bool HasCompletedReveal => _hasCompletedReveal;
/// <summary>
/// Suppress NEW/REPEAT badges in revealed state
/// </summary>
public bool SuppressRevealBadges { get; set; } = false;
/// <summary>
/// Event fired when reveal flow is complete (card dismissed)
/// </summary>
public event Action OnRevealFlowComplete;
/// <summary>
/// Signal that this card has completed its reveal flow
/// </summary>
public void NotifyRevealComplete()
{
if (!_hasCompletedReveal)
{
_hasCompletedReveal = true;
OnRevealFlowComplete?.Invoke();
}
}
/// <summary>
/// Reset reveal state (for card reuse/pooling)
/// </summary>
public void Reset()
{
_hasCompletedReveal = false;
SuppressRevealBadges = false;
}
}
}