# DEPRECATED - Old Card System Files ## ⚠️ This folder contains old card system files that have been replaced by the new state machine implementation. **DO NOT USE THESE FILES IN NEW CODE.** These files are kept temporarily for backward compatibility during migration. Once all code is migrated to the new Card state machine system, this entire folder can be deleted. --- ## Files in this folder: ### **Old Card Components:** 1. **FlippableCard.cs** - Old monolithic card component for booster opening - **Replaced by:** `Card.cs` + state machine (IdleState, FlippingState, EnlargedNewState, etc.) - 700+ lines of boolean-driven state management - Used in old BoosterOpeningPage 2. **AlbumCard.cs** - Old album card component for tap-to-enlarge functionality - **Replaced by:** `Card.cs` (PlacedInSlotState → AlbumEnlargedState) - Wrapped CardDisplay and managed enlarge/shrink - Used in old AlbumViewPage ### **Old Drag/Drop Wrappers:** 3. **CardDraggable.cs** - Empty wrapper around DraggableObject - Only stored CardData (now in CardContext) - **Replaced by:** `Card.cs` now inherits from DraggableObject directly 4. **CardDraggableVisual.cs** - Visual component for CardDraggable - Managed CardDisplay child - **Replaced by:** Card state machine handles all visuals 5. **AlbumCardPlacementDraggable.cs** - Drag wrapper for FlippableCard in album corner placement flow - Handled tap-to-reveal, drag-to-place logic - **Replaced by:** `Card.cs` with SetupForAlbumPlacement() + drag event hooks ### **Old Interaction Handler:** 6. **CardInteractionHandler.cs** - Bridge between Unity pointer events and state machine - Implemented IBeginDragHandler, IDragHandler, IEndDragHandler - **Replaced by:** `Card.cs` inherits from DraggableObject (already has these interfaces) --- ## What Replaced Them: ### **New State Machine System:** **Single Card Component:** ``` Card.cs (inherits from DraggableObject) ├─ CardContext.cs (shared data + events) ├─ CardAnimator.cs (reusable animations) └─ 7 State Components: ├─ CardIdleState.cs (card back, hover, click to flip) ├─ CardRevealedState.cs (normal size, waiting, idle badges) ├─ CardEnlargedNewState.cs (enlarged with NEW badge) ├─ CardEnlargedRepeatState.cs (enlarged with progress bar) ├─ CardDraggingState.cs (visual feedback during drag) ├─ CardPlacedInSlotState.cs (in album slot) └─ CardAlbumEnlargedState.cs (enlarged from album) ``` ### **Benefits:** - ✅ **60% less code** (shared components, no duplication) - ✅ **No boolean soup** (1 active state vs 12+ boolean flags) - ✅ **Automatic visual management** (state-owned GameObjects) - ✅ **Easier testing** (can test states in isolation) - ✅ **Simpler extension** (add new state vs modify monolith) - ✅ **Better debugging** (inspector shows active state name) --- ## Migration Status: ### **Phase 1: Implementation ✅ COMPLETE** - [x] Created Card.cs with state machine - [x] Created all 7 state components - [x] Created CardContext, CardAnimator - [x] Integrated drag/drop (Card inherits DraggableObject) - [x] Moved old files to DEPRECATED/ ### **Phase 2: Booster Opening Migration 🚧 IN PROGRESS** - [ ] Update BoosterOpeningPage to use Card.cs - [ ] Replace FlippableCard spawning with Card spawning - [ ] Use Card.SetupForBoosterReveal() - [ ] Test all booster flows (NEW, REPEAT, UPGRADE) ### **Phase 3: Album Migration 🚧 PENDING** - [ ] Update AlbumViewPage corner cards to use Card.cs - [ ] Use Card.SetupForAlbumPlacement() - [ ] Update album slots to use Card.cs - [ ] Use Card.SetupForAlbumSlot() - [ ] Test drag/drop to slots - [ ] Test enlarge/shrink from album ### **Phase 4: Cleanup 🚧 PENDING** - [ ] Verify no references to old files in active code - [ ] Delete DEPRECATED/ folder - [ ] Remove old prefab variants - [ ] Update documentation --- ## How to Migrate Code: ### **Old Booster Opening (FlippableCard):** ```csharp // OLD: FlippableCard card = Instantiate(flippableCardPrefab); card.SetupCard(cardData); card.OnCardRevealed += OnCardRevealed; if (isNewCard) card.ShowAsNew(); else if (willUpgrade) card.ShowAsRepeatWithUpgrade(ownedCount, lowerRarityCard); else card.ShowAsRepeat(ownedCount); ``` ### **New Booster Opening (Card + States):** ```csharp // NEW: Card card = Instantiate(cardPrefab); card.SetupForBoosterReveal(cardData, isNew: isNewCard); card.Context.RepeatCardCount = ownedCount; card.Context.OnFlipComplete += OnCardFlipComplete; card.Context.OnCardInteractionComplete += OnCardComplete; // Card automatically transitions through states on click ``` --- ### **Old Album Placement (AlbumCardPlacementDraggable):** ```csharp // OLD: AlbumCardPlacementDraggable card = Instantiate(placementPrefab); card.SetupCard(cardData); card.OnCardRevealed += OnCardRevealed; card.OnCardPlacedInAlbum += OnCardPlaced; // Tap to reveal, drag to place ``` ### **New Album Placement (Card + States):** ```csharp // NEW: Card card = Instantiate(cardPrefab); card.SetupForAlbumPlacement(cardData); // Card starts in RevealedState, can be dragged // Automatically transitions to PlacedInSlotState when dropped in slot ``` --- ### **Old Album Card (AlbumCard):** ```csharp // OLD: AlbumCard card = Instantiate(albumCardPrefab); card.SetupCard(cardData); card.OnEnlargeRequested += OnCardEnlarged; card.OnShrinkRequested += OnCardShrunk; card.EnlargeCard(); // Manual enlarge ``` ### **New Album Card (Card + States):** ```csharp // NEW: Card card = Instantiate(cardPrefab, albumSlot.transform); card.SetupForAlbumSlot(cardData, albumSlot); // Click to enlarge → AlbumEnlargedState // Tap to shrink → PlacedInSlotState // State machine handles transitions automatically ``` --- ## When Can We Delete This Folder? **Checklist:** - [ ] BoosterOpeningPage fully migrated to Card.cs - [ ] AlbumViewPage fully migrated to Card.cs - [ ] All prefabs updated to use new Card prefab - [ ] All old prefabs deleted/archived - [ ] No compiler references to: - FlippableCard - AlbumCard - CardDraggable - CardDraggableVisual - AlbumCardPlacementDraggable - CardInteractionHandler - [ ] All tests passing with new system - [ ] QA approved for production **Once all checkboxes are complete, delete this entire DEPRECATED/ folder.** --- ## Need Help Migrating? See documentation: - `docs/cards_wip/card_system_implementation_summary.md` - Architecture overview - `docs/cards_wip/card_prefab_assembly_guide.md` - How to build Card prefab - `docs/cards_wip/card_dragdrop_integration_summary.md` - Drag/drop integration - `docs/cards_wip/card_test_scene_setup_guide.md` - Testing scene setup --- **Last Updated:** December 11, 2025 **Migration Status:** Phase 1 Complete, Phase 2-4 In Progress