First draft of the consolidated card system
This commit is contained in:
@@ -1,132 +0,0 @@
|
||||
# Card System Implementation Plan
|
||||
|
||||
## Current Implementation Analysis
|
||||
|
||||
### Data Layer
|
||||
|
||||
1. **CardData.cs**:
|
||||
- Represents an instance of a card in the player's collection
|
||||
- Contains unique ID, rarity, and copies owned
|
||||
- Has a reference to its CardDefinition for display information
|
||||
- Includes methods for rarity upgrades when collecting duplicates
|
||||
- Well-structured with proper serialization support
|
||||
|
||||
2. **CardDefinition.cs**:
|
||||
- ScriptableObject template for creating card instances
|
||||
- Contains basic info (name, description), visuals, and collection data
|
||||
- Provides helper methods like CreateCardData() and GetBackgroundColor()
|
||||
- Supports different zones (AppleHills, Quarry, Forest, Mountain, Beach)
|
||||
|
||||
3. **CardSystemManager.cs**:
|
||||
- Singleton manager for the card system
|
||||
- Manages available card definitions and player inventory
|
||||
- Includes event callbacks for booster packs and card collection
|
||||
- Has partial implementation for adding booster packs
|
||||
- Has a simple CardInventory class stub
|
||||
|
||||
4. **CardVisualConfig.cs**:
|
||||
- ScriptableObject for configuring the visual appearance of cards
|
||||
- Maps rarities to colors and zones to colors/shapes
|
||||
- Uses dictionary lookups for efficient access
|
||||
|
||||
### UI Layer
|
||||
|
||||
1. **CardUIElement.cs**:
|
||||
- Handles displaying a single card in the UI
|
||||
- Updates visuals based on card data (rarity, zone)
|
||||
- References UI elements like card name text, images, frames, etc.
|
||||
|
||||
2. **UIPageController.cs**:
|
||||
- Manages UI page transitions with a stack-based navigation system
|
||||
- Provides methods for pushing, popping, and clearing the page stack
|
||||
- Uses events to notify when pages change
|
||||
|
||||
3. **UI Page Components**:
|
||||
- Several page-related files (AlbumViewPage.cs, BoosterOpeningPage.cs, CardMenuPage.cs)
|
||||
- CardAlbumUI.cs file for handling the album display
|
||||
- Base UIPage.cs class for common page functionality
|
||||
|
||||
## What's done
|
||||
1. **Complete CardInventory Implementation**:
|
||||
- Move from simple stub to full implementation
|
||||
- Add methods to manage the player's card collection
|
||||
- Implement filtering, sorting, and organization features
|
||||
|
||||
2. **Booster Pack Generation**:
|
||||
- Complete the logic to generate random booster packs with appropriate rarity distribution
|
||||
- Implement methods for awarding booster packs to the player
|
||||
- Add events for notifying UI when booster packs are obtained
|
||||
|
||||
## What's currently being worked on
|
||||
3. **Card Collection UI**:
|
||||
- Complete the album browsing UI with filtering and sorting options
|
||||
- Implement visual indicators for owned/not owned cards
|
||||
- Add UI for tracking collection completion
|
||||
|
||||
## What's Missing
|
||||
Based on the requirements, here's what still needs to be implemented:
|
||||
4. **Booster Pack Opening UI**:
|
||||
- Implement the UI flow for opening booster packs
|
||||
- Add card reveal animations and effects
|
||||
- Create UI feedback for rare card discoveries
|
||||
|
||||
5. **Save/Load System**:
|
||||
- Implement persistence for the player's card collection
|
||||
- Add autosave functionality for cards and booster packs
|
||||
|
||||
## Implementation Plan
|
||||
|
||||
### Step 1: Complete the Data Layer
|
||||
|
||||
1. **Implement CardInventory.cs**:
|
||||
- Create a dedicated class file (replacing the stub in CardSystemManager)
|
||||
- Add methods for adding/removing cards, checking duplicates
|
||||
- Implement filtering by zone, rarity, etc.
|
||||
- Add collection statistics methods
|
||||
|
||||
2. **Complete CardSystemManager.cs**:
|
||||
- Update references to use the new CardInventory class
|
||||
- Add methods for save/load integration
|
||||
- Implement additional helper methods for card management
|
||||
|
||||
### Step 2: Implement UI Flow
|
||||
|
||||
1. **Complete UIPage Implementations**:
|
||||
- Implement CardMenuPage.cs as the main card system entry point
|
||||
- Complete AlbumViewPage.cs for browsing the collection
|
||||
- Implement BoosterOpeningPage.cs for the pack opening experience
|
||||
|
||||
2. **Card Collection Browsing**:
|
||||
- Complete CardAlbumUI.cs to display the player's collection
|
||||
- Add filtering by zone, rarity, etc.
|
||||
- Implement pagination for large collections
|
||||
|
||||
3. **Booster Pack UI**:
|
||||
- Create UI for displaying and opening booster packs
|
||||
- Implement card reveal animations and transitions
|
||||
- Add sound effects and visual feedback
|
||||
|
||||
### Step 3: Integration and Polishing
|
||||
|
||||
1. **Connect UI to Data Layer**:
|
||||
- Hook up UI components to CardSystemManager events
|
||||
- Ensure data flows correctly between UI and data layers
|
||||
|
||||
2. **Test and Balance**:
|
||||
- Test rarity distribution in booster packs
|
||||
- Balance the upgrade system for duplicates
|
||||
|
||||
3. **Performance Optimization**:
|
||||
- Implement object pooling for card UI elements
|
||||
- Optimize loading of card data and sprites
|
||||
|
||||
### Step 4: Additional Features (Optional)
|
||||
|
||||
1. **Card Trading System**:
|
||||
- Allow players to trade cards with NPCs or other players
|
||||
|
||||
2. **Special Collection Bonuses**:
|
||||
- Rewards for completing sets of cards
|
||||
|
||||
3. **Card Usage Mechanics**:
|
||||
- Ways to use cards in gameplay beyond collection
|
||||
114
docs/card_system_implementation_plan_updated.md
Normal file
114
docs/card_system_implementation_plan_updated.md
Normal file
@@ -0,0 +1,114 @@
|
||||
# Card System Implementation Plan
|
||||
|
||||
## Current Implementation Analysis
|
||||
|
||||
### Data Layer
|
||||
|
||||
1. **CardData.cs**:
|
||||
- Represents an instance of a card in the player's collection
|
||||
- Contains unique ID, rarity, and copies owned
|
||||
- Has a reference to its CardDefinition for display information
|
||||
- Includes methods for rarity upgrades when collecting duplicates
|
||||
- Well-structured with proper serialization support
|
||||
|
||||
2. **CardDefinition.cs**:
|
||||
- ScriptableObject template for creating card instances
|
||||
- Contains basic info (name, description), visuals, and collection data
|
||||
- Provides helper methods like CreateCardData() and GetBackgroundColor()
|
||||
- Supports different zones (AppleHills, Quarry, Forest, Mountain, Beach)
|
||||
|
||||
3. **CardSystemManager.cs**:
|
||||
- Singleton manager for the card system
|
||||
- Manages available card definitions and player inventory
|
||||
- Includes event callbacks for booster packs and card collection
|
||||
- Implements functionality for adding and opening booster packs
|
||||
|
||||
4. **CardInventory.cs**:
|
||||
- Fully implemented management of the player's card collection
|
||||
- Includes methods for adding cards and tracking booster packs
|
||||
- Provides filtering methods for different card types
|
||||
- Supports card lookup by various properties (zone, rarity)
|
||||
|
||||
5. **CardVisualConfig.cs**:
|
||||
- ScriptableObject for configuring the visual appearance of cards
|
||||
- Maps rarities to colors and zones to colors/shapes
|
||||
- Uses dictionary lookups for efficient access
|
||||
|
||||
### UI Layer
|
||||
|
||||
1. **CardUIElement.cs**:
|
||||
- Handles displaying a single card in the UI
|
||||
- Updates visuals based on card data (rarity, zone)
|
||||
- References UI elements like card name text, images, frames, etc.
|
||||
|
||||
2. **UIPageController.cs**:
|
||||
- Manages UI page transitions with a stack-based navigation system
|
||||
- Provides methods for pushing, popping, and clearing the page stack
|
||||
- Uses events to notify when pages change
|
||||
|
||||
3. **UI Page Components**:
|
||||
- **CardMenuPage.cs**: Main menu for card system navigation
|
||||
- **AlbumViewPage.cs**: Simplified implementation that shows filtered cards in grid
|
||||
- **BoosterOpeningPage.cs**: Interactive card reveal experience
|
||||
- **CardAlbumUI.cs**: Main controller for the card system UI
|
||||
- **UIPage.cs**: Base class for common page functionality
|
||||
|
||||
## Implementation Status
|
||||
|
||||
### Completed
|
||||
1. **Complete CardInventory Implementation**:
|
||||
- Full implementation with methods to manage the player's card collection
|
||||
- Filtering, sorting, and organization features
|
||||
- Integration with CardSystemManager
|
||||
|
||||
2. **Booster Pack Generation**:
|
||||
- Logic to generate random booster packs with appropriate rarity distribution
|
||||
- Methods for awarding booster packs to the player
|
||||
- Events for notifying UI when booster packs are obtained
|
||||
|
||||
3. **Card Collection UI**:
|
||||
- Simplified album browsing UI with filtering and sorting options
|
||||
- Removed unnecessary card stack and slot system
|
||||
- Updated AlbumViewPage to use TextMeshPro components
|
||||
|
||||
4. **Booster Pack Opening UI (In Progress)**:
|
||||
- Implemented interactive card reveal system
|
||||
- Added card back prefabs for clickable reveal experience
|
||||
- Created flip animations and particle effects for card reveals
|
||||
- Updated to support revealing three cards individually
|
||||
|
||||
### Still Needed
|
||||
1. **Booster Opening UI Refinement**:
|
||||
- Fine-tune animation timings and transitions
|
||||
- Implement custom card back designs
|
||||
- Add more visual/audio feedback for different rarities
|
||||
|
||||
2. **Save/Load System**:
|
||||
- Implement persistence for the player's card collection
|
||||
- Add autosave functionality for cards and booster packs
|
||||
|
||||
3. **Card Collection Statistics**:
|
||||
- Add UI for tracking collection completion
|
||||
- Implement achievements for collecting sets
|
||||
|
||||
## Next Steps
|
||||
|
||||
### 1. Complete the Booster Opening Experience
|
||||
- Create proper card back prefab with appropriate design
|
||||
- Test and refine the card reveal animations
|
||||
- Ensure particle effects and sounds play correctly
|
||||
|
||||
### 2. Add Save/Load System
|
||||
- Implement JSON serialization for CardInventory
|
||||
- Add autosave triggers after obtaining new cards
|
||||
- Create save/load methods in CardSystemManager
|
||||
|
||||
### 3. Polish the Overall Experience
|
||||
- Add transition animations between pages
|
||||
- Improve visual feedback for obtaining new cards
|
||||
- Implement collection statistics display
|
||||
|
||||
### 4. Additional Features (Optional)
|
||||
- Special collection bonuses for completing sets
|
||||
- Card trading system with NPCs
|
||||
- Card usage mechanics beyond collection
|
||||
@@ -8,7 +8,7 @@ The card system UI should be structured with a modular prefab approach:
|
||||
|
||||
1. **Main Card System Prefab** - Contains the CardAlbumUI component and core structure
|
||||
2. **Individual UI Page Prefabs** - Each page as its own prefab
|
||||
3. **Card UI Prefabs** - For cards and card slots
|
||||
3. **Card UI Prefab** - For card display and interaction
|
||||
|
||||
## Detailed Prefab Structure
|
||||
|
||||
@@ -18,13 +18,13 @@ The card system UI should be structured with a modular prefab approach:
|
||||
CardSystem (with CardAlbumUI component)
|
||||
├── BackpackIcon (GameObject)
|
||||
│ ├── BackpackImage (Image)
|
||||
│ ├── BoosterCountText (Text)
|
||||
│ ├── BoosterCountText (TextMeshProUGUI)
|
||||
│ └── NotificationDot (GameObject with Image)
|
||||
├── UIPageController (automatically added by CardAlbumUI if not present)
|
||||
└── Notifications (GameObject)
|
||||
└── NewCardNotification (GameObject)
|
||||
├── Background (Image)
|
||||
└── Text (Text)
|
||||
└── Text (TextMeshProUGUI)
|
||||
```
|
||||
|
||||
### Page Prefabs
|
||||
@@ -33,15 +33,15 @@ CardSystem (with CardAlbumUI component)
|
||||
```
|
||||
MainMenuPage (with CardMenuPage component & CanvasGroup)
|
||||
├── Background (Image)
|
||||
├── Title (Text)
|
||||
├── Title (TextMeshProUGUI)
|
||||
├── OpenBoosterButton (Button)
|
||||
│ └── Text (Text)
|
||||
│ └── Text (TextMeshProUGUI)
|
||||
├── ViewAlbumButton (Button)
|
||||
│ └── Text (Text)
|
||||
│ └── Text (TextMeshProUGUI)
|
||||
├── ChangeClothesButton (Button)
|
||||
│ └── Text (Text)
|
||||
│ └── Text (TextMeshProUGUI)
|
||||
└── NoBoostersMessage (GameObject)
|
||||
└── Text (Text)
|
||||
└── Text (TextMeshProUGUI)
|
||||
```
|
||||
|
||||
**2. AlbumViewPage Prefab:**
|
||||
@@ -49,19 +49,16 @@ MainMenuPage (with CardMenuPage component & CanvasGroup)
|
||||
AlbumViewPage (with AlbumViewPage component & CanvasGroup)
|
||||
├── Background (Image)
|
||||
├── FilterPanel (GameObject)
|
||||
│ ├── ZoneFilterDropdown (Dropdown)
|
||||
│ │ ├── Label (Text)
|
||||
│ ├── ZoneFilterDropdown (TMP_Dropdown)
|
||||
│ │ ├── Label (TextMeshProUGUI)
|
||||
│ │ └── Arrow (Image)
|
||||
│ ├── RarityFilterDropdown (Dropdown)
|
||||
│ │ ├── Label (Text)
|
||||
│ ├── RarityFilterDropdown (TMP_Dropdown)
|
||||
│ │ ├── Label (TextMeshProUGUI)
|
||||
│ │ └── Arrow (Image)
|
||||
│ └── ResetFiltersButton (Button)
|
||||
│ └── Text (Text)
|
||||
│ └── Text (TextMeshProUGUI)
|
||||
├── AlbumScrollView (ScrollRect)
|
||||
│ └── AlbumGrid (GridLayoutGroup)
|
||||
├── CardStackContainer (RectTransform)
|
||||
└── EmptyAlbumMessage (GameObject)
|
||||
└── Text (Text)
|
||||
```
|
||||
|
||||
**3. BoosterOpeningPage Prefab:**
|
||||
@@ -70,11 +67,14 @@ BoosterOpeningPage (with BoosterOpeningPage component & CanvasGroup)
|
||||
├── Background (Image)
|
||||
├── BoosterPackObject (GameObject)
|
||||
│ └── BoosterImage (Image)
|
||||
├── CardRevealTransform (Transform)
|
||||
├── CardRevealContainer (RectTransform)
|
||||
│ ├── CardRevealPosition1 (Transform)
|
||||
│ ├── CardRevealPosition2 (Transform)
|
||||
│ └── CardRevealPosition3 (Transform)
|
||||
├── OpenBoosterButton (Button)
|
||||
│ └── Text (Text)
|
||||
│ └── Text (TextMeshProUGUI)
|
||||
├── ContinueButton (Button)
|
||||
│ └── Text (Text)
|
||||
│ └── Text (TextMeshProUGUI)
|
||||
├── CardRevealSound (AudioSource)
|
||||
├── RareCardSound (AudioSource)
|
||||
├── CardRevealParticles (ParticleSystem)
|
||||
@@ -83,25 +83,25 @@ BoosterOpeningPage (with BoosterOpeningPage component & CanvasGroup)
|
||||
|
||||
### Card-Related Prefabs
|
||||
|
||||
**1. CardSlotPrefab:**
|
||||
```
|
||||
CardSlot (GameObject)
|
||||
├── Background (Image)
|
||||
└── SlotLabel (Text)
|
||||
```
|
||||
|
||||
**2. CardPrefab:**
|
||||
**1. CardPrefab:**
|
||||
```
|
||||
Card (with CardUIElement component & Button)
|
||||
├── CardBackground (Image)
|
||||
├── CardFrame (Image)
|
||||
├── CardImage (Image)
|
||||
├── CardNameText (Text)
|
||||
├── CardDescriptionText (Text)
|
||||
├── ZoneLabel (Text)
|
||||
├── CardNameText (TextMeshProUGUI)
|
||||
├── CardDescriptionText (TextMeshProUGUI)
|
||||
├── ZoneLabel (TextMeshProUGUI)
|
||||
└── RarityIndicator (Image)
|
||||
```
|
||||
|
||||
**2. CardBackPrefab:**
|
||||
```
|
||||
CardBack (with Button component)
|
||||
├── CardBackImage (Image)
|
||||
└── BackDesign (Image)
|
||||
```
|
||||
|
||||
## Component Setup Guide
|
||||
|
||||
### CardAlbumUI Component Setup
|
||||
@@ -146,9 +146,6 @@ CardMenuPage Component Inspector:
|
||||
AlbumViewPage Component Inspector:
|
||||
- Album UI Elements:
|
||||
- Album Grid: [AlbumGrid Component]
|
||||
- Card Stack Container: [CardStackContainer Transform]
|
||||
- Empty Album Message: [EmptyAlbumMessage GameObject]
|
||||
- Card Slot Prefab: [CardSlotPrefab Asset]
|
||||
- Card Prefab: [CardPrefab Asset]
|
||||
- Filter UI:
|
||||
- Zone Filter Dropdown: [ZoneFilterDropdown]
|
||||
@@ -163,14 +160,19 @@ AlbumViewPage Component Inspector:
|
||||
BoosterOpeningPage Component Inspector:
|
||||
- UI Elements:
|
||||
- Booster Pack Object: [BoosterPackObject]
|
||||
- Card Reveal Transform: [CardRevealTransform]
|
||||
- Card Reveal Container: [CardRevealContainer]
|
||||
- Card Reveal Positions: [Array of 3 Transform positions]
|
||||
- Card Prefab: [CardPrefab Asset]
|
||||
- Card Back Prefab: [CardBackPrefab Asset]
|
||||
- Open Booster Button: [OpenBoosterButton]
|
||||
- Continue Button: [ContinueButton]
|
||||
- Canvas Group: [CanvasGroup on this GameObject]
|
||||
- Open Booster Text: [TextMeshProUGUI]
|
||||
- Continue Text: [TextMeshProUGUI]
|
||||
- Animation Settings:
|
||||
- Card Reveal Delay: 0.5 (adjustable)
|
||||
- Card Move To Backpack Delay: 1.0 (adjustable)
|
||||
- Card Reveal Delay: 0.3 (adjustable)
|
||||
- Card Move To Backpack Delay: 0.8 (adjustable)
|
||||
- Flip Animation Duration: 0.5 (adjustable)
|
||||
- Backpack Target Transform: [BackpackIcon Transform]
|
||||
- Card Reveal Sound: [CardRevealSound Component]
|
||||
- Rare Card Sound: [RareCardSound Component]
|
||||
@@ -198,21 +200,21 @@ CardUIElement Component Inspector:
|
||||
|
||||
Start by creating the card prefabs since other prefabs will reference them:
|
||||
|
||||
1. **Create CardSlotPrefab**:
|
||||
- Create GameObject → UI → Image
|
||||
- Add Text component for slot label
|
||||
- Adjust visual appearance for an empty slot
|
||||
- Save as prefab
|
||||
|
||||
2. **Create CardPrefab**:
|
||||
1. **Create CardPrefab**:
|
||||
- Create GameObject → UI → Image (for background)
|
||||
- Add child Images for frame and card art
|
||||
- Add Text components for name, description, zone
|
||||
- Add TextMeshPro components for name, description, zone
|
||||
- Add CardUIElement script
|
||||
- Configure Inspector references
|
||||
- Add Button component
|
||||
- Save as prefab
|
||||
|
||||
2. **Create CardBackPrefab**:
|
||||
- Create GameObject → UI → Image (for card back)
|
||||
- Add Button component for interaction
|
||||
- Style appropriately to match your game's aesthetics
|
||||
- Save as prefab
|
||||
|
||||
### 2. Create UI Page Prefabs
|
||||
|
||||
Create each page prefab individually:
|
||||
@@ -229,16 +231,17 @@ Create each page prefab individually:
|
||||
- Add AlbumViewPage script
|
||||
- Add CanvasGroup component
|
||||
- Configure all Inspector references
|
||||
- Assign CardSlotPrefab and CardPrefab
|
||||
- Assign CardPrefab
|
||||
- Save as prefab
|
||||
|
||||
3. **Create BoosterOpeningPage Prefab**:
|
||||
- Set up UI elements as shown in structure
|
||||
- Create CardRevealContainer with three child positions
|
||||
- Add BoosterOpeningPage script
|
||||
- Add CanvasGroup component
|
||||
- Add audio sources and particle systems
|
||||
- Configure all Inspector references
|
||||
- Assign CardPrefab
|
||||
- Assign CardPrefab and CardBackPrefab
|
||||
- Save as prefab
|
||||
|
||||
### 3. Create Main CardSystem Prefab
|
||||
Reference in New Issue
Block a user