# Team Overview Restoration Guide

## Overview
The TeamOverview panel has been successfully restored to the map scene and will appear on the right side of the screen. This system displays your current team members, their stats, and provides convenient navigation and save game functionality.

## What Was Implemented

### 1. TeamOverviewController Script (`Assets/Scripts/UI/TeamOverviewController.cs`)
- **Purpose**: Manages the team overview panel display and functionality
- **Key Features**:
  - Loads and displays current team data
  - Shows team member cards with stats (including new Perception attribute)
  - Provides team summary statistics
  - Handles navigation and save functionality
  - Automatic UI updates when team changes

### 2. Updated MapWithTravelUI.uxml
- **Integration**: TeamOverview panel embedded directly into main map UI
- **Position**: Right side of screen, always visible
- **Layout**: Compact, scrollable design that doesn't interfere with map interaction
- **Styling**: Consistent with existing map UI theme

### 3. MapSceneSetup Script (`Assets/Scripts/UI/MapSceneSetup.cs`)
- **Purpose**: Automatically sets up all map scene UI systems
- **Features**: One-click setup for both team overview and travel systems
- **Verification**: Built-in verification tools for troubleshooting

## How to Use in Unity

### Automatic Setup (Recommended)
1. **Add MapSceneSetup to your map scene**:
   - Create empty GameObject in map scene
   - Name it "MapSceneSetup"
   - Add the `MapSceneSetup` component
   - Ensure "Auto Setup On Start" is checked
   - Ensure "Enable Team Overview" is checked

2. **Verify UI GameObject**:
   - Make sure you have a GameObject named "UI" in your scene
   - It should have a UIDocument component
   - The UIDocument should use the `MapWithTravelUI.uxml` file

### Manual Setup (If Needed)
1. **In Inspector**: Right-click on MapSceneSetup component → "Setup Map Scene"
2. **Verify Setup**: Right-click → "Verify UI Setup" to check everything is working

## Features of the Team Overview Panel

### Team Member Cards
- **Character Name**: Displayed prominently at top of each card
- **Level**: Shows current character level
- **Attributes**: Compact display of STR, DEX, CON, WIS, PER (including new Perception!)
- **Health**: Current/Max health with color coding (red when low, green when healthy)

### Team Summary Stats
- **Member Count**: Total number of team members
- **Total Gold**: Combined gold of all team members
- **Average Level**: Team's average level

### Action Buttons
- **Manage Team**: Returns to Team Select scene for editing team
- **Save Game**: Saves current game state including team data

## Technical Details

### Data Sources
The TeamOverview automatically loads team data from:
1. **MainTeamSelectScript**: If available in current scene
2. **Save System**: Falls back to saved game data
3. **Handles Missing Data**: Gracefully handles empty teams

### UI Integration
- **Shared UI Document**: Uses same UIDocument as travel system
- **Non-Intrusive**: Positioned to not interfere with map interactions
- **Responsive**: Scrollable content adapts to team size

### Performance
- **Efficient Updates**: Only rebuilds UI when team data changes
- **Memory Friendly**: Dynamically creates/destroys UI elements as needed
- **Debug Logging**: Optional debug output for troubleshooting

## Troubleshooting

### Panel Not Visible
1. Check that "UI" GameObject exists in scene
2. Verify UIDocument has correct UXML file assigned
3. Run "Verify UI Setup" context menu on MapSceneSetup
4. Check console for any error messages

### No Team Data
1. Ensure you have created team in Team Select scene
2. Check if save file exists and contains team data
3. Verify MainTeamSelectScript is properly saving team data

### Styling Issues
1. Verify all USS files are properly linked
2. Check that MapWithTravelUI.uxml includes TeamOverview styles
3. UI uses inline styles as fallback for basic appearance

## Integration with Existing Systems

### Works With
- ✅ **Perception Attribute**: Fully displays new perception values
- ✅ **Save/Load System**: Integrates with existing save system
- ✅ **Scene Navigation**: Uses SceneNavigationManager for transitions
- ✅ **Travel System**: Coexists peacefully with travel UI
- ✅ **Point-Buy System**: Shows stats from character creation

### Compatible Features
- **Equipment Bonuses**: Will show total stats including equipment
- **Level Progression**: Updates automatically when characters level up
- **Health Changes**: Real-time health display updates
- **Gold Changes**: Team wealth tracking

## File Locations

```
Assets/
├── Scripts/
│   └── UI/
│       ├── TeamOverviewController.cs      # Main controller
│       └── MapSceneSetup.cs               # Setup automation
├── UI/
│   └── Map/
│       └── MapWithTravelUI.uxml          # Updated with team panel
└── Resources/
    └── UI/
        └── MapScene/
            └── TeamOverview.uxml         # Original standalone file
```

## Next Steps

1. **Test in Play Mode**: Enter map scene and verify panel appears
2. **Create Team**: Use Team Select to create characters and see them displayed
3. **Test Functionality**: Try the Manage Team and Save Game buttons
4. **Customize Styling**: Modify inline styles in UXML if desired

The TeamOverview panel is now fully restored and functional! It will automatically appear on the right side of your map view and display your current team information.
