175 lines
6.0 KiB
Markdown
175 lines
6.0 KiB
Markdown
# 77 — WBP_CreditsScreen
|
||
|
||
## Blueprint Spec — UE 5.5–5.7
|
||
|
||
---
|
||
|
||
### Parent Class
|
||
`UserWidget`
|
||
|
||
### Dependencies
|
||
- [`BPC_InputManager`](../02-player/13_BPC_InputManager.md) — Skip input handling
|
||
- [`BPC_AudioManager`](../10-adaptive/66_BPC_AudioManager.md) — Credit music/ambience
|
||
- [`BPC_LoadingScreen`](../11-polish/76_BPC_LoadingScreen.md) — Post-credits transition
|
||
- [`DA_CreditsData`](../12-content/80_DA_CreditsData.md) — Credit entries (Phase 12)
|
||
|
||
### Purpose
|
||
Animated credits display shown at game completion. Renders scrolling credit entries with sections (department headings, names, roles), supports speed control, pause/resume, and skip. Includes fade-in/out transitions and supports both standard and post-credits scenes. Designed to feel cinematic with smooth scrolling text.
|
||
|
||
### Enums
|
||
|
||
**ECreditSectionType**
|
||
|
||
| Value | Description |
|
||
|-------|-------------|
|
||
| Title | Main title text |
|
||
| Department | Group heading |
|
||
| Name | Person/role entry |
|
||
| Divider | Separator line |
|
||
| Special | Custom styled entry |
|
||
| Logo | Company logo display |
|
||
|
||
### Structs
|
||
|
||
**FCreditEntry**
|
||
|
||
| Field | Type | Description |
|
||
|-------|------|-------------|
|
||
| SectionType | ECreditSectionType | Entry category |
|
||
| Text | FText | Display text |
|
||
| SubText | FText | Role or subtitle |
|
||
| DelaySeconds | Float | Extra pause before |
|
||
| FontScale | Float | Size multiplier |
|
||
| bBold | Bool | Bold style |
|
||
| LogoTexture | UTexture2D | Optional logo |
|
||
|
||
**FCreditsSection**
|
||
|
||
| Field | Type | Description |
|
||
|-------|------|-------------|
|
||
| SectionHeading | FText | Department name |
|
||
| Entries | TArray\<FCreditEntry\> | People in section |
|
||
| bSeparator | Bool | Add line after |
|
||
|
||
### Variables
|
||
|
||
| Name | Type | Description |
|
||
|------|------|-------------|
|
||
| `CreditsData` | FCreditsSection[] | Full credit sequence |
|
||
| `CurrentEntryIndex` | Int32 | Active entry |
|
||
| `ScrollSpeed` | Float | Pixels per second |
|
||
| `bIsPlaying` | Bool | Credits running |
|
||
| `bIsPaused` | Bool | User paused |
|
||
| `bSkippable` | Bool | Allow skip |
|
||
| `TotalEntries` | Int32 | End of list marker |
|
||
| `AccumulatedTime` | Float | Entry transition timer |
|
||
| `bFadeComplete` | Bool | Intro finished |
|
||
|
||
### Functions
|
||
|
||
| Name | Inputs | Outputs | Description |
|
||
|------|--------|---------|-------------|
|
||
| `InitializeCredits` | Data: FCreditsSection[] | — | Set up display |
|
||
| `PlayCredits` | — | — | Start scrolling |
|
||
| `PauseCredits` | — | — | Pause scrolling |
|
||
| `ResumeCredits` | — | — | Resume scrolling |
|
||
| `SkipCredits` | — | — | End credits early |
|
||
| `SetScrollSpeed` | Speed: Float | — | Adjust speed |
|
||
| `ShowNextEntry` | — | — | Display next credit |
|
||
| `ShowPreviousEntry` | — | — | Display previous |
|
||
| `FadeInScreen` | — | — | Intro animation |
|
||
| `FadeOutScreen` | — | — | Outro animation |
|
||
| `OnCreditsComplete` | — | — | End of credits |
|
||
| `HandleInputAction` | Action: FName | — | Input binding |
|
||
| `GetSectionsForCollectibles` | — | FCreditsSection[] | Unlockable content credits |
|
||
|
||
### Blueprint Flow
|
||
|
||
```
|
||
[InitializeCredits]
|
||
└─► Clear all existing entries
|
||
└─► CurrentEntryIndex = 0
|
||
└─► Load CreditsData from DA_CreditsData
|
||
└─► If player collected all collectibles:
|
||
Add bonus sections (GetSectionsForCollectibles)
|
||
└─► TotalEntries = Sum of all entries
|
||
|
||
[PlayCredits]
|
||
└─► If already playing: return
|
||
└─► bIsPlaying = true
|
||
└─► FadeInScreen()
|
||
Set widget opacity 0 → 1 over 1.5 seconds
|
||
On fade complete: bFadeComplete = true
|
||
└─► Start scrolling:
|
||
Every Tick:
|
||
If bIsPaused: return
|
||
AccumulatedTime += DeltaTime * ScrollSpeed
|
||
If AccumulatedTime >= EntryDisplayThreshold:
|
||
ShowNextEntry()
|
||
AccumulatedTime = 0
|
||
|
||
[ShowNextEntry]
|
||
└─► If CurrentEntryIndex >= TotalEntries:
|
||
OnCreditsComplete()
|
||
Return
|
||
└─► Current Credit = CreditsData entries[CurrentEntryIndex]
|
||
└─► Create text block with appropriate styling:
|
||
Title: large, centered, bold
|
||
Department: medium, uppercase, separated
|
||
Name: normal, two-column layout
|
||
Divider: thin line, 50% width
|
||
└─► Apply fade-in animation on new entry
|
||
└─► Fade out previous entry
|
||
└─► CurrentEntryIndex++
|
||
|
||
[OnCreditsComplete]
|
||
└─► bIsPlaying = false
|
||
└─► FadeOutScreen()
|
||
Set widget opacity 1 → 0 over 2 seconds
|
||
└─► On fade complete:
|
||
Broadcast OnCreditsFinished()
|
||
If bReturnToMenu:
|
||
Load main menu level
|
||
Else:
|
||
Trigger post-credits content
|
||
|
||
[SkipCredits]
|
||
└─► If Not bSkippable: return
|
||
└─► bIsPlaying = false
|
||
└─► Immediate fade out (0.3 seconds)
|
||
└─► Broadcast OnCreditsSkipped()
|
||
└─► Proceed to post-credits flow
|
||
|
||
[HandleInputAction]
|
||
└─► Bind to BPC_InputManager:
|
||
"Pause" -> Toggle Pause/Resume
|
||
"Skip" -> SkipCredits()
|
||
"SpeedUp" -> SetScrollSpeed(1.5x)
|
||
"SlowDown" -> SetScrollSpeed(0.5x)
|
||
```
|
||
|
||
### Event Dispatchers
|
||
|
||
| Name | Payload | Description |
|
||
|------|---------|-------------|
|
||
| `OnCreditsFinished` | — | Normal completion |
|
||
| `OnCreditsSkipped` | — | User skipped |
|
||
| `OnCreditsPaused` | — | Paused state |
|
||
| `OnCreditsResumed` | — | Resumed state |
|
||
|
||
### Communications With
|
||
|
||
| Target | Method | Why |
|
||
|--------|--------|-----|
|
||
| [`BPC_InputManager`](../02-player/13_BPC_InputManager.md) | Event binding | Input handling |
|
||
| [`BPC_AudioManager`](../10-adaptive/66_BPC_AudioManager.md) | Direct call | Music/ambience |
|
||
| [`BPC_LoadingScreen`](../11-polish/76_BPC_LoadingScreen.md) | Direct call | Post-credits transition |
|
||
| [`DA_CreditsData`](../12-content/80_DA_CreditsData.md) | Data asset | Credit entries |
|
||
|
||
### Reuse Notes
|
||
- Entirely data-driven via DA_CreditsData
|
||
- Supports unlockable post-credits content based on collectibles
|
||
- Scroll speed configurable and allows speed-up
|
||
- Pause/Resume supports accessibility needs
|
||
- Clean separation of data and presentation
|
||
- Can be reused for splash screens, acknowledgments, or prologue credit sequences |