镜像 MainMenuP0 包样例

This commit is contained in:
JSD\13999
2026-06-04 20:16:28 +08:00
parent 3b3957fb74
commit ac8fcc3c24
29 changed files with 1548 additions and 2 deletions

View File

@@ -0,0 +1,44 @@
# MainMenuP0 Package Sample
`MainMenuP0` is the minimal FlowScope package sample. It demonstrates the recommended bootstrap path for a small Unity project without introducing a full game template.
## What It Covers
- Creating a root `Container`.
- Registering config, resource, save, audio, UI, preload, and screen navigation services.
- Registering `MainMenuFeature` with `RegisterTransient`.
- Preloading `MainMenuPanel` through `UIPreloadService`.
- Opening the main menu through `UIScreenNavigator`.
- Updating `PlayerData.Gold` through R3-backed view data.
- Saving data and releasing preloaded resources during `ShutdownAsync`.
## How To Import
In a consuming Unity project, open Package Manager, select `FlowScope Game Core`, and import the `MainMenuP0` sample.
Do not import this package sample into the FlowScope development project while `Assets/FlowScope/Samples/MainMenuP0` is still present. The development project keeps the Assets-based sample as the source of truth for tests during P2 migration.
## How To Run
After importing the sample, open:
```text
Assets/Samples/FlowScope Game Core/<version>/MainMenuP0/Scenes/MainMenuP0.unity
```
Enter Play Mode. The scene should show the main menu panel, a Gold text, and an increment button.
## Validation Points
- The first startup shows default Gold.
- Clicking the button increments Gold immediately.
- `ShutdownAsync` writes the `main-menu-player` save.
- Restarting restores the last saved Gold.
- Shutdown releases preloaded UI resources.
- Console has no unexpected Error or Exception.
## Current Limits
- The sample uses `SampleResourceBackend` instead of real Addressables assets.
- Runtime fallback UI exists so the sample can still run if scene or prefab references are missing.
- P2 package tests are not migrated yet; current automated tests still live under the FlowScope development project's `Assets/FlowScope/Tests`.