6.7 KiB
6.7 KiB
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:
-
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
-
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:
-
CardDraggable.cs
- Empty wrapper around DraggableObject
- Only stored CardData (now in CardContext)
- Replaced by:
Card.csnow inherits from DraggableObject directly
-
CardDraggableVisual.cs
- Visual component for CardDraggable
- Managed CardDisplay child
- Replaced by: Card state machine handles all visuals
-
AlbumCardPlacementDraggable.cs
- Drag wrapper for FlippableCard in album corner placement flow
- Handled tap-to-reveal, drag-to-place logic
- Replaced by:
Card.cswith SetupForAlbumPlacement() + drag event hooks
Old Interaction Handler:
- CardInteractionHandler.cs
- Bridge between Unity pointer events and state machine
- Implemented IBeginDragHandler, IDragHandler, IEndDragHandler
- Replaced by:
Card.csinherits 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
- Created Card.cs with state machine
- Created all 7 state components
- Created CardContext, CardAnimator
- Integrated drag/drop (Card inherits DraggableObject)
- 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):
// 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):
// 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):
// 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):
// 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):
// OLD:
AlbumCard card = Instantiate(albumCardPrefab);
card.SetupCard(cardData);
card.OnEnlargeRequested += OnCardEnlarged;
card.OnShrinkRequested += OnCardShrunk;
card.EnlargeCard(); // Manual enlarge
New Album Card (Card + States):
// 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 overviewdocs/cards_wip/card_prefab_assembly_guide.md- How to build Card prefabdocs/cards_wip/card_dragdrop_integration_summary.md- Drag/drop integrationdocs/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