Compare commits

..
Author SHA1 Message Date
lennartandClaude Opus 5 6bf22f2d6e fix two wrong expectations in the locomotion math tests
Both were test bugs; MotionInputMath itself is correct.

WorldToCameraRelativeInput_Yaw90 expected +1 for the camera-relative x. A camera
yawed +90 degrees faces +X, so world +Z is to its left and the value is -1. The
conversion applies Quaternion.Euler(0, -cameraYaw, 0) and Unity's Y rotation is
clockwise viewed from above, so forward maps to -right. The round-trip test
already pinned this convention and passes precisely because of it.

ScreenDeltaToWorldPan compared Vector3 with Assert.AreEqual, which is exact.
-10f * 0.02f lands one ulp from the -0.2f literal, so a correct result failed a
comparison that printed as identical at two decimals. Now compared per component
with a tolerance.

EditMode suite is 39/39.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-08-25 19:50:25 +02:00
lennartandClaude Opus 5 5da782d21b add agent reference and restructure plan
CLAUDE.md documents repository layout, the Unity command line, the dialogue
content pipeline, validation, conventions, and known traps. AGENTS.md points at
it for non-Claude agents.

docs/restructure-plan.md covers both halves of the restructure: moving character
and voice prose out of JSON string fields into a writer-facing writing/ tree, and
migrating off the single-scene DialogueTest scaffold into Bootstrap/Systems/Level
scenes. Phase 0 is recorded as executed; everything from Phase 1 on is proposal.

Two findings in it were corrected after first being got wrong: the Unity CLI is
installed (just not on PATH for non-interactive shells) and does have build and
test commands, and the binary scene is not a stale save but a standing Unity
behaviour where Force Text converts only when the setting changes.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-08-25 19:12:49 +02:00
lennartandClaude Opus 5 4f97fc704c check in the DialogueTest scene and add it to the build settings
This is the scene the camera rig, UI layer, player control, and dialogue work in
the preceding commits were built against: 14 roots covering Room_101, the
Dialogue and Skill systems, the three UI canvases, the Cinemachine brain and
camera, the reveal volume, navigation, and the camera anchor.

Committed as-is, in binary, deliberately. The file is a valid Unity scene and
opens intact, but it is serialized as binary while the project is set to Force
Text, so it is not diffable or mergeable. Converting it needs the Asset
Serialization setting to be re-applied from the Editor UI, which cannot be done
from a batch-mode run — the setter does not trigger a reserialize pass. Checking
it in binary is strictly better than leaving days of scene wiring untracked;
the conversion is a follow-up, tracked in docs/restructure-plan.md.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-08-25 19:09:52 +02:00
lennartandClaude Opus 5 5b0827072b suppress world interaction while a menu panel is open
DialogueInteractable, DialogueTransitionController, and DialogueUIVisibility are
reworked against the new UI layer: visibility is driven by UIStateController
rather than each component toggling canvases itself, which removes the
duplicated show/hide logic the two had accumulated.

NPCStandIn now ignores the interact button while UIStateController reports a
menu open, so pressing interact through an open panel no longer starts a
conversation behind it.

The yarnproject change is graph-editor node positions only.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-08-25 19:04:16 +02:00
lennartandClaude Opus 5 ccabd3e7ac wire player control setup and tune the third-person controller
Editor/PlayerControlSetup.cs is the one-shot menu that assembles the playable
player: the armature, the Cinemachine rig, the NavMesh agent, and the pointer
input wiring, so a scene can be brought up to a controllable state repeatably
rather than by hand.

StarterAssets input actions gain the pointer and interaction bindings the new
locomotion and interaction layers read, and PlayerArmature is updated to match.

ThirdPersonController blends the animator toward target speed scaled by input
magnitude. Previously a partial stick deflection or a click-to-move arrival
played a slowed run clip via MotionSpeed alone; scaling the blend makes those
use the walk cycle instead.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-08-25 19:04:01 +02:00
lennartandClaude Opus 5 cba87dcb31 add UI layer: dialogue stream, HUD, player menu, and skills panel
Runtime UI under Scripts/UI: a UIStateController owning menu/dialogue state, a
PlayerControlLock so opening a panel suppresses world input, panel visibility
helpers, and the menu input binding.

Views: the dialogue stream presenter and its options presenter and message row,
the portrait HUD, and the player menu with character, journal, and tab-bar
views. Skills gains SkillsPanelView and SkillRowView, which is why the Skills
asmdef now references UnityEngine.UI.

Prefabs/UI holds the authored canvases (dialogue stream, HUD, player menu) and
their rows. UILayerBootstrap remains a hand-added runtime fallback for scenes
where those prefabs are not instantiated; it deliberately does not auto-spawn.

Editor/UILayerSetup.cs is the one-shot menu that builds and wires those prefabs
into a scene, with UILayerSetupAutoRun reminding after a script reload.

Art/UI/Placeholder carries the placeholder portrait the HUD falls back to.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-08-25 19:03:42 +02:00
lennartandClaude Opus 5 932cd0582f add camera rig, click-to-move locomotion, and click interaction
Camera: Cinemachine-based rig with an anchor, a state director, point-of-
interest framing, pan input, and dialogue framing volumes.

Player: click-to-move over the NavMesh, a pointer input layer, and a motion
arbiter that reconciles direct stick input with navigation-driven movement.
The pure math is isolated in NightclubArcadia.Locomotion.Math with an EditMode
suite, so the arbitration rules are testable without a scene.

Interaction: IClickInteractable plus a bridge that routes pointer clicks to it.

Supporting project settings: adds the Cinemachine package, the Interactable and
Ground tags the raycasts depend on, and NavMesh agent dimensions matched to the
player capsule (radius 0.3, height 1.8, climb 0.25).

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-08-25 19:03:18 +02:00
115 changed files with 10858 additions and 125 deletions
+10
View File
@@ -0,0 +1,10 @@
# AGENTS.md
This repository's agent instructions live in [`CLAUDE.md`](./CLAUDE.md). It is
tool-agnostic — repository layout, the Unity command line, the dialogue content
pipeline, validation, conventions, and known traps.
Read `CLAUDE.md` before making changes, regardless of which agent you are.
Design and migration plans are in [`docs/`](./docs/), most relevantly
[`docs/restructure-plan.md`](./docs/restructure-plan.md).
+361
View File
@@ -0,0 +1,361 @@
# Nightclub Arcadia — agent reference
Reference for coding agents (Claude Code and others) working in this repository.
Human-facing design docs live in `docs/`. This file is the operational one: where
things are, what is generated, and how to build/test/validate from the terminal.
Companion: `AGENTS.md` (pointer file, same content applies).
---
## 1. Repository layout
Repo root is `nightlcub-arcadia` (the typo is in the directory name, not a mistake
to fix — it is the checkout path). The Unity project is a **subdirectory**:
```
/Users/lennart/Dev/nightlcub-arcadia/ # git root
├── CLAUDE.md, AGENTS.md # this reference
├── docs/ # design + plan docs (markdown)
├── tools/YarnCheck/ # .NET 9 Yarn compiler/player, no Unity needed
├── .gitignore # macOS / IDE / toolchain rules
└── NightclubArcadia/ # ← the Unity project (-projectPath)
├── .gitignore # Unity rules (anchored, must stay here)
├── Assets/
├── Packages/ # incl. embedded dev.yarnspinner.unity
└── ProjectSettings/
```
**Two `.gitignore` files, deliberately.** The Unity one anchors every rule with a
leading `/`, so it only works at the root of the Unity project folder. Do not merge them.
Unity **6000.5.8f1**, URP 17.5.0, Cinemachine 3.1.7, Input System 1.20.0,
AI Navigation 2.0.14, ProBuilder 6.1.2, Test Framework 1.7.0. Yarn Spinner is an
**embedded package** at `NightclubArcadia/Packages/dev.yarnspinner.unity` (plus the
`textanimator` addon) — it is committed, not resolved from a registry.
---
## 2. Ground rules
1. **Never hand-edit generated `.asset` files.** `Assets/Skills/Definitions/*.asset`,
`Assets/Skills/SkillDatabase.asset`, `Assets/Candidates/Definitions/*.asset` and
`Assets/Candidates/CandidateDatabase.asset` are *build output*. Their sources are
`Assets/Skills/skill_bible.json` and `Assets/Candidates/candidates.json`. Edits are
overwritten by the Editor setup scripts. Edit the JSON.
2. **Never hand-edit scene or prefab YAML unless you have read the surrounding block.**
GUID/fileID surgery in `.unity` / `.prefab` files silently detaches components.
3. **One Unity instance per project path.** Unity refuses to open a project in batch
mode while the Editor has it open — a single instance at a time. Always check before
any `-batchmode` invocation (§3.1).
4. **Prefer YarnCheck over Unity for dialogue validation.** It is seconds, not minutes,
and needs no Editor lock (§5.3).
5. **Do not commit on the user's behalf** unless asked. Unity writes to tracked files
(`ProjectSettings/*`, `.meta`, scenes) as a side effect of simply being open, so
`git status` noise is expected and is not always yours.
---
## 3. Unity from the command line
### 3.0 Two different tools, both present
| | What it is | Status |
|---|---|---|
| `/Users/lennart/.unity/bin/unity` | The **Unity CLI** (v1.0.0-beta.6). Wraps the Editor for CI-shaped work: `build`, `test`, `run`, `open`, plus editor/license/cloud management. | Installed. **Prefer this.** |
| `/Applications/Unity/Hub/Editor/6000.5.8f1/Unity.app/Contents/MacOS/Unity` | The **Editor executable**. Raw `-batchmode` flags. | Installed. Fallback, for flags the CLI does not expose. |
The CLI is **not on `PATH` for non-interactive shells** — `which unity` fails even though the
binary exists, and `unity doctor` reports `check.binary-on-path warn`. Always invoke it by
absolute path, or export it:
```bash
export UNITY_CLI="/Users/lennart/.unity/bin/unity"
export UNITY="/Applications/Unity/Hub/Editor/6000.5.8f1/Unity.app/Contents/MacOS/Unity"
export UNITY_PROJECT="/Users/lennart/Dev/nightlcub-arcadia/NightclubArcadia"
```
`unity doctor --no-banner` confirms the environment: signed in via OAuth keyring, editor
`6000.5.8f1` arm64 resolved from `ProjectVersion.txt`. Add `--json` to any command for
machine-readable output and `--no-banner` to keep logs clean.
### 3.1 Always check the lock first
Only one Unity instance per project path. Check before any headless run:
```bash
pgrep -fl "Unity.app/Contents/MacOS/Unity" | grep -v AssetImportWorker
```
`AssetImportWorker*` processes are children of the main Editor — filter them out or you will
misread the check. `Temp/UnityLockfile` and `unity status` are the other two signals.
### 3.2 Run tests
```bash
"$UNITY_CLI" test "$UNITY_PROJECT" --no-banner --mode EditMode \
--output /tmp/editmode-results.xml \
--report-format both --junit-output /tmp/editmode-junit.xml
```
Useful flags: `--filter <pattern>`, `--retries <0-10>` (reports tests that pass on retry as
flaky), `--rerun-failed`, `--shard N/M` for parallel CI, `--coverage`, `--timeout <seconds>`.
`--mode PlayMode` runs the PlayMode suite. **There are none yet** — `Assets/Tests/` is EditMode
only, so that command reports zero tests. A PlayMode suite needs a new
`Assets/Tests/PlayMode/*.asmdef` referencing `UnityEngine.TestRunner` with `includePlatforms`
left empty.
Raw-Editor equivalent, if you need a flag the CLI does not expose:
```bash
"$UNITY" -batchmode -nographics -projectPath "$UNITY_PROJECT" \
-runTests -testPlatform EditMode \
-testResults /tmp/editmode-results.xml -logFile /tmp/unity-editmode.log
```
**Do not add `-quit` to a `-runTests` run** — the runner terminates the Editor itself, and
`-quit` on top of async work can hang it.
**Parse the results XML; do not trust the exit code.** Unity's own docs state there is no common
exit-code definition across the components under test. Read `total`/`passed`/`failed` off the
root element and list any `test-case` whose `result` is not `Passed`.
### 3.3 Build a player
```bash
"$UNITY_CLI" build "$UNITY_PROJECT" --no-banner \
--target StandaloneOSX -o /tmp/NightclubArcadia.app
```
Without `--execute-method` the CLI uses Unity's built-in build — a Build Profile on Unity 6+, or
the legacy desktop player flags — and builds whatever scenes `EditorBuildSettings` enables.
`--profile <name>` selects a profile from `Assets/Settings/Build Profiles` (the profile defines
the target). `-l/--log-file` overrides the log path; the log streams to console unless `--no-tail`.
**No build script exists yet.** When one is added, put it at `Assets/Editor/BuildPipeline.cs` and
call `--execute-method NightclubArcadia.Editor.BuildPipeline.BuildMacOS`. The CLI forwards the
output path as `-buildOutput` and **your method is responsible for honouring it**. A build method
must call `EditorApplication.Exit(1)` on failure, or Unity exits 0 and CI reports a green build
that produced nothing.
### 3.4 Run an arbitrary Editor method
```bash
"$UNITY_CLI" run "$UNITY_PROJECT" --no-banner --timeout 900 -- \
-executeMethod SomeClass.SomeStaticMethod
```
**`unity run` owns `-batchmode`, `-nographics`, `-quit` and `-logFile`.** Passing any of them
after `--` fails with a reserved-flag error. Pass only your own arguments.
Output does **not** stream to stdout. The log lands at `$UNITY_PROJECT/Logs/Editor.log` (the
previous run rotates to `Editor-prev.log`), so tag your `Debug.Log` calls and grep for them:
```bash
grep -n "\[YourTag\]" "$UNITY_PROJECT/Logs/Editor.log" | tail -20
```
This is the mechanism for the JSON → ScriptableObject regeneration in
`Assets/Editor/SkillSystemSetup.cs` and `CandidateSystemSetup.cs`. Read the actual class and
method names out of those files before invoking — do not guess them.
## 4. The dialogue content pipeline
### 4.1 Where content lives
```
NightclubArcadia/Assets/Dialogue/
├── NightclubArcadia.yarnproject # globs **/*.yarn — new files need no registration
├── Common.yarn # every <<declare>>, project-wide. Never played.
├── Commentary.yarn # passive skill barks, one node per (context, skill)
├── Scenes/ SC101, SC102, Debug
├── Characters/ Bartender, Bradford Kane, Chevalier Cassian Thal
└── Objects/ Chair
```
**Dialogue is already plain text in the repo.** It is authored in `.yarn` files, not inside
the Unity Editor, and any new `.yarn` file dropped anywhere under `Assets/Dialogue/` is picked
up automatically by the `**/*.yarn` glob in the `.yarnproject`. Adding a scene or a character
requires **no C#, no Unity, and no `.yarnproject` edit**.
The one caveat: the `.yarnproject` also stores `editorOptions.yarnScriptEditor.projectGraphPositions`
— per-file x/y coordinates for the Yarn graph editor. These churn whenever anyone opens the
graph view. Treat that block as editor state; do not fight over it in review.
### 4.2 The variable contract
Every variable used anywhere must be `<<declare>>`d in `Common.yarn`. This is the whole point
of that file: the compiler then catches `$reputaton` instead of silently creating a second
variable at runtime. Adding a scene flag means adding a `<<declare>>` line — that is a writer
action, not a code action.
Naming families that are load-bearing (enforced or lint-checked):
| Family | Meaning | Checked by |
|---|---|---|
| `$self_lean_<candidate_id>` | identity-lean counter | `CandidateYarnLintTests` — id must exist in `candidates.json` |
| `$found_<clue_id>` | clue coverage | `CandidateYarnLintTests` — id must exist in `candidates.json` |
| `$visited_<location_id>` | first arrival | convention; `unlockFlag` in `candidates.json` may only name these |
| `$errand_<errand_id>` | errand state | same |
| `$seen_<scene_id>` | scene witnessed | convention |
| `$check_*` | written by `<<check>>` | **never `<<set>>` by hand** |
### 4.3 Writer-facing Yarn vocabulary
Commands and functions registered by game code, i.e. the full set a writer may use:
| Syntax | Defined in | Notes |
|---|---|---|
| `<<check <skill> <Band>>>` | `Skills/Yarn/YarnSkillCommands.cs` | writes `$check_result`, `$check_roll`, `$check_total`, `$check_dc`, `$check_modifier`, `$check_degree`, `$check_skill` |
| `<<skill_mod <source> <skill> <n>>>` | same | `source` = bucket key, e.g. `scene`, `drunk` |
| `<<clear_skill_mods <source>>>` | same | |
| `skill_rank(<skill>)` | same | function |
| `top_skill(a, b, …)` | `Dialogue/DialougueSkillComparison.cs` | **returns its FIRST argument on a tie** — argument order is a design decision, not incidental |
| `alias_name(<name>)` | `Dialogue/AliasNameGenerator.cs` | deterministic; `$player_alias` is a smart variable derived from it |
| `<<enter_environment>>` | `Dialogue/DialogueTransitionController.cs` | hands control back to the world |
(The filename `DialougueSkillComparison.cs` is misspelled in the repo. Left alone deliberately —
renaming it changes a `.meta` GUID. Fold it into a rename batch, not a drive-by fix.)
### 4.4 Flow control discipline
`<<detour>>` returns to the caller; `<<jump>>` does not and clears the return stack.
The rule the existing files follow, and which new content must follow:
- A node started directly by `DialogueInteractable` has nothing waiting on it → its branches
`<<jump>>`, and each destination calls `<<enter_environment>>` itself.
- A sub-conversation that must resume its caller → `<<detour>>`, and **never** `<<jump>>` inside it.
Nodes sharing a `title:` form a **node group**; Yarn runs the most specific variation whose
`when:` conditions pass. Prefer adding a variation over growing an `<<if>>` chain.
### 4.5 How content reaches Unity
There is **no manual sync step** for dialogue. The chain is:
```
.yarn file saved → Unity's YarnProjectImporter recompiles the .yarnproject on focus
→ DialogueRunner plays the new nodes on next Play
```
The only things that need a human/Editor step are the *data* files, not the dialogue:
```
skill_bible.json → Tools ▸ Nightclub Arcadia ▸ (SkillSystemSetup) → Skills/Definitions/*.asset + SkillDatabase.asset
candidates.json → Tools ▸ Nightclub Arcadia ▸ (CandidateSystemSetup) → Candidates/Definitions/*.asset + CandidateDatabase.asset
```
Those setup scripts also register a `[DidReloadScripts]` callback, so in practice the assets
regenerate on script reload too. The JSON is the source of truth either way.
### 4.6 Code-owned vs writer-owned
| Writer-owned (edit freely, no Unity) | Code-owned (needs an engineer) |
|---|---|
| `Assets/Dialogue/**/*.yarn` | `Assets/Scripts/**/*.cs` |
| `<<declare>>` lines in `Common.yarn` | `Assets/Editor/**/*.cs` |
| `Assets/Skills/skill_bible.json` (prose fields) | Yarn command/function *implementations* |
| `Assets/Candidates/candidates.json` (`status`, `sceneId`, `notes`, `unlockFlag`) | `.asset`, `.prefab`, `.unity`, `.meta` |
| `docs/` writing docs | `ProjectSettings/**` |
**A writer must never need to open Unity or touch C# to write or revise a scene, a character,
or a branch.** If a writing task requires either, that is a pipeline bug — file it.
---
## 5. Validation
### 5.1 EditMode test suite
`NightclubArcadia/Assets/Tests/EditMode/` — 7 files, ~870 LOC, two assemblies:
- `NightclubArcadia.Skills.Tests` — `SkillRosterTests`, `SkillCheckSystemTests`, `DcBandTests`,
`CommentaryPickerTests`, `CandidateRegistryTests`, `CandidateYarnLintTests`
- `NightclubArcadia.Locomotion.Math.Tests` — `MotionInputMathTests`
`CandidateYarnLintTests` is a **regex lint over Yarn source**: it asserts every
`$self_lean_*` / `$found_*` in any `.yarn` file resolves to a real id in `CandidateDatabase`.
It is a tripwire, not a proof.
### 5.2 One-click in-Editor run
`Tools ▸ Nightclub Arcadia ▸ Run Skill EditMode Tests` (`Assets/Editor/SkillSystemTestRunner.cs`).
### 5.3 YarnCheck — validate dialogue without Unity ⭐
`tools/YarnCheck` is a .NET 9 console app that compiles **and plays** the Yarn scripts using
the exact Yarn Spinner DLLs shipped in `Packages/dev.yarnspinner.unity/Runtime/DLLs`, so it
can never drift from the compiler the game uses. This is the fastest correctness signal in the
repo and it needs no Editor lock. Use it on every dialogue change.
```bash
cd /Users/lennart/Dev/nightlcub-arcadia/tools/YarnCheck
# compile everything — exit 1 + diagnostics on failure
dotnet run -- ../../NightclubArcadia/Assets/Dialogue
# compile, then play a node, choosing option 2, 2, 0, 0
dotnet run -- ../../NightclubArcadia/Assets/Dialogue Bartender_Talk 2 2 0 0
```
Leftover picks restart the node — that deliberately models the player walking away and coming
back, which is how these scenes are actually played.
**What it does not model** (read traces with this in mind): Unity commands are printed, not
executed, so `<<check>>` / `<<enter_environment>>` / `<<skill_mod>>` are stepped over and
`$check_result` stays `false` — every check-gated branch shows its *failure* side. Yarn
functions are stubbed: `top_skill` mirrors the real first-argument-wins tie behaviour,
`alias_name` returns a placeholder, `skill_rank` returns 0. Variables reset to their
`<<declare>>` defaults each run; there is no save state.
Requires the .NET 9 SDK. `tools/YarnCheck/bin/` and `obj/` are currently **committed** and
should not be — see `docs/restructure-plan.md`.
---
## 6. Code conventions
- Namespaces: `NightclubArcadia.<Area>` — `Skills`, `Dialogue`, `UI`, `UI.Dialogue`,
`UI.HUD`, `UI.Menu`, `Cinematics`, `Interaction`, `Player`, `Player.Math`.
**Exception:** `NPCStandIn.cs` sits in the global namespace. That is a scaffold tell, not a
convention to copy — new runtime types always get a namespace.
- Assembly definitions exist for `NightclubArcadia.Skills` and `NightclubArcadia.Locomotion.Math`
only. Camera, Player, UI, Dialogue, NPCs and Interaction all currently compile into the
default `Assembly-CSharp`. Widening asmdef coverage is planned, not done.
- Comments in this codebase carry *decision history* — why a flag is written at the bottom of a
node rather than the top, why four voices in SC-101 breaks the three-voice cap on purpose.
Match that density. Do not strip such comments as "noise"; they are the design record.
- Editor-only code lives under `Assets/Editor/`. Anything there is stripped from builds and may
reference `UnityEditor`.
---
## 7. Traps
1. **`Assets/Scenes/DialogueTest.unity` is serialized as binary**, and Unity will not convert it
from a headless run. The project is set to Force Text (`m_SerializationMode: 2`) and the API
agrees — `EditorSettings.serializationMode` reads `ForceText` — but Force Text governs
conversion **at the moment the setting changes**, not on every save. A file that entered the
project as binary stays binary. Four approaches were tried and all failed silently:
`AssetDatabase.ForceReserializeAssets` does not rewrite scene files; `OpenScene` +
`MarkSceneDirty` + `SaveScene` to the same path returns `true` and writes nothing, because
`MarkSceneDirty` does not take in batch mode; `SaveScene` to a *new* path writes a fresh file
that is also binary; and re-assigning `serializationMode` (Mixed → ForceText) from script
does not trigger a reserialize pass. **The fix is Editor-UI only:** Project Settings ▸ Editor
▸ Asset Serialization, switch the mode and switch it back, which reserializes on apply.
Until then the scene is not diffable or mergeable. It is committed and intact (14 roots).
2. **`unity run` reserves `-batchmode`, `-nographics`, `-quit`, `-logFile`.** Passing any of them
after `--` is a hard error, and its output does not reach stdout — read `Logs/Editor.log` (§3.4).
3. **`-quit` with `-runTests`** hangs or truncates. Omit it (§3.2).
4. **Exit code alone is not a test verdict.** Parse the results XML (§3.2).
5. **`which unity` fails** in non-interactive shells even though the CLI is installed. Use the
absolute path `/Users/lennart/.unity/bin/unity` (§3.0).
6. **Editor lock** — check before every headless run, filtering out `AssetImportWorker` children (§3.1).
7. **Regenerated assets** — hand edits to `Skills/Definitions/*`, `Candidates/Definitions/*`
and the two `*Database.asset` files are silently discarded (§2.1).
8. **`top_skill` ties** resolve to the first argument. Reordering arguments changes the game.
9. **No `.gitattributes`** — no Unity YAML merge driver, no LFS rule for `Assets/Art/`.
Scene and prefab merges will conflict destructively under branching.
10. **Template leftovers still present**: `Assets/Scenes/SampleScene.unity`, `Assets/Readme.asset`,
`Assets/TutorialInfo/`. `SampleScene` is in the build scene list. Not load-bearing.
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 98c69c750f094ae79e2f9362c4422647
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6270e22570864d7c862434241018328f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bffd4617fb74418f9eb0d0d6378cf79a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ff84645ddce3641b0a7e9c68db56c8db
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

@@ -0,0 +1,84 @@
fileFormatVersion: 2
guid: a1b2c3d4e5f60718293a4b5c6d7e8f90
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -28,8 +28,8 @@
"y": 2287 "y": 2287
}, },
"Chevalier Cassian Thal.yarn": { "Chevalier Cassian Thal.yarn": {
"x": 1794, "x": 1621,
"y": 2275 "y": 2260
}, },
"Commentary.yarn": { "Commentary.yarn": {
"x": 12, "x": 12,
@@ -40,20 +40,20 @@
"y": 12 "y": 12
}, },
"Chair.yarn": { "Chair.yarn": {
"x": 840, "x": 866,
"y": 1072 "y": 1104
}, },
"Debug.yarn": { "Debug.yarn": {
"x": -1, "x": 14,
"y": 483 "y": 448
}, },
"SC101.yarn": { "SC101.yarn": {
"x": 820, "x": 820,
"y": -3 "y": -3
}, },
"SC102.yarn": { "SC102.yarn": {
"x": 2734, "x": 2595,
"y": 2559 "y": 2682
} }
} }
} }
@@ -0,0 +1,316 @@
using NightclubArcadia.Cinematics;
using NightclubArcadia.Interaction;
using NightclubArcadia.Player;
using StarterAssets;
using Unity.AI.Navigation;
using Unity.Cinemachine;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.AI;
/// <summary>
/// Wires player control, navigation, and camera systems into DialogueTest.unity.
/// Run via Tools → Nightclub Arcadia → Set Up Player Control &amp; Camera.
/// </summary>
public static class PlayerControlSetup
{
const string ScenePath = "Assets/Scenes/DialogueTest.unity";
const string PlayerPrefabPath = "Assets/StarterAssets/ThirdPersonController/Prefabs/PlayerArmature.prefab";
const string SettingsFolder = "Assets/Settings";
[MenuItem("Tools/Nightclub Arcadia/Set Up Player Control & Camera")]
public static void SetUp()
{
EnsurePlayerPrefab();
WireScene();
AssetDatabase.SaveAssets();
Debug.Log("[PlayerControlSetup] Player control and camera setup complete.");
}
static void EnsurePlayerPrefab()
{
var prefab = AssetDatabase.LoadAssetAtPath<GameObject>(PlayerPrefabPath);
if (prefab == null)
{
Debug.LogError($"[PlayerControlSetup] Missing prefab at {PlayerPrefabPath}");
return;
}
var root = PrefabUtility.LoadPrefabContents(PlayerPrefabPath);
EnsureComponent<PlayerPointerInput>(root);
EnsureComponent<PlayerMotionArbiter>(root);
EnsureComponent<ClickToMoveController>(root);
EnsureComponent<PointerNavigationInput>(root);
EnsureComponent<NavMeshAgent>(root);
var inputs = root.GetComponent<StarterAssetsInputs>();
if (inputs != null)
{
inputs.analogMovement = true;
inputs.cursorLocked = false;
}
var controller = root.GetComponent<ThirdPersonController>();
if (controller != null)
{
controller.LockCameraPosition = true;
}
var clickToMove = root.GetComponent<ClickToMoveController>();
var pointerNav = root.GetComponent<PointerNavigationInput>();
var pointerInput = root.GetComponent<PlayerPointerInput>();
var arbiter = root.GetComponent<PlayerMotionArbiter>();
WireSerializedReference(clickToMove, "brainCamera", null);
WireSerializedReference(pointerNav, "pointerInput", pointerInput);
WireSerializedReference(pointerNav, "clickToMove", clickToMove);
WireSerializedReference(pointerNav, "motionArbiter", arbiter);
PrefabUtility.SaveAsPrefabAsset(root, PlayerPrefabPath);
PrefabUtility.UnloadPrefabContents(root);
}
static void WireScene()
{
var scene = EditorSceneManager.OpenScene(ScenePath, OpenSceneMode.Single);
var player = GameObject.FindGameObjectWithTag("Player");
if (player == null)
{
Debug.LogError("[PlayerControlSetup] No Player-tagged object found in scene.");
return;
}
EnsureComponent<PlayerPointerInput>(player);
EnsureComponent<PlayerMotionArbiter>(player);
EnsureComponent<ClickToMoveController>(player);
EnsureComponent<PointerNavigationInput>(player);
EnsureComponent<NavMeshAgent>(player);
var inputs = player.GetComponent<StarterAssetsInputs>();
if (inputs != null)
{
inputs.analogMovement = true;
inputs.cursorLocked = false;
}
var controller = player.GetComponent<ThirdPersonController>();
if (controller != null)
{
controller.LockCameraPosition = true;
}
var brainCamera = Camera.main;
var pointerInput = player.GetComponent<PlayerPointerInput>();
var clickToMove = player.GetComponent<ClickToMoveController>();
var pointerNav = player.GetComponent<PointerNavigationInput>();
var arbiter = player.GetComponent<PlayerMotionArbiter>();
WireSerializedReference(clickToMove, "brainCamera", brainCamera);
WireSerializedReference(pointerNav, "brainCamera", brainCamera);
WireSerializedReference(pointerNav, "pointerInput", pointerInput);
WireSerializedReference(pointerNav, "clickToMove", clickToMove);
WireSerializedReference(pointerNav, "motionArbiter", arbiter);
var groundLayer = LayerMask.NameToLayer("Ground");
var interactableLayer = LayerMask.NameToLayer("Interactable");
SetLayerIfExists("Floor", groundLayer);
SetLayerIfExists("Room_101", groundLayer);
SetLayerIfExists("Wall_Back", groundLayer);
SetLayerIfExists("Wall_Front", groundLayer);
SetLayerIfExists("Table", groundLayer);
WireBartender("Bartender", interactableLayer);
WireBartender("Bartender (1)", interactableLayer);
EnsureNavigation(player.transform.position);
EnsureCameraAnchor(player.transform, brainCamera);
EditorSceneManager.MarkSceneDirty(scene);
EditorSceneManager.SaveScene(scene);
}
static void WireBartender(string objectName, int interactableLayer)
{
var bartender = GameObject.Find(objectName);
if (bartender == null)
{
return;
}
if (interactableLayer >= 0)
{
bartender.layer = interactableLayer;
}
EnsureComponent<ClickInteractableBridge>(bartender);
EnsureComponent<CameraPointOfInterest>(bartender);
}
static void EnsureNavigation(Vector3 sampleOrigin)
{
var navigation = GameObject.Find("Navigation");
if (navigation == null)
{
navigation = new GameObject("Navigation");
}
var surface = EnsureComponent<NavMeshSurface>(navigation);
surface.agentTypeID = 0;
surface.collectObjects = CollectObjects.All;
surface.useGeometry = NavMeshCollectGeometry.RenderMeshes;
var included = 0;
var defaultLayer = LayerMask.NameToLayer("Default");
var groundLayer = LayerMask.NameToLayer("Ground");
if (defaultLayer >= 0)
{
included |= 1 << defaultLayer;
}
if (groundLayer >= 0)
{
included |= 1 << groundLayer;
}
surface.layerMask = included;
var table = GameObject.Find("Table");
if (table != null)
{
var modifier = EnsureComponent<NavMeshModifier>(table);
modifier.overrideArea = true;
modifier.area = NavMesh.GetAreaFromName("Not Walkable");
}
surface.BuildNavMesh();
if (!NavMesh.SamplePosition(sampleOrigin, out _, 2f, NavMesh.AllAreas))
{
Debug.LogWarning("[PlayerControlSetup] NavMesh bake did not cover the player start position.");
}
}
static void EnsureCameraAnchor(Transform followTarget, Camera brainCamera)
{
var vcamObject = GameObject.Find("CinemachineCamera");
if (vcamObject == null)
{
Debug.LogError("[PlayerControlSetup] CinemachineCamera not found.");
return;
}
var vcam = vcamObject.GetComponent<CinemachineCamera>();
var composer = vcamObject.GetComponent<CinemachinePositionComposer>();
var anchorObject = GameObject.Find("CameraAnchor");
if (anchorObject == null)
{
anchorObject = new GameObject("CameraAnchor");
}
anchorObject.transform.position = followTarget.position;
var anchor = EnsureComponent<CameraRigAnchor>(anchorObject);
EnsureComponent<CameraPanInput>(anchorObject);
EnsureComponent<CameraPointOfInterestDirector>(anchorObject);
EnsureComponent<CameraStateDirector>(anchorObject);
WireSerializedReference(anchor, "followTarget", followTarget);
WireSerializedReference(anchor, "composer", composer);
if (vcam != null)
{
vcam.Target.TrackingTarget = anchorObject.transform;
vcam.Priority.Value = 10;
}
var pan = anchorObject.GetComponent<CameraPanInput>();
WireSerializedReference(pan, "brainCamera", brainCamera);
WireSerializedReference(pan, "anchor", anchor);
WireSerializedReference(pan, "stateDirector", anchorObject.GetComponent<CameraStateDirector>());
var poiDirector = anchorObject.GetComponent<CameraPointOfInterestDirector>();
WireSerializedReference(poiDirector, "anchor", anchor);
WireSerializedReference(poiDirector, "stateDirector", anchorObject.GetComponent<CameraStateDirector>());
var stateDirector = anchorObject.GetComponent<CameraStateDirector>();
WireSerializedReference(stateDirector, "anchor", anchor);
EnsureRevealCamera(vcamObject, followTarget);
}
static void EnsureRevealCamera(GameObject followVcam, Transform followTarget)
{
var revealName = "CM_Reveal_Room101";
var revealObject = GameObject.Find(revealName);
if (revealObject == null)
{
revealObject = new GameObject(revealName);
revealObject.transform.SetPositionAndRotation(
followVcam.transform.position + new Vector3(-4f, 2f, -2f),
followVcam.transform.rotation);
}
var revealCam = EnsureComponent<CinemachineCamera>(revealObject);
revealCam.Target.TrackingTarget = followTarget;
revealCam.Priority.Value = 0;
revealCam.Lens.FieldOfView = followVcam.GetComponent<CinemachineCamera>().Lens.FieldOfView;
var volumeObject = GameObject.Find("RevealVolume_Room101");
if (volumeObject == null)
{
volumeObject = new GameObject("RevealVolume_Room101");
volumeObject.transform.position = followTarget.position + new Vector3(0f, 1f, 2f);
}
var box = EnsureComponent<BoxCollider>(volumeObject);
box.isTrigger = true;
box.size = new Vector3(6f, 3f, 4f);
var volume = EnsureComponent<CameraFramingVolume>(volumeObject);
WireSerializedReference(volume, "revealCamera", revealCam);
}
static T EnsureComponent<T>(GameObject target) where T : Component
{
var component = target.GetComponent<T>();
if (component == null)
{
component = target.AddComponent<T>();
}
return component;
}
static void SetLayerIfExists(string objectName, int layer)
{
if (layer < 0)
{
return;
}
var obj = GameObject.Find(objectName);
if (obj != null)
{
obj.layer = layer;
}
}
static void WireSerializedReference(Object target, string propertyName, Object value)
{
if (target == null)
{
return;
}
var so = new SerializedObject(target);
var property = so.FindProperty(propertyName);
if (property != null)
{
property.objectReferenceValue = value;
so.ApplyModifiedPropertiesWithoutUndo();
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: eedfabcda58c94099b2ad3e19f141b09
@@ -0,0 +1,818 @@
using System.IO;
using NightclubArcadia.Cinematics;
using NightclubArcadia.Dialogue;
using NightclubArcadia.Skills;
using NightclubArcadia.UI;
using NightclubArcadia.UI.Dialogue;
using NightclubArcadia.UI.HUD;
using NightclubArcadia.UI.Menu;
using StarterAssets;
using TMPro;
using Unity.Cinemachine;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.UI;
using Yarn.Unity;
/// <summary>
/// Builds UI prefabs and wires them into DialogueTest.unity.
/// Run via Tools → Nightclub Arcadia → Set Up UI Layer.
/// </summary>
public static class UILayerSetup
{
const string ScenePath = "Assets/Scenes/DialogueTest.unity";
const string PrefabFolder = "Assets/Prefabs/UI";
const string ArtFolder = "Assets/Art/UI/Placeholder";
// Nested Resources folder: UILayerBootstrap builds the HUD at runtime and
// can only reach the sprite through Resources.Load. Keeping it under
// Art/UI/Placeholder preserves the organisation while making it
// build-safe — an AssetDatabase-only path is null outside the editor.
const string PortraitFolder = ArtFolder + "/Resources";
const string PortraitPath = PortraitFolder + "/portrait_placeholder.png";
const string MessageRowPrefabPath = PrefabFolder + "/DialogueMessageRow.prefab";
const string StreamCanvasPrefabPath = PrefabFolder + "/DialogueStreamCanvas.prefab";
const string HudCanvasPrefabPath = PrefabFolder + "/HudCanvas.prefab";
const string SkillRowPrefabPath = PrefabFolder + "/SkillRow.prefab";
const string MenuCanvasPrefabPath = PrefabFolder + "/PlayerMenuCanvas.prefab";
[MenuItem("Tools/Nightclub Arcadia/Set Up UI Layer")]
public static void SetUp()
{
EnsureFolders();
CreatePortraitPlaceholder();
var messageRow = CreateMessageRowPrefab();
var skillRow = CreateSkillRowPrefab();
var streamCanvas = CreateDialogueStreamCanvasPrefab(messageRow);
var hudCanvas = CreateHudCanvasPrefab();
var menuCanvas = CreatePlayerMenuCanvasPrefab(skillRow);
WireScene(streamCanvas, hudCanvas, menuCanvas);
AssetDatabase.SaveAssets();
Debug.Log("[UILayerSetup] UI layer setup complete.");
}
static void EnsureFolders()
{
EnsureFolder("Assets/Prefabs");
EnsureFolder(PrefabFolder);
EnsureFolder("Assets/Art");
EnsureFolder("Assets/Art/UI");
EnsureFolder(ArtFolder);
EnsureFolder(PortraitFolder);
}
static void EnsureFolder(string path)
{
if (AssetDatabase.IsValidFolder(path))
{
return;
}
var parent = Path.GetDirectoryName(path)?.Replace('\\', '/');
var name = Path.GetFileName(path);
if (!string.IsNullOrEmpty(parent) && !string.IsNullOrEmpty(name))
{
AssetDatabase.CreateFolder(parent, name);
}
}
static void CreatePortraitPlaceholder()
{
if (File.Exists(PortraitPath))
{
return;
}
var tex = new Texture2D(512, 512, TextureFormat.RGBA32, false);
var dark = new Color(0.12f, 0.12f, 0.14f, 1f);
var mid = new Color(0.35f, 0.35f, 0.4f, 1f);
for (var y = 0; y < 512; y++)
{
for (var x = 0; x < 512; x++)
{
var dx = (x - 256) / 256f;
var dy = (y - 280) / 256f;
var inHead = dx * dx + dy * dy < 0.12f;
var inBody = Mathf.Abs(dx) < 0.22f && y < 220 && y > 40;
tex.SetPixel(x, y, inHead || inBody ? mid : dark);
}
}
tex.Apply();
File.WriteAllBytes(PortraitPath, tex.EncodeToPNG());
Object.DestroyImmediate(tex);
AssetDatabase.Refresh();
var importer = AssetImporter.GetAtPath(PortraitPath) as TextureImporter;
if (importer != null)
{
importer.textureType = TextureImporterType.Sprite;
importer.spritePixelsPerUnit = 100;
importer.SaveAndReimport();
}
}
static GameObject CreateMessageRowPrefab()
{
var root = new GameObject("DialogueMessageRow", typeof(RectTransform), typeof(DialogueMessageRow));
var rootRt = root.GetComponent<RectTransform>();
rootRt.sizeDelta = new Vector2(0f, 80f);
var layout = root.AddComponent<VerticalLayoutGroup>();
layout.padding = new RectOffset(12, 12, 8, 8);
layout.spacing = 4f;
layout.childControlHeight = true;
layout.childControlWidth = true;
layout.childForceExpandHeight = false;
layout.childForceExpandWidth = true;
var fitter = root.AddComponent<ContentSizeFitter>();
fitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
fitter.horizontalFit = ContentSizeFitter.FitMode.Unconstrained;
var speakerGo = CreateTmp("Speaker", root.transform, 22f, FontStyles.Bold, TextAlignmentOptions.Left);
var bodyGo = CreateTmp("Body", root.transform, 28f, FontStyles.Normal, TextAlignmentOptions.TopLeft);
var row = root.GetComponent<DialogueMessageRow>();
var so = new SerializedObject(row);
so.FindProperty("speakerText").objectReferenceValue = speakerGo.GetComponent<TMP_Text>();
so.FindProperty("bodyText").objectReferenceValue = bodyGo.GetComponent<TMP_Text>();
so.FindProperty("speakerLabel").objectReferenceValue = speakerGo;
so.ApplyModifiedPropertiesWithoutUndo();
var prefab = PrefabUtility.SaveAsPrefabAsset(root, MessageRowPrefabPath);
Object.DestroyImmediate(root);
return prefab;
}
static GameObject CreateSkillRowPrefab()
{
var root = new GameObject("SkillRow", typeof(RectTransform), typeof(SkillRowView));
var rootRt = root.GetComponent<RectTransform>();
rootRt.sizeDelta = new Vector2(0f, 48f);
var hlg = root.AddComponent<HorizontalLayoutGroup>();
hlg.padding = new RectOffset(8, 8, 4, 4);
hlg.spacing = 12f;
hlg.childAlignment = TextAnchor.MiddleLeft;
hlg.childControlHeight = true;
hlg.childControlWidth = true;
hlg.childForceExpandHeight = true;
hlg.childForceExpandWidth = false;
var stripe = CreateUiImage("Accent", root.transform, new Color(1f, 1f, 1f, 1f));
stripe.GetComponent<LayoutElement>().preferredWidth = 6f;
stripe.GetComponent<LayoutElement>().flexibleWidth = 0f;
var nameGo = CreateTmp("Name", root.transform, 24f, FontStyles.Bold, TextAlignmentOptions.Left);
nameGo.GetComponent<LayoutElement>().flexibleWidth = 1f;
var barGo = new GameObject("Bar", typeof(RectTransform), typeof(Image), typeof(LayoutElement));
barGo.transform.SetParent(root.transform, false);
barGo.GetComponent<Image>().color = new Color(0.2f, 0.2f, 0.22f, 1f);
barGo.GetComponent<LayoutElement>().preferredWidth = 160f;
barGo.GetComponent<LayoutElement>().flexibleWidth = 0f;
barGo.GetComponent<LayoutElement>().preferredHeight = 16f;
var fillGo = CreateUiImage("Fill", barGo.transform, Color.white);
var fillRt = fillGo.GetComponent<RectTransform>();
fillRt.anchorMin = Vector2.zero;
fillRt.anchorMax = Vector2.one;
fillRt.offsetMin = Vector2.zero;
fillRt.offsetMax = Vector2.zero;
var fillImage = fillGo.GetComponent<Image>();
fillImage.type = Image.Type.Filled;
fillImage.fillMethod = Image.FillMethod.Horizontal;
fillImage.fillAmount = 0.2f;
Object.DestroyImmediate(fillGo.GetComponent<LayoutElement>());
var rankGo = CreateTmp("Rank", root.transform, 24f, FontStyles.Normal, TextAlignmentOptions.Right);
rankGo.GetComponent<LayoutElement>().preferredWidth = 40f;
rankGo.GetComponent<LayoutElement>().flexibleWidth = 0f;
var view = root.GetComponent<SkillRowView>();
var so = new SerializedObject(view);
so.FindProperty("nameLabel").objectReferenceValue = nameGo.GetComponent<TMP_Text>();
so.FindProperty("rankLabel").objectReferenceValue = rankGo.GetComponent<TMP_Text>();
so.FindProperty("barFill").objectReferenceValue = fillImage;
so.FindProperty("accentStripe").objectReferenceValue = stripe.GetComponent<Image>();
so.ApplyModifiedPropertiesWithoutUndo();
var prefab = PrefabUtility.SaveAsPrefabAsset(root, SkillRowPrefabPath);
Object.DestroyImmediate(root);
return prefab;
}
static GameObject CreateDialogueStreamCanvasPrefab(GameObject messageRowPrefab)
{
var canvasGo = CreateCanvas("DialogueStreamCanvas", 5);
var canvasGroup = canvasGo.AddComponent<CanvasGroup>();
var panel = new GameObject("Panel", typeof(RectTransform), typeof(Image));
panel.transform.SetParent(canvasGo.transform, false);
var panelRt = panel.GetComponent<RectTransform>();
panelRt.anchorMin = new Vector2(0.66f, 0f);
panelRt.anchorMax = new Vector2(1f, 1f);
panelRt.offsetMin = Vector2.zero;
panelRt.offsetMax = Vector2.zero;
panel.GetComponent<Image>().color = new Color(0.05f, 0.05f, 0.08f, 0.92f);
var scrollGo = new GameObject("Scroll", typeof(RectTransform), typeof(ScrollRect), typeof(Image));
scrollGo.transform.SetParent(panel.transform, false);
Stretch(scrollGo.GetComponent<RectTransform>(), 8f);
scrollGo.GetComponent<Image>().color = new Color(0f, 0f, 0f, 0.01f);
var viewport = new GameObject("Viewport", typeof(RectTransform), typeof(RectMask2D), typeof(Image));
viewport.transform.SetParent(scrollGo.transform, false);
Stretch(viewport.GetComponent<RectTransform>());
viewport.GetComponent<Image>().color = new Color(1f, 1f, 1f, 0.01f);
var content = new GameObject("Content", typeof(RectTransform), typeof(VerticalLayoutGroup), typeof(ContentSizeFitter));
content.transform.SetParent(viewport.transform, false);
var contentRt = content.GetComponent<RectTransform>();
contentRt.anchorMin = new Vector2(0f, 0f);
contentRt.anchorMax = new Vector2(1f, 0f);
contentRt.pivot = new Vector2(0.5f, 0f);
contentRt.sizeDelta = new Vector2(0f, 0f);
var vlg = content.GetComponent<VerticalLayoutGroup>();
vlg.childAlignment = TextAnchor.LowerCenter;
vlg.childControlHeight = true;
vlg.childControlWidth = true;
vlg.childForceExpandHeight = false;
vlg.childForceExpandWidth = true;
vlg.spacing = 6f;
vlg.padding = new RectOffset(4, 4, 8, 8);
var csf = content.GetComponent<ContentSizeFitter>();
csf.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
var messages = new GameObject("Messages", typeof(RectTransform), typeof(VerticalLayoutGroup), typeof(ContentSizeFitter));
messages.transform.SetParent(content.transform, false);
ConfigureVerticalContent(messages);
var options = new GameObject("Options", typeof(RectTransform), typeof(VerticalLayoutGroup), typeof(ContentSizeFitter), typeof(CanvasGroup));
options.transform.SetParent(content.transform, false);
ConfigureVerticalContent(options);
var optionsGroup = options.GetComponent<CanvasGroup>();
optionsGroup.alpha = 0f;
optionsGroup.interactable = false;
optionsGroup.blocksRaycasts = false;
var scroll = scrollGo.GetComponent<ScrollRect>();
scroll.content = contentRt;
scroll.viewport = viewport.GetComponent<RectTransform>();
scroll.horizontal = false;
scroll.vertical = true;
scroll.movementType = ScrollRect.MovementType.Clamped;
var streamPresenter = canvasGo.AddComponent<DialogueStreamPresenter>();
var streamSo = new SerializedObject(streamPresenter);
streamSo.FindProperty("messageRowPrefab").objectReferenceValue = messageRowPrefab.GetComponent<DialogueMessageRow>();
streamSo.FindProperty("messageContainer").objectReferenceValue = messages.GetComponent<RectTransform>();
streamSo.FindProperty("scrollRect").objectReferenceValue = scroll;
streamSo.ApplyModifiedPropertiesWithoutUndo();
var optionPrefab = AssetDatabase.LoadAssetAtPath<GameObject>(
"Packages/dev.yarnspinner.unity/Prefabs/Option Item.prefab");
var optionsPresenter = canvasGo.AddComponent<DialogueStreamOptionsPresenter>();
var optSo = new SerializedObject(optionsPresenter);
if (optionPrefab != null)
{
optSo.FindProperty("optionViewPrefab").objectReferenceValue = optionPrefab.GetComponent<OptionItem>();
}
optSo.FindProperty("optionsContainer").objectReferenceValue = options.transform;
optSo.FindProperty("canvasGroup").objectReferenceValue = optionsGroup;
optSo.ApplyModifiedPropertiesWithoutUndo();
// Start hidden — DialogueTransitionController shows it.
canvasGroup.alpha = 0f;
canvasGroup.interactable = false;
canvasGroup.blocksRaycasts = false;
var prefab = PrefabUtility.SaveAsPrefabAsset(canvasGo, StreamCanvasPrefabPath);
Object.DestroyImmediate(canvasGo);
return prefab;
}
static GameObject CreateHudCanvasPrefab()
{
var canvasGo = CreateCanvas("HudCanvas", 10);
var portraitSprite = AssetDatabase.LoadAssetAtPath<Sprite>(PortraitPath);
var panel = new GameObject("PortraitPanel", typeof(RectTransform), typeof(CanvasGroup), typeof(Image), typeof(Button));
panel.transform.SetParent(canvasGo.transform, false);
var panelRt = panel.GetComponent<RectTransform>();
panelRt.anchorMin = new Vector2(1f, 0f);
panelRt.anchorMax = new Vector2(1f, 0f);
panelRt.pivot = new Vector2(1f, 0f);
panelRt.sizeDelta = new Vector2(220f, 280f);
panelRt.anchoredPosition = new Vector2(-24f, 24f);
panel.GetComponent<Image>().color = new Color(0.15f, 0.15f, 0.18f, 0.95f);
if (portraitSprite != null)
{
panel.GetComponent<Image>().sprite = portraitSprite;
panel.GetComponent<Image>().preserveAspect = true;
}
var hint = CreateTmp("TabHint", panel.transform, 18f, FontStyles.Normal, TextAlignmentOptions.Center);
var hintRt = hint.GetComponent<RectTransform>();
hintRt.anchorMin = new Vector2(0f, 0f);
hintRt.anchorMax = new Vector2(1f, 0f);
hintRt.pivot = new Vector2(0.5f, 0f);
hintRt.sizeDelta = new Vector2(0f, 28f);
hintRt.anchoredPosition = new Vector2(0f, 4f);
hint.GetComponent<TMP_Text>().text = "Tab";
Object.DestroyImmediate(hint.GetComponent<LayoutElement>());
var view = canvasGo.AddComponent<PortraitHudView>();
var so = new SerializedObject(view);
so.FindProperty("panelRoot").objectReferenceValue = panel;
so.ApplyModifiedPropertiesWithoutUndo();
var prefab = PrefabUtility.SaveAsPrefabAsset(canvasGo, HudCanvasPrefabPath);
Object.DestroyImmediate(canvasGo);
return prefab;
}
static GameObject CreatePlayerMenuCanvasPrefab(GameObject skillRowPrefab)
{
var canvasGo = CreateCanvas("PlayerMenuCanvas", 20);
var rootGroup = canvasGo.AddComponent<CanvasGroup>();
var dimmer = CreateUiImage("Dimmer", canvasGo.transform, new Color(0f, 0f, 0f, 0.6f));
Stretch(dimmer.GetComponent<RectTransform>());
Object.DestroyImmediate(dimmer.GetComponent<LayoutElement>());
var body = new GameObject("MenuBody", typeof(RectTransform), typeof(Image));
body.transform.SetParent(canvasGo.transform, false);
var bodyRt = body.GetComponent<RectTransform>();
bodyRt.anchorMin = new Vector2(0.15f, 0.1f);
bodyRt.anchorMax = new Vector2(0.85f, 0.9f);
bodyRt.offsetMin = Vector2.zero;
bodyRt.offsetMax = Vector2.zero;
body.GetComponent<Image>().color = new Color(0.08f, 0.08f, 0.1f, 0.98f);
var tabBarGo = new GameObject("TabBar", typeof(RectTransform), typeof(HorizontalLayoutGroup), typeof(MenuTabBar));
tabBarGo.transform.SetParent(body.transform, false);
var tabBarRt = tabBarGo.GetComponent<RectTransform>();
tabBarRt.anchorMin = new Vector2(0f, 1f);
tabBarRt.anchorMax = new Vector2(1f, 1f);
tabBarRt.pivot = new Vector2(0.5f, 1f);
tabBarRt.sizeDelta = new Vector2(0f, 56f);
tabBarRt.anchoredPosition = Vector2.zero;
var tabHlg = tabBarGo.GetComponent<HorizontalLayoutGroup>();
tabHlg.spacing = 8f;
tabHlg.padding = new RectOffset(12, 12, 8, 8);
// childControl* default to FALSE on a script-added layout group. Left
// false, each tab button keeps its own 100px sizeDelta ("Character"
// clips to "Charact") and childForceExpandWidth dumps all the leftover
// room between them as a gap instead of widening them.
tabHlg.childControlWidth = true;
tabHlg.childControlHeight = true;
tabHlg.childForceExpandWidth = true;
tabHlg.childForceExpandHeight = true;
var contentArea = new GameObject("ContentArea", typeof(RectTransform));
contentArea.transform.SetParent(body.transform, false);
var contentRt = contentArea.GetComponent<RectTransform>();
contentRt.anchorMin = new Vector2(0f, 0f);
contentRt.anchorMax = new Vector2(1f, 1f);
contentRt.offsetMin = new Vector2(16f, 16f);
contentRt.offsetMax = new Vector2(-16f, -64f);
var characterPanel = CreateTabPanel("CharacterPanel", contentArea.transform);
var skillsPanel = CreateTabPanel("SkillsPanel", contentArea.transform);
var journalPanel = CreateTabPanel("JournalPanel", contentArea.transform);
// Character content
var charView = characterPanel.AddComponent<CharacterPanelView>();
var nameLabel = CreateTmp("Name", characterPanel.transform, 36f, FontStyles.Bold, TextAlignmentOptions.Left);
var aliasLabel = CreateTmp("Alias", characterPanel.transform, 28f, FontStyles.Italic, TextAlignmentOptions.Left);
var invLabel = CreateTmp("Inventory", characterPanel.transform, 24f, FontStyles.Normal, TextAlignmentOptions.Left);
var charVlg = characterPanel.AddComponent<VerticalLayoutGroup>();
charVlg.spacing = 12f;
charVlg.padding = new RectOffset(8, 8, 8, 8);
charVlg.childControlWidth = true;
charVlg.childControlHeight = true;
charVlg.childForceExpandWidth = true;
charVlg.childForceExpandHeight = false;
var charSo = new SerializedObject(charView);
charSo.FindProperty("nameLabel").objectReferenceValue = nameLabel.GetComponent<TMP_Text>();
charSo.FindProperty("aliasLabel").objectReferenceValue = aliasLabel.GetComponent<TMP_Text>();
charSo.FindProperty("inventoryPlaceholder").objectReferenceValue = invLabel.GetComponent<TMP_Text>();
charSo.ApplyModifiedPropertiesWithoutUndo();
// Skills content
var skillsScroll = new GameObject("SkillsScroll", typeof(RectTransform), typeof(ScrollRect));
skillsScroll.transform.SetParent(skillsPanel.transform, false);
Stretch(skillsScroll.GetComponent<RectTransform>());
var skillsViewport = new GameObject("Viewport", typeof(RectTransform), typeof(RectMask2D), typeof(Image));
skillsViewport.transform.SetParent(skillsScroll.transform, false);
Stretch(skillsViewport.GetComponent<RectTransform>());
skillsViewport.GetComponent<Image>().color = new Color(1f, 1f, 1f, 0.01f);
var skillsContent = new GameObject("Content", typeof(RectTransform), typeof(VerticalLayoutGroup), typeof(ContentSizeFitter));
skillsContent.transform.SetParent(skillsViewport.transform, false);
ConfigureVerticalContent(skillsContent);
var skillsContentRt = skillsContent.GetComponent<RectTransform>();
skillsContentRt.anchorMin = new Vector2(0f, 1f);
skillsContentRt.anchorMax = new Vector2(1f, 1f);
skillsContentRt.pivot = new Vector2(0.5f, 1f);
var skillsScrollRect = skillsScroll.GetComponent<ScrollRect>();
skillsScrollRect.content = skillsContentRt;
skillsScrollRect.viewport = skillsViewport.GetComponent<RectTransform>();
skillsScrollRect.horizontal = false;
var axisHeaderTemplate = CreateTmp("AxisHeaderTemplate", skillsContent.transform, 20f, FontStyles.Bold, TextAlignmentOptions.Left);
axisHeaderTemplate.SetActive(false);
var skillsView = skillsPanel.AddComponent<SkillsPanelView>();
var skillsSo = new SerializedObject(skillsView);
skillsSo.FindProperty("contentRoot").objectReferenceValue = skillsContentRt;
skillsSo.FindProperty("rowPrefab").objectReferenceValue = skillRowPrefab.GetComponent<SkillRowView>();
skillsSo.FindProperty("axisHeaderPrefab").objectReferenceValue = axisHeaderTemplate.GetComponent<TMP_Text>();
skillsSo.FindProperty("displayMaxRank").intValue = 6;
skillsSo.ApplyModifiedPropertiesWithoutUndo();
// Journal content
var journalView = journalPanel.AddComponent<JournalPanelView>();
var journalLabel = CreateTmp("Placeholder", journalPanel.transform, 28f, FontStyles.Italic, TextAlignmentOptions.Center);
Stretch(journalLabel.GetComponent<RectTransform>());
Object.DestroyImmediate(journalLabel.GetComponent<LayoutElement>());
var journalSo = new SerializedObject(journalView);
journalSo.FindProperty("placeholderLabel").objectReferenceValue = journalLabel.GetComponent<TMP_Text>();
journalSo.ApplyModifiedPropertiesWithoutUndo();
var charBtn = CreateTabButton("Character", tabBarGo.transform);
var skillsBtn = CreateTabButton("Skills", tabBarGo.transform);
var journalBtn = CreateTabButton("Journal", tabBarGo.transform);
var tabBar = tabBarGo.GetComponent<MenuTabBar>();
var tabSo = new SerializedObject(tabBar);
var tabsProp = tabSo.FindProperty("tabs");
tabsProp.arraySize = 3;
// Character tab must refresh on show for the same reason as Skills:
// panels toggle via CanvasGroup, so OnEnable never fires again.
SetTabEntry(tabsProp.GetArrayElementAtIndex(0), charBtn.GetComponent<Button>(), characterPanel.GetComponent<CanvasGroup>(), charView, "Refresh");
SetTabEntry(tabsProp.GetArrayElementAtIndex(1), skillsBtn.GetComponent<Button>(), skillsPanel.GetComponent<CanvasGroup>(), skillsView, "Refresh");
SetTabEntry(tabsProp.GetArrayElementAtIndex(2), journalBtn.GetComponent<Button>(), journalPanel.GetComponent<CanvasGroup>(), null);
tabSo.ApplyModifiedPropertiesWithoutUndo();
var menuController = canvasGo.AddComponent<PlayerMenuController>();
var menuSo = new SerializedObject(menuController);
menuSo.FindProperty("menuRoot").objectReferenceValue = canvasGo;
menuSo.FindProperty("tabBar").objectReferenceValue = tabBar;
menuSo.ApplyModifiedPropertiesWithoutUndo();
rootGroup.alpha = 0f;
rootGroup.interactable = false;
rootGroup.blocksRaycasts = false;
var prefab = PrefabUtility.SaveAsPrefabAsset(canvasGo, MenuCanvasPrefabPath);
Object.DestroyImmediate(canvasGo);
return prefab;
}
static void SetTabEntry(SerializedProperty entry, Button button, CanvasGroup panel, Object target, string method = null)
{
entry.FindPropertyRelative("button").objectReferenceValue = button;
entry.FindPropertyRelative("panel").objectReferenceValue = panel;
if (target != null && method != null)
{
var onShown = entry.FindPropertyRelative("onShown");
onShown.FindPropertyRelative("m_PersistentCalls.m_Calls").arraySize = 1;
var call = onShown.FindPropertyRelative("m_PersistentCalls.m_Calls").GetArrayElementAtIndex(0);
call.FindPropertyRelative("m_Target").objectReferenceValue = target;
call.FindPropertyRelative("m_MethodName").stringValue = method;
call.FindPropertyRelative("m_Mode").enumValueIndex = 1; // Void
call.FindPropertyRelative("m_CallState").enumValueIndex = 2; // RuntimeOnly
}
}
static void WireScene(GameObject streamCanvasPrefab, GameObject hudCanvasPrefab, GameObject menuCanvasPrefab)
{
var scene = EditorSceneManager.OpenScene(ScenePath, OpenSceneMode.Single);
// UI System root
var uiSystem = GameObject.Find("UI System");
if (uiSystem == null)
{
uiSystem = new GameObject("UI System");
}
if (uiSystem.GetComponent<UIStateController>() == null)
{
uiSystem.AddComponent<UIStateController>();
}
// Player components
var player = GameObject.Find("PlayerArmature");
if (player == null)
{
Debug.LogError("[UILayerSetup] PlayerArmature not found in scene.");
return;
}
var controlLock = player.GetComponent<PlayerControlLock>();
if (controlLock == null)
{
controlLock = player.AddComponent<PlayerControlLock>();
}
var menuInput = player.GetComponent<PlayerMenuInput>();
if (menuInput == null)
{
menuInput = player.AddComponent<PlayerMenuInput>();
}
var inputs = player.GetComponent<StarterAssetsInputs>();
if (inputs != null)
{
inputs.cursorLocked = false;
EditorUtility.SetDirty(inputs);
}
// DialogueTransitionController
var transition = Object.FindFirstObjectByType<DialogueTransitionController>();
if (transition != null)
{
var tSo = new SerializedObject(transition);
tSo.FindProperty("controlLock").objectReferenceValue = controlLock;
tSo.ApplyModifiedPropertiesWithoutUndo();
}
// Instantiate / refresh UI prefab instances
var streamInstance = EnsurePrefabInstance(streamCanvasPrefab, "DialogueStreamCanvas");
var hudInstance = EnsurePrefabInstance(hudCanvasPrefab, "HudCanvas");
var menuInstance = EnsurePrefabInstance(menuCanvasPrefab, "PlayerMenuCanvas");
// Wire menu controller refs
var menuController = menuInstance.GetComponent<PlayerMenuController>();
if (menuController != null)
{
var mSo = new SerializedObject(menuController);
mSo.FindProperty("menuInput").objectReferenceValue = menuInput;
mSo.FindProperty("controlLock").objectReferenceValue = controlLock;
mSo.ApplyModifiedPropertiesWithoutUndo();
}
// Portrait → Open menu
var portraitButton = hudInstance.GetComponentInChildren<Button>(true);
if (portraitButton != null && menuController != null)
{
while (portraitButton.onClick.GetPersistentEventCount() > 0)
{
UnityEditor.Events.UnityEventTools.RemovePersistentListener(portraitButton.onClick, 0);
}
UnityEditor.Events.UnityEventTools.AddPersistentListener(portraitButton.onClick, menuController.Open);
EditorUtility.SetDirty(portraitButton);
}
// Camera framing
var vcam = GameObject.Find("CinemachineCamera");
if (vcam != null)
{
var framing = vcam.GetComponent<DialogueCameraFraming>();
if (framing == null)
{
framing = vcam.AddComponent<DialogueCameraFraming>();
}
var composer = vcam.GetComponent<CinemachinePositionComposer>();
var fSo = new SerializedObject(framing);
fSo.FindProperty("composer").objectReferenceValue = composer;
fSo.FindProperty("dialogueScreenX").floatValue = -0.17f;
fSo.ApplyModifiedPropertiesWithoutUndo();
}
// Re-point DialogueRunner presenters
var runner = Object.FindFirstObjectByType<DialogueRunner>();
var streamPresenter = streamInstance.GetComponent<DialogueStreamPresenter>();
var optionsPresenter = streamInstance.GetComponent<DialogueStreamOptionsPresenter>();
var lineAdvancer = Object.FindFirstObjectByType<LineAdvancer>();
if (runner != null && streamPresenter != null && optionsPresenter != null)
{
var rSo = new SerializedObject(runner);
var presenters = rSo.FindProperty("dialoguePresenters");
if (presenters != null)
{
presenters.arraySize = lineAdvancer != null ? 3 : 2;
presenters.GetArrayElementAtIndex(0).objectReferenceValue = streamPresenter;
presenters.GetArrayElementAtIndex(1).objectReferenceValue = optionsPresenter;
if (lineAdvancer != null)
{
presenters.GetArrayElementAtIndex(2).objectReferenceValue = lineAdvancer;
}
rSo.ApplyModifiedPropertiesWithoutUndo();
}
}
if (lineAdvancer != null && streamPresenter != null)
{
var aSo = new SerializedObject(lineAdvancer);
aSo.FindProperty("presenter").objectReferenceValue = streamPresenter;
aSo.ApplyModifiedPropertiesWithoutUndo();
}
// Point DialogueTransitionController.dialogueUI at the new canvas
if (transition != null && streamInstance != null)
{
var tSo = new SerializedObject(transition);
tSo.FindProperty("dialogueUI").objectReferenceValue = streamInstance;
tSo.FindProperty("controlLock").objectReferenceValue = controlLock;
tSo.ApplyModifiedPropertiesWithoutUndo();
}
// Deactivate the package Dialogue System Canvas (keep EventSystem alive)
var dialogueSystem = GameObject.Find("Dialogue System");
if (dialogueSystem != null)
{
var packageCanvas = dialogueSystem.transform.Find("Canvas");
if (packageCanvas != null)
{
// Rescue the Skill Check Banner onto the scene-owned Skill Check
// Canvas — NOT into streamInstance. EnsurePrefabInstance
// DestroyImmediates the stream canvas on every re-run, so
// anything parented under it dies with it; that is what left
// SkillRuntime.resultView null after the second setup run.
// Skill Check Canvas is scene-owned, survives re-runs, and its
// sortingOrder 100 already draws above the dialogue canvas.
var banner = packageCanvas.Find("Skill Check Banner");
if (banner != null)
{
var bannerHost = GameObject.Find("Skill Check Canvas");
if (bannerHost != null)
{
banner.SetParent(bannerHost.transform, false);
}
}
packageCanvas.gameObject.SetActive(false);
}
}
// Repair SkillRuntime.resultView. It can be left dangling by an earlier
// run of this menu item, and a null here silently disables every roll
// banner ("SkillCheckResultView is not assigned; skipping roll banner").
// Prefer an active view if more than one survives.
SkillCheckResultView resultView = null;
foreach (var candidate in Object.FindObjectsByType<SkillCheckResultView>(
FindObjectsInactive.Include, FindObjectsSortMode.None))
{
if (resultView == null
|| (!resultView.gameObject.activeInHierarchy && candidate.gameObject.activeInHierarchy))
{
resultView = candidate;
}
}
var skillRuntime = Object.FindFirstObjectByType<SkillRuntime>();
if (skillRuntime != null && resultView != null)
{
var skillSo = new SerializedObject(skillRuntime);
skillSo.FindProperty("resultView").objectReferenceValue = resultView;
skillSo.ApplyModifiedPropertiesWithoutUndo();
}
else if (skillRuntime != null)
{
Debug.LogWarning("[UILayerSetup] No SkillCheckResultView found in the scene; roll banners will not display.", skillRuntime);
}
// Update NPCStandIn dialogueUI refs to the new canvas
foreach (var npc in Object.FindObjectsByType<NPCStandIn>(FindObjectsInactive.Include, FindObjectsSortMode.None))
{
var so = new SerializedObject(npc);
var uiProp = so.FindProperty("dialogueUI");
if (uiProp != null)
{
uiProp.objectReferenceValue = streamInstance;
so.ApplyModifiedPropertiesWithoutUndo();
}
}
EditorSceneManager.MarkSceneDirty(scene);
EditorSceneManager.SaveScene(scene);
}
static GameObject EnsurePrefabInstance(GameObject prefab, string name)
{
var existing = GameObject.Find(name);
if (existing != null)
{
Object.DestroyImmediate(existing);
}
var instance = (GameObject)PrefabUtility.InstantiatePrefab(prefab);
instance.name = name;
return instance;
}
static GameObject CreateCanvas(string name, int sortingOrder)
{
var go = new GameObject(name, typeof(RectTransform), typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster));
var canvas = go.GetComponent<Canvas>();
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
canvas.sortingOrder = sortingOrder;
var scaler = go.GetComponent<CanvasScaler>();
scaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
scaler.referenceResolution = new Vector2(1920f, 1080f);
scaler.matchWidthOrHeight = 0.5f;
return go;
}
static GameObject CreateTabPanel(string name, Transform parent)
{
var go = new GameObject(name, typeof(RectTransform), typeof(CanvasGroup));
go.transform.SetParent(parent, false);
Stretch(go.GetComponent<RectTransform>());
var group = go.GetComponent<CanvasGroup>();
group.alpha = 0f;
group.interactable = false;
group.blocksRaycasts = false;
return go;
}
static GameObject CreateTabButton(string label, Transform parent)
{
var go = new GameObject(label, typeof(RectTransform), typeof(Image), typeof(Button), typeof(LayoutElement));
go.transform.SetParent(parent, false);
go.GetComponent<Image>().color = new Color(0.2f, 0.2f, 0.25f, 1f);
var text = CreateTmp("Label", go.transform, 22f, FontStyles.Bold, TextAlignmentOptions.Center);
Stretch(text.GetComponent<RectTransform>());
Object.DestroyImmediate(text.GetComponent<LayoutElement>());
text.GetComponent<TMP_Text>().text = label;
return go;
}
static GameObject CreateTmp(string name, Transform parent, float size, FontStyles style, TextAlignmentOptions align)
{
var go = new GameObject(name, typeof(RectTransform), typeof(TextMeshProUGUI), typeof(LayoutElement));
go.transform.SetParent(parent, false);
var tmp = go.GetComponent<TextMeshProUGUI>();
tmp.fontSize = size;
tmp.fontStyle = style;
tmp.alignment = align;
tmp.color = Color.white;
tmp.text = name;
tmp.textWrappingMode = TextWrappingModes.Normal;
// Deliberately no LayoutElement.preferredHeight. A fixed height here is
// one line's worth, and LayoutElement outranks TMP's own ILayoutElement
// report — so a wrapped 4-line body would be allocated ~40px while
// rendering ~150px, and consecutive rows draw on top of each other.
// Leaving it at the -1 default lets TMP measure the wrapped text.
// The component stays so callers can still set preferredWidth /
// flexibleWidth (see the skill row).
return go;
}
static GameObject CreateUiImage(string name, Transform parent, Color color)
{
var go = new GameObject(name, typeof(RectTransform), typeof(Image), typeof(LayoutElement));
go.transform.SetParent(parent, false);
go.GetComponent<Image>().color = color;
return go;
}
static void Stretch(RectTransform rt, float pad = 0f)
{
rt.anchorMin = Vector2.zero;
rt.anchorMax = Vector2.one;
rt.offsetMin = new Vector2(pad, pad);
rt.offsetMax = new Vector2(-pad, -pad);
}
static void ConfigureVerticalContent(GameObject go)
{
var rt = go.GetComponent<RectTransform>();
rt.anchorMin = new Vector2(0f, 0f);
rt.anchorMax = new Vector2(1f, 0f);
rt.pivot = new Vector2(0.5f, 0f);
// A RectTransform added via `new GameObject(..., typeof(RectTransform))`
// starts at sizeDelta (100,100). With horizontal-stretch anchors that
// makes the rect parentWidth + 100 wide, centred — overhanging 50px off
// each side, and the RectMask2D shears the left edge off every label.
// ContentSizeFitter only governs the vertical axis, so it never
// corrects this. Zero the horizontal size explicitly.
rt.sizeDelta = new Vector2(0f, rt.sizeDelta.y);
rt.anchoredPosition = Vector2.zero;
var vlg = go.GetComponent<VerticalLayoutGroup>();
vlg.childControlHeight = true;
vlg.childControlWidth = true;
vlg.childForceExpandHeight = false;
vlg.childForceExpandWidth = true;
vlg.spacing = 4f;
var csf = go.GetComponent<ContentSizeFitter>();
csf.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5bdf044f1ab04312b76895dac1740b37
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,48 @@
using UnityEditor;
using UnityEngine;
/// <summary>
/// Reminds the user to run the one-shot prefab/scene wiring menu after scripts
/// compile. Runtime play works without it via UILayerBootstrap.
/// </summary>
[InitializeOnLoad]
static class UILayerSetupAutoRun
{
const string PrefKey = "NightclubArcadia.UILayerSetup.Reminded";
const string MarkerPrefab = "Assets/Prefabs/UI/PlayerMenuCanvas.prefab";
static UILayerSetupAutoRun()
{
EditorApplication.delayCall += RemindIfNeeded;
}
static void RemindIfNeeded()
{
if (EditorApplication.isPlayingOrWillChangePlaymode || EditorApplication.isCompiling)
{
return;
}
if (AssetDatabase.LoadAssetAtPath<GameObject>(MarkerPrefab) != null)
{
return;
}
if (EditorPrefs.GetBool(PrefKey, false))
{
return;
}
EditorPrefs.SetBool(PrefKey, true);
Debug.Log(
"[UILayer] Prefabs not built yet. Play Mode works via UILayerBootstrap. " +
"To author prefabs into the scene, run Tools → Nightclub Arcadia → Set Up UI Layer.");
}
[MenuItem("Tools/Nightclub Arcadia/Reset UI Layer Auto-Setup Flag")]
static void ResetFlag()
{
EditorPrefs.DeleteKey(PrefKey);
Debug.Log("[UILayer] Reminder flag cleared.");
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6c0e3c886ff143d3b26b7f55d7f22410
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fe41419ba50842189534933e2b64e958
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 11e75200bdad4ff48299a7d24bb8df99
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,413 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3506879458838080580
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1649868454372858534}
- component: {fileID: 5353601244371665078}
- component: {fileID: 3249155410833833935}
- component: {fileID: 3956878563407369997}
m_Layer: 0
m_Name: DialogueMessageRow
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1649868454372858534
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3506879458838080580}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 5063401541721017946}
- {fileID: 7857316982467238224}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 80}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &5353601244371665078
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3506879458838080580}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a7773ea9a6f44798aa98356903037d16, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::NightclubArcadia.UI.Dialogue.DialogueMessageRow
speakerText: {fileID: 5900251945930220314}
bodyText: {fileID: 1670956017877202442}
speakerLabel: {fileID: 5822252844234204748}
--- !u!114 &3249155410833833935
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3506879458838080580}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.VerticalLayoutGroup
m_Padding:
m_Left: 12
m_Right: 12
m_Top: 8
m_Bottom: 8
m_ChildAlignment: 0
m_Spacing: 4
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 1
m_ChildControlHeight: 1
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!114 &3956878563407369997
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3506879458838080580}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.ContentSizeFitter
m_HorizontalFit: 0
m_VerticalFit: 2
--- !u!1 &5450003319614969337
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7857316982467238224}
- component: {fileID: 3605186933310922639}
- component: {fileID: 1670956017877202442}
- component: {fileID: 6572944391823112727}
m_Layer: 0
m_Name: Body
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7857316982467238224
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5450003319614969337}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1649868454372858534}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3605186933310922639
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5450003319614969337}
m_CullTransparentMesh: 1
--- !u!114 &1670956017877202442
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5450003319614969337}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Body
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: 0
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 28
m_fontSizeBase: 28
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_characterHorizontalScale: 1
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_TextWrappingMode: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 0
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_EmojiFallbackSupport: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!114 &6572944391823112727
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5450003319614969337}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
m_IgnoreLayout: 0
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &5822252844234204748
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5063401541721017946}
- component: {fileID: 4569120956328637162}
- component: {fileID: 5900251945930220314}
- component: {fileID: 3733932380812113541}
m_Layer: 0
m_Name: Speaker
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5063401541721017946
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5822252844234204748}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1649868454372858534}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4569120956328637162
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5822252844234204748}
m_CullTransparentMesh: 1
--- !u!114 &5900251945930220314
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5822252844234204748}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Speaker
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: 0
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 22
m_fontSizeBase: 22
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 1
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterHorizontalScale: 1
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_TextWrappingMode: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 0
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_EmojiFallbackSupport: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!114 &3733932380812113541
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5822252844234204748}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
m_IgnoreLayout: 0
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 90818ef7dc74247ceb348994755cea86
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,673 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1431520567503728820
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4838388606347767229}
- component: {fileID: 848167695161913818}
- component: {fileID: 872887529246740654}
m_Layer: 0
m_Name: Messages
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4838388606347767229
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1431520567503728820}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6371610150170887506}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 100}
m_Pivot: {x: 0.5, y: 0}
--- !u!114 &848167695161913818
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1431520567503728820}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.VerticalLayoutGroup
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 0
m_Spacing: 4
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 1
m_ChildControlHeight: 1
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!114 &872887529246740654
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1431520567503728820}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.ContentSizeFitter
m_HorizontalFit: 0
m_VerticalFit: 2
--- !u!1 &2888832924926796905
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8553742246756266605}
- component: {fileID: 7475958128581596541}
- component: {fileID: 5788080976967704390}
m_Layer: 0
m_Name: Panel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8553742246756266605
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2888832924926796905}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6287368187237088396}
m_Father: {fileID: 1243836425688988300}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.66, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7475958128581596541
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2888832924926796905}
m_CullTransparentMesh: 1
--- !u!114 &5788080976967704390
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2888832924926796905}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 0.05, g: 0.05, b: 0.08, a: 0.92}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &4923635399097880277
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3746324764683222304}
- component: {fileID: 3035847077530824546}
- component: {fileID: 5149667566061008557}
- component: {fileID: 2566128074157561357}
m_Layer: 0
m_Name: Viewport
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3746324764683222304
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4923635399097880277}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6371610150170887506}
m_Father: {fileID: 6287368187237088396}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &3035847077530824546
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4923635399097880277}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3312d7739989d2b4e91e6319e9a96d76, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RectMask2D
m_Padding: {x: 0, y: 0, z: 0, w: 0}
m_Softness: {x: 0, y: 0}
--- !u!222 &5149667566061008557
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4923635399097880277}
m_CullTransparentMesh: 1
--- !u!114 &2566128074157561357
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4923635399097880277}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.01}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &5260492858234310193
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6371610150170887506}
- component: {fileID: 2397794206583674815}
- component: {fileID: 5419335647702174254}
m_Layer: 0
m_Name: Content
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6371610150170887506
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5260492858234310193}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4838388606347767229}
- {fileID: 6329947636030823459}
m_Father: {fileID: 3746324764683222304}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0}
--- !u!114 &2397794206583674815
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5260492858234310193}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.VerticalLayoutGroup
m_Padding:
m_Left: 4
m_Right: 4
m_Top: 8
m_Bottom: 8
m_ChildAlignment: 7
m_Spacing: 6
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 1
m_ChildControlHeight: 1
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!114 &5419335647702174254
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5260492858234310193}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.ContentSizeFitter
m_HorizontalFit: 0
m_VerticalFit: 2
--- !u!1 &7249108092969100431
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6329947636030823459}
- component: {fileID: 5824694681547497274}
- component: {fileID: 6817391513969849154}
- component: {fileID: 5117926241503925785}
m_Layer: 0
m_Name: Options
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6329947636030823459
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7249108092969100431}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6371610150170887506}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 100}
m_Pivot: {x: 0.5, y: 0}
--- !u!114 &5824694681547497274
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7249108092969100431}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.VerticalLayoutGroup
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 0
m_Spacing: 4
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 1
m_ChildControlHeight: 1
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!114 &6817391513969849154
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7249108092969100431}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.ContentSizeFitter
m_HorizontalFit: 0
m_VerticalFit: 2
--- !u!225 &5117926241503925785
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7249108092969100431}
m_Enabled: 1
m_Alpha: 0
m_Interactable: 0
m_BlocksRaycasts: 0
m_IgnoreParentGroups: 0
--- !u!1 &8691714907102969075
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1243836425688988300}
- component: {fileID: 1592513625297910240}
- component: {fileID: 7055069541643637941}
- component: {fileID: 4390775391658295920}
- component: {fileID: 3476584232491665726}
- component: {fileID: 6097567599041115085}
- component: {fileID: 307489608854241188}
m_Layer: 0
m_Name: DialogueStreamCanvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1243836425688988300
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8691714907102969075}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 8553742246756266605}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!223 &1592513625297910240
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8691714907102969075}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_UseReflectionProbes: 0
m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 5
m_TargetDisplay: 0
--- !u!114 &7055069541643637941
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8691714907102969075}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.CanvasScaler
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 1920, y: 1080}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0.5
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!114 &4390775391658295920
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8691714907102969075}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.GraphicRaycaster
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!225 &3476584232491665726
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8691714907102969075}
m_Enabled: 1
m_Alpha: 0
m_Interactable: 0
m_BlocksRaycasts: 0
m_IgnoreParentGroups: 0
--- !u!114 &6097567599041115085
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8691714907102969075}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 88cb6495795a4e13ac7fb72343c132af, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::NightclubArcadia.UI.Dialogue.DialogueStreamPresenter
messageRowPrefab: {fileID: 5353601244371665078, guid: 90818ef7dc74247ceb348994755cea86, type: 3}
messageContainer: {fileID: 4838388606347767229}
scrollRect: {fileID: 7105587415705135446}
maxRows: 100
lettersPerSecond: 60
--- !u!114 &307489608854241188
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8691714907102969075}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8d86cc99d5b545c4a3fad9e1482031a2, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::NightclubArcadia.UI.Dialogue.DialogueStreamOptionsPresenter
optionViewPrefab: {fileID: 2576261519635394347, guid: e605972137b0b4c1399ffb07beae9a9b, type: 3}
optionsContainer: {fileID: 6329947636030823459}
canvasGroup: {fileID: 5117926241503925785}
showUnavailableOptions: 0
--- !u!1 &8898733438161318853
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6287368187237088396}
- component: {fileID: 7105587415705135446}
- component: {fileID: 6289533314517078144}
- component: {fileID: 7217060756955950799}
m_Layer: 0
m_Name: Scroll
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6287368187237088396
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8898733438161318853}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 3746324764683222304}
m_Father: {fileID: 8553742246756266605}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -16, y: -16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &7105587415705135446
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8898733438161318853}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.ScrollRect
m_Content: {fileID: 6371610150170887506}
m_Horizontal: 0
m_Vertical: 1
m_MovementType: 2
m_Elasticity: 0.1
m_Inertia: 1
m_DecelerationRate: 0.135
m_ScrollSensitivity: 1
m_Viewport: {fileID: 3746324764683222304}
m_HorizontalScrollbar: {fileID: 0}
m_VerticalScrollbar: {fileID: 0}
m_HorizontalScrollbarVisibility: 0
m_VerticalScrollbarVisibility: 0
m_HorizontalScrollbarSpacing: 0
m_VerticalScrollbarSpacing: 0
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!222 &6289533314517078144
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8898733438161318853}
m_CullTransparentMesh: 1
--- !u!114 &7217060756955950799
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8898733438161318853}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 0.01}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 55fc979a64b174ce796ffa39b13b7259
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,390 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3845905829654890729
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4691680407920056117}
- component: {fileID: 9194898352646057999}
- component: {fileID: 7450534218736675587}
m_Layer: 0
m_Name: TabHint
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4691680407920056117
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3845905829654890729}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 252585930844827291}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 4}
m_SizeDelta: {x: 0, y: 28}
m_Pivot: {x: 0.5, y: 0}
--- !u!222 &9194898352646057999
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3845905829654890729}
m_CullTransparentMesh: 1
--- !u!114 &7450534218736675587
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3845905829654890729}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Tab
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: 0
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 18
m_fontSizeBase: 18
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterHorizontalScale: 1
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_TextWrappingMode: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 0
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_EmojiFallbackSupport: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &4914891251226459434
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8125896019114993279}
- component: {fileID: 637496887729740374}
- component: {fileID: 7333171482869056901}
- component: {fileID: 3439018567020279905}
- component: {fileID: 4573334312575796821}
m_Layer: 0
m_Name: HudCanvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8125896019114993279
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4914891251226459434}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 252585930844827291}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!223 &637496887729740374
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4914891251226459434}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_UseReflectionProbes: 0
m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 10
m_TargetDisplay: 0
--- !u!114 &7333171482869056901
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4914891251226459434}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.CanvasScaler
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 1920, y: 1080}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0.5
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!114 &3439018567020279905
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4914891251226459434}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.GraphicRaycaster
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &4573334312575796821
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4914891251226459434}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fd1354ade14b4b1d80da9acac4aa9e12, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::NightclubArcadia.UI.HUD.PortraitHudView
panelRoot: {fileID: 4989543578856257477}
--- !u!1 &4989543578856257477
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 252585930844827291}
- component: {fileID: 7861001760273437131}
- component: {fileID: 1348039723167098503}
- component: {fileID: 4045319608296230342}
- component: {fileID: 1473442362196520338}
m_Layer: 0
m_Name: PortraitPanel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &252585930844827291
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4989543578856257477}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4691680407920056117}
m_Father: {fileID: 8125896019114993279}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -24, y: 24}
m_SizeDelta: {x: 220, y: 280}
m_Pivot: {x: 1, y: 0}
--- !u!225 &7861001760273437131
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4989543578856257477}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!222 &1348039723167098503
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4989543578856257477}
m_CullTransparentMesh: 1
--- !u!114 &4045319608296230342
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4989543578856257477}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 0.15, g: 0.15, b: 0.18, a: 0.95}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: a1b2c3d4e5f60718293a4b5c6d7e8f90, type: 3}
m_Type: 0
m_PreserveAspect: 1
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &1473442362196520338
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4989543578856257477}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Button
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 4045319608296230342}
m_OnClick:
m_PersistentCalls:
m_Calls: []
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 792e1d4c4cde942e8a71947301a3868c
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bb4c52aaa2c9e41aabc4bb11fa6372ba
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,669 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &738428826500747930
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7033684844244958404}
- component: {fileID: 8854647563054178895}
- component: {fileID: 7773152306665733045}
- component: {fileID: 3269936702826226914}
m_Layer: 0
m_Name: Accent
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7033684844244958404
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 738428826500747930}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6014094232834212140}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8854647563054178895
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 738428826500747930}
m_CullTransparentMesh: 1
--- !u!114 &7773152306665733045
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 738428826500747930}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &3269936702826226914
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 738428826500747930}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
m_IgnoreLayout: 0
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: 6
m_PreferredHeight: -1
m_FlexibleWidth: 0
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &1043270585848180102
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6266953780690568889}
- component: {fileID: 6662307575930959716}
- component: {fileID: 874797289038649292}
- component: {fileID: 3005905926608676038}
m_Layer: 0
m_Name: Bar
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6266953780690568889
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1043270585848180102}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 437950331768363985}
m_Father: {fileID: 6014094232834212140}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6662307575930959716
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1043270585848180102}
m_CullTransparentMesh: 1
--- !u!114 &874797289038649292
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1043270585848180102}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 0.2, g: 0.2, b: 0.22, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &3005905926608676038
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1043270585848180102}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
m_IgnoreLayout: 0
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: 160
m_PreferredHeight: 16
m_FlexibleWidth: 0
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &1311471292218943158
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4484942689062487776}
- component: {fileID: 285052103366591294}
- component: {fileID: 6986784551111800944}
- component: {fileID: 4453305505185908855}
m_Layer: 0
m_Name: Rank
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4484942689062487776
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1311471292218943158}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6014094232834212140}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &285052103366591294
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1311471292218943158}
m_CullTransparentMesh: 1
--- !u!114 &6986784551111800944
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1311471292218943158}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Rank
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: 0
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 24
m_fontSizeBase: 24
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 4
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterHorizontalScale: 1
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_TextWrappingMode: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 0
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_EmojiFallbackSupport: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!114 &4453305505185908855
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1311471292218943158}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
m_IgnoreLayout: 0
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: 40
m_PreferredHeight: -1
m_FlexibleWidth: 0
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &3239427835033733195
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4775921688302885094}
- component: {fileID: 3498508026980942921}
- component: {fileID: 4172720891822695416}
- component: {fileID: 6787294827931527212}
m_Layer: 0
m_Name: Name
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4775921688302885094
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3239427835033733195}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6014094232834212140}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3498508026980942921
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3239427835033733195}
m_CullTransparentMesh: 1
--- !u!114 &4172720891822695416
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3239427835033733195}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Name
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: 0
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 24
m_fontSizeBase: 24
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 1
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterHorizontalScale: 1
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_TextWrappingMode: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 0
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_EmojiFallbackSupport: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!114 &6787294827931527212
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3239427835033733195}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
m_IgnoreLayout: 0
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: 1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &3768236759226886124
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 437950331768363985}
- component: {fileID: 5606763019278455248}
- component: {fileID: 1019288287942172810}
m_Layer: 0
m_Name: Fill
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &437950331768363985
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3768236759226886124}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6266953780690568889}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5606763019278455248
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3768236759226886124}
m_CullTransparentMesh: 1
--- !u!114 &1019288287942172810
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3768236759226886124}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 3
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 0
m_FillAmount: 0.2
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &7442810364304304402
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6014094232834212140}
- component: {fileID: 1141587833647839303}
- component: {fileID: 8736413170534072599}
m_Layer: 0
m_Name: SkillRow
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6014094232834212140
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7442810364304304402}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7033684844244958404}
- {fileID: 4775921688302885094}
- {fileID: 6266953780690568889}
- {fileID: 4484942689062487776}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 48}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1141587833647839303
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7442810364304304402}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6ccda37aee7e42b09a0628f8a5729060, type: 3}
m_Name:
m_EditorClassIdentifier: NightclubArcadia.Skills::NightclubArcadia.Skills.SkillRowView
nameLabel: {fileID: 4172720891822695416}
rankLabel: {fileID: 6986784551111800944}
barFill: {fileID: 1019288287942172810}
accentStripe: {fileID: 7773152306665733045}
--- !u!114 &8736413170534072599
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7442810364304304402}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.HorizontalLayoutGroup
m_Padding:
m_Left: 8
m_Right: 8
m_Top: 4
m_Bottom: 4
m_ChildAlignment: 3
m_Spacing: 12
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 1
m_ChildControlHeight: 1
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e14f68d6a57ea4945bd93c44202db910
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1647a101742545fe8af6187e3a743858
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,81 @@
using Unity.Cinemachine;
using UnityEngine;
namespace NightclubArcadia.Cinematics
{
/// <summary>
/// Raises a reveal camera priority while the player is inside the volume.
/// </summary>
[RequireComponent(typeof(BoxCollider))]
public sealed class CameraFramingVolume : MonoBehaviour
{
[SerializeField] CinemachineCamera revealCamera;
[SerializeField] int activePriority = 20;
[SerializeField] float minDwell = 0.5f;
CameraStateDirector stateDirector;
int defaultPriority;
int occupants;
float exitTimer;
void Awake()
{
var box = GetComponent<BoxCollider>();
box.isTrigger = true;
if (revealCamera != null)
{
defaultPriority = revealCamera.Priority.Value;
}
stateDirector = FindFirstObjectByType<CameraStateDirector>();
}
void OnTriggerEnter(Collider other)
{
if (!other.CompareTag("Player") || revealCamera == null)
{
return;
}
occupants++;
exitTimer = 0f;
revealCamera.Priority.Value = activePriority;
stateDirector?.RegisterReveal();
}
void OnTriggerExit(Collider other)
{
if (!other.CompareTag("Player") || revealCamera == null)
{
return;
}
occupants = Mathf.Max(0, occupants - 1);
if (occupants == 0)
{
exitTimer = minDwell;
}
}
void Update()
{
if (occupants > 0 || revealCamera == null)
{
return;
}
if (exitTimer > 0f)
{
exitTimer -= Time.deltaTime;
return;
}
if (revealCamera.Priority.Value != defaultPriority)
{
revealCamera.Priority.Value = defaultPriority;
stateDirector?.UnregisterReveal();
}
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7cccc93b78eb84019b4524d65305612a
@@ -0,0 +1,162 @@
using NightclubArcadia.Player;
using NightclubArcadia.Player.Math;
using UnityEngine;
namespace NightclubArcadia.Cinematics
{
/// <summary>
/// Converts mouse drag-pan into CameraRigAnchor manual offset with recenter rules.
/// </summary>
public sealed class CameraPanInput : MonoBehaviour
{
[SerializeField] Camera brainCamera;
[SerializeField] CameraRigAnchor anchor;
[SerializeField] CameraStateDirector stateDirector;
[SerializeField] PlayerPointerInput pointerInput;
[SerializeField] float panMetresPerPixel = 0.02f;
[SerializeField] float maxPanDistance = 12f;
[SerializeField] float recenterDelay = 2.5f;
[SerializeField] float recenterSmoothTime = 0.8f;
[SerializeField] float movementRecenterDelay = 0.4f;
float releaseTimer = float.MaxValue;
Vector3 recenterVelocity;
Vector3 camRight;
Vector3 camForward;
bool basisInitialized;
public bool IsManualPanActive => pointerInput != null && pointerInput.IsPanning || releaseTimer < recenterDelay;
void Awake()
{
if (anchor == null)
{
anchor = GetComponent<CameraRigAnchor>();
}
if (stateDirector == null)
{
stateDirector = GetComponent<CameraStateDirector>();
}
if (brainCamera == null)
{
brainCamera = Camera.main;
}
}
void Start()
{
if (pointerInput == null)
{
var player = GameObject.FindGameObjectWithTag("Player");
if (player != null)
{
pointerInput = player.GetComponent<PlayerPointerInput>();
}
}
if (pointerInput != null)
{
pointerInput.PanDelta += OnPanDelta;
pointerInput.PanEnded += OnPanEnded;
}
}
void OnDestroy()
{
if (pointerInput != null)
{
pointerInput.PanDelta -= OnPanDelta;
pointerInput.PanEnded -= OnPanEnded;
}
}
void Update()
{
if (anchor == null || stateDirector == null)
{
return;
}
if (stateDirector.AllowsManualPan && pointerInput != null && pointerInput.IsPanning)
{
releaseTimer = 0f;
}
else if (releaseTimer < recenterDelay)
{
releaseTimer += Time.deltaTime;
}
if (ShouldShortenRecenter())
{
releaseTimer = Mathf.Max(releaseTimer, recenterDelay - movementRecenterDelay);
}
if (!stateDirector.AllowsManualPan)
{
return;
}
if (releaseTimer >= recenterDelay && (pointerInput == null || !pointerInput.IsPanning))
{
anchor.ManualPanOffset = Vector3.SmoothDamp(
anchor.ManualPanOffset,
Vector3.zero,
ref recenterVelocity,
recenterSmoothTime);
}
anchor.ClampManualPan(maxPanDistance);
}
void OnPanDelta(Vector2 delta)
{
if (stateDirector == null || !stateDirector.AllowsManualPan || anchor == null)
{
return;
}
EnsureCameraBasis();
anchor.Nudge(MotionInputMath.ScreenDeltaToWorldPan(delta, camRight, camForward, panMetresPerPixel));
anchor.ClampManualPan(maxPanDistance);
}
void OnPanEnded()
{
releaseTimer = 0f;
}
bool ShouldShortenRecenter()
{
var player = GameObject.FindGameObjectWithTag("Player");
if (player == null)
{
return false;
}
var arbiter = player.GetComponent<PlayerMotionArbiter>();
return arbiter != null && arbiter.ActiveSource != MotionSource.None;
}
void EnsureCameraBasis()
{
if (brainCamera == null)
{
brainCamera = Camera.main;
}
if (brainCamera == null)
{
return;
}
if (!basisInitialized)
{
camRight = brainCamera.transform.right;
camForward = brainCamera.transform.forward;
basisInitialized = true;
}
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f9b06ade88f2643a3b9f52a80e06081d
@@ -0,0 +1,31 @@
using UnityEngine;
namespace NightclubArcadia.Cinematics
{
/// <summary>
/// Marker on NPCs and props that the POI director may bias toward.
/// </summary>
public sealed class CameraPointOfInterest : MonoBehaviour
{
[SerializeField] float weight = 1f;
[SerializeField] float triggerRadius = 8f;
[SerializeField] float maxBias = 2.5f;
[SerializeField] float extraDistance = 1.5f;
public float Weight => weight;
public float TriggerRadius => triggerRadius;
public float MaxBias => maxBias;
public float ExtraDistance => extraDistance;
public Transform Target => transform;
void OnEnable()
{
CameraPointOfInterestDirector.Register(this);
}
void OnDisable()
{
CameraPointOfInterestDirector.Unregister(this);
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7862f80331f384d28b27600075971a77
@@ -0,0 +1,161 @@
using System.Collections.Generic;
using UnityEngine;
namespace NightclubArcadia.Cinematics
{
/// <summary>
/// Scores registered POIs and writes bias onto the camera anchor.
/// </summary>
public sealed class CameraPointOfInterestDirector : MonoBehaviour
{
static readonly List<CameraPointOfInterest> Registered = new List<CameraPointOfInterest>();
[SerializeField] CameraRigAnchor anchor;
[SerializeField] CameraStateDirector stateDirector;
[SerializeField] float poiSmoothTime = 1f;
[SerializeField] float poiReleaseTime = 1.4f;
[SerializeField] float maxHeadingAngle = 100f;
Vector3 poiVelocity;
float distanceVelocity;
CameraPointOfInterest activePoi;
public bool HasActivePoi => activePoi != null;
public static void Register(CameraPointOfInterest poi)
{
if (poi != null && !Registered.Contains(poi))
{
Registered.Add(poi);
}
}
public static void Unregister(CameraPointOfInterest poi)
{
Registered.Remove(poi);
}
void Awake()
{
if (anchor == null)
{
anchor = GetComponent<CameraRigAnchor>();
}
if (stateDirector == null)
{
stateDirector = GetComponent<CameraStateDirector>();
}
}
void LateUpdate()
{
if (anchor == null || stateDirector == null)
{
return;
}
var follow = anchor.FollowTarget;
if (follow == null)
{
return;
}
if (!stateDirector.AllowsPointOfInterest)
{
return;
}
if (stateDirector.Current == CameraState.ManualPan)
{
return;
}
activePoi = FindBestPoi(follow);
if (activePoi == null)
{
ReleasePoi();
return;
}
var toPoi = activePoi.Target.position - follow.position;
toPoi.y = 0f;
var targetBias = Vector3.ClampMagnitude(toPoi, activePoi.MaxBias);
anchor.PoiBias = Vector3.SmoothDamp(
anchor.PoiBias,
targetBias,
ref poiVelocity,
poiSmoothTime);
anchor.DistanceBias = Mathf.SmoothDamp(
anchor.DistanceBias,
activePoi.ExtraDistance,
ref distanceVelocity,
poiSmoothTime);
}
CameraPointOfInterest FindBestPoi(Transform follow)
{
CameraPointOfInterest best = null;
var bestScore = 0f;
var forward = follow.forward;
foreach (var poi in Registered)
{
if (poi == null || !poi.isActiveAndEnabled)
{
continue;
}
var offset = poi.Target.position - follow.position;
offset.y = 0f;
var distance = offset.magnitude;
if (distance > poi.TriggerRadius || distance <= 0.01f)
{
continue;
}
var angle = Vector3.Angle(forward, offset);
if (angle > maxHeadingAngle)
{
continue;
}
var score = poi.Weight * (1f - distance / poi.TriggerRadius);
if (score > bestScore)
{
bestScore = score;
best = poi;
}
}
return best;
}
void ReleasePoi()
{
if (anchor == null)
{
return;
}
anchor.PoiBias = Vector3.SmoothDamp(
anchor.PoiBias,
Vector3.zero,
ref poiVelocity,
poiReleaseTime);
anchor.DistanceBias = Mathf.SmoothDamp(
anchor.DistanceBias,
0f,
ref distanceVelocity,
poiReleaseTime);
if (anchor.PoiBias.sqrMagnitude < 0.0001f && Mathf.Abs(anchor.DistanceBias) < 0.01f)
{
activePoi = null;
}
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: e3343417e1de440f095b73e55c6977b6
@@ -0,0 +1,85 @@
using Unity.Cinemachine;
using UnityEngine;
namespace NightclubArcadia.Cinematics
{
/// <summary>
/// Proxy transform the follow camera tracks. Combines player follow,
/// POI bias, manual pan offset, and distance bias.
/// </summary>
public sealed class CameraRigAnchor : MonoBehaviour
{
[SerializeField] Transform followTarget;
[SerializeField] CinemachinePositionComposer composer;
[SerializeField] float followSmoothTime = 0.12f;
[SerializeField] float distanceSmoothTime = 0.8f;
float defaultCameraDistance = 10f;
float distanceVelocity;
Vector3 followVelocity;
public Vector3 PoiBias { get; set; }
public Vector3 ManualPanOffset { get; set; }
public float DistanceBias { get; set; }
public Transform FollowTarget => followTarget;
void Start()
{
if (composer == null)
{
composer = FindFirstObjectByType<CinemachinePositionComposer>();
}
if (composer != null)
{
defaultCameraDistance = composer.CameraDistance;
}
}
void LateUpdate()
{
if (followTarget == null)
{
return;
}
var targetPosition = followTarget.position + PoiBias + ManualPanOffset;
transform.position = Vector3.SmoothDamp(
transform.position,
targetPosition,
ref followVelocity,
followSmoothTime);
if (composer != null)
{
var targetDistance = defaultCameraDistance + DistanceBias;
composer.CameraDistance = Mathf.SmoothDamp(
composer.CameraDistance,
targetDistance,
ref distanceVelocity,
distanceSmoothTime);
}
}
public void Nudge(Vector3 worldDelta)
{
ManualPanOffset += worldDelta;
}
public void ClampManualPan(float maxDistance)
{
if (followTarget == null)
{
return;
}
var offset = ManualPanOffset;
offset.y = 0f;
if (offset.magnitude > maxDistance)
{
ManualPanOffset = offset.normalized * maxDistance;
}
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 16d6717a3703a4bb3a8c3bb0bb0392de
@@ -0,0 +1,135 @@
using NightclubArcadia.UI;
using UnityEngine;
namespace NightclubArcadia.Cinematics
{
public enum CameraState
{
Follow,
ManualPan,
PointOfInterest,
Reveal,
Dialogue,
Menu
}
/// <summary>
/// Resolves which camera subsystem may write each frame.
/// </summary>
public sealed class CameraStateDirector : MonoBehaviour
{
[SerializeField] CameraRigAnchor anchor;
[SerializeField] float dialogueRecenterTime = 0.5f;
int activeRevealCount;
float dialogueRecenterTimer;
bool wasDialogueActive;
bool wasMenuOpen;
public CameraState Current { get; private set; } = CameraState.Follow;
public bool AllowsManualPan =>
Current != CameraState.Dialogue
&& Current != CameraState.Menu
&& Current != CameraState.Reveal;
public bool AllowsPointOfInterest =>
Current == CameraState.Follow || Current == CameraState.PointOfInterest;
void Awake()
{
if (anchor == null)
{
anchor = GetComponent<CameraRigAnchor>();
}
}
void Start()
{
if (UIStateController.Instance != null)
{
UIStateController.Instance.StateChanged += OnUiStateChanged;
}
ResolveState(false);
}
void OnDestroy()
{
if (UIStateController.Instance != null)
{
UIStateController.Instance.StateChanged -= OnUiStateChanged;
}
}
void Update()
{
ResolveState(true);
if (Current == CameraState.Dialogue && anchor != null)
{
dialogueRecenterTimer += Time.deltaTime;
var t = Mathf.Clamp01(dialogueRecenterTimer / dialogueRecenterTime);
anchor.ManualPanOffset = Vector3.Lerp(anchor.ManualPanOffset, Vector3.zero, t);
}
}
void OnUiStateChanged() => ResolveState(true);
public void RegisterReveal() => activeRevealCount++;
public void UnregisterReveal() => activeRevealCount = Mathf.Max(0, activeRevealCount - 1);
void ResolveState(bool allowManualPanPromotion)
{
var ui = UIStateController.Instance;
var menuOpen = ui != null && ui.IsMenuOpen;
var dialogueActive = ui != null && ui.IsDialogueActive;
if (menuOpen)
{
Current = CameraState.Menu;
}
else if (dialogueActive)
{
if (!wasDialogueActive)
{
dialogueRecenterTimer = 0f;
}
Current = CameraState.Dialogue;
}
else if (activeRevealCount > 0)
{
Current = CameraState.Reveal;
}
else if (allowManualPanPromotion && IsManualPanActive())
{
Current = CameraState.ManualPan;
}
else if (HasActivePointOfInterest())
{
Current = CameraState.PointOfInterest;
}
else
{
Current = CameraState.Follow;
}
wasDialogueActive = dialogueActive;
wasMenuOpen = menuOpen;
}
bool IsManualPanActive()
{
var pan = GetComponent<CameraPanInput>();
return pan != null && pan.IsManualPanActive;
}
bool HasActivePointOfInterest()
{
var director = GetComponent<CameraPointOfInterestDirector>();
return director != null && director.HasActivePoi;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ca0160e4d996040238dab18725a2e844
@@ -0,0 +1,72 @@
using NightclubArcadia.UI;
using Unity.Cinemachine;
using UnityEngine;
namespace NightclubArcadia.Cinematics
{
/// <summary>
/// Shifts CinemachinePositionComposer.Composition.ScreenPosition so the
/// player is centred in the screen space left of the dialogue panel.
/// </summary>
public sealed class DialogueCameraFraming : MonoBehaviour
{
[SerializeField] CinemachinePositionComposer composer;
[SerializeField] float dialogueScreenX = -0.17f;
[SerializeField] bool suppressDeadZoneXInDialogue = true;
float defaultDeadZoneX = 0.2f;
void Start()
{
if (composer == null)
{
composer = FindFirstObjectByType<CinemachinePositionComposer>();
}
if (composer != null)
{
defaultDeadZoneX = composer.Composition.DeadZone.Size.x;
}
if (UIStateController.Instance != null)
{
UIStateController.Instance.StateChanged += OnStateChanged;
}
ApplyFraming();
}
void OnDestroy()
{
if (UIStateController.Instance != null)
{
UIStateController.Instance.StateChanged -= OnStateChanged;
}
}
void OnStateChanged() => ApplyFraming();
void ApplyFraming()
{
if (composer == null)
{
return;
}
var active = UIStateController.Instance != null && UIStateController.Instance.IsDialogueActive;
var target = active ? dialogueScreenX : 0f;
var composition = composer.Composition;
composition.ScreenPosition = new Vector2(target, composition.ScreenPosition.y);
if (suppressDeadZoneXInDialogue)
{
var size = composition.DeadZone.Size;
size.x = active ? 0f : defaultDeadZoneX;
composition.DeadZone.Size = size;
}
composer.Composition = composition;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 56142a5f8795401498df8e01dc74b258
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,4 +1,5 @@
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem;
using Yarn.Unity; using Yarn.Unity;
namespace NightclubArcadia.Dialogue namespace NightclubArcadia.Dialogue
@@ -14,25 +15,39 @@ namespace NightclubArcadia.Dialogue
[SerializeField] private GameObject dialogueUI; [SerializeField] private GameObject dialogueUI;
[SerializeField] private string yarnNodeName = "Bartender_Chat"; [SerializeField] private string yarnNodeName = "Bartender_Chat";
private bool playerInRange = false; private bool playerInRange;
private InputAction interactAction;
void Awake()
{
interactAction = new InputAction("Interact");
interactAction.AddBinding("<Keyboard>/e");
interactAction.AddBinding("<Gamepad>/buttonNorth");
interactAction.performed += _ =>
{
if (playerInRange)
{
StartConversation();
}
};
}
void OnEnable() => interactAction?.Enable();
void OnDisable() => interactAction?.Disable();
void OnTriggerEnter(Collider other) void OnTriggerEnter(Collider other)
{ {
if (other.CompareTag("Player")) if (other.CompareTag("Player"))
{
playerInRange = true; playerInRange = true;
}
} }
void OnTriggerExit(Collider other) void OnTriggerExit(Collider other)
{ {
if (other.CompareTag("Player")) if (other.CompareTag("Player"))
playerInRange = false;
}
void Update()
{
if (playerInRange && Input.GetKeyDown(KeyCode.E))
{ {
StartConversation(); playerInRange = false;
} }
} }
@@ -1,4 +1,4 @@
using StarterAssets; using NightclubArcadia.UI;
using UnityEngine; using UnityEngine;
using Yarn.Unity; using Yarn.Unity;
@@ -7,33 +7,27 @@ namespace NightclubArcadia.Dialogue
/// <summary> /// <summary>
/// Owns the hand-off between dialogue and the 3D environment: locks the /// Owns the hand-off between dialogue and the 3D environment: locks the
/// player's controls for as long as a conversation is running, and registers /// player's controls for as long as a conversation is running, and registers
/// the <<enter_environment>> Yarn command that hands control back. /// the &lt;&lt;enter_environment&gt;&gt; Yarn command that hands control back.
/// ///
/// The lock is driven by the DialogueRunner's own lifecycle events rather /// The lock is driven by the DialogueRunner's own lifecycle events rather
/// than by each interactable, so every entry point — auto-started nodes, /// than by each interactable, so every entry point — auto-started nodes,
/// NPCStandIn, DialogueInteractable — gets the same behaviour without /// NPCStandIn, DialogueInteractable — gets the same behaviour without
/// having to remember to do it. /// having to remember to do it. Control locking is delegated to
/// <see cref="PlayerControlLock"/> so the player menu can hold a second
/// independent lock without re-enabling movement mid-conversation.
/// </summary> /// </summary>
public class DialogueTransitionController : MonoBehaviour public class DialogueTransitionController : MonoBehaviour
{ {
[SerializeField] private DialogueRunner dialogueRunner; [SerializeField] private DialogueRunner dialogueRunner;
[SerializeField] private GameObject dialogueUI; [SerializeField] private GameObject dialogueUI;
[SerializeField] private GameObject playerArmature; [SerializeField] private GameObject playerArmature;
[SerializeField] private PlayerControlLock controlLock;
private ThirdPersonController playerController;
private StarterAssetsInputs playerInputs;
private Animator playerAnimator;
static readonly int AnimIDSpeed = Animator.StringToHash("Speed");
static readonly int AnimIDMotionSpeed = Animator.StringToHash("MotionSpeed");
void Awake() void Awake()
{ {
if (playerArmature != null) if (controlLock == null && playerArmature != null)
{ {
playerController = playerArmature.GetComponent<ThirdPersonController>(); controlLock = playerArmature.GetComponent<PlayerControlLock>();
playerInputs = playerArmature.GetComponent<StarterAssetsInputs>();
playerAnimator = playerArmature.GetComponent<Animator>();
} }
// Subscribed in Awake rather than Start: the runner auto-starts its // Subscribed in Awake rather than Start: the runner auto-starts its
@@ -45,11 +39,16 @@ namespace NightclubArcadia.Dialogue
void Start() void Start()
{ {
if (controlLock == null && playerArmature != null)
{
controlLock = playerArmature.GetComponent<PlayerControlLock>();
}
// Dialogue is in progress as soon as this controller is active // Dialogue is in progress as soon as this controller is active
// (including auto-started nodes), so the player stays locked out // (including auto-started nodes), so the player stays locked out
// until <<enter_environment>>. The armature itself stays // until <<enter_environment>>. The armature itself stays
// active/visible — only its controls are disabled. // active/visible — only its controls are disabled.
SetPlayerControlEnabled(false); controlLock?.Acquire(this);
dialogueRunner.AddCommandHandler("enter_environment", EnterEnvironment); dialogueRunner.AddCommandHandler("enter_environment", EnterEnvironment);
} }
@@ -63,7 +62,8 @@ namespace NightclubArcadia.Dialogue
void OnDialogueStart() void OnDialogueStart()
{ {
DialogueUIVisibility.Show(dialogueUI); DialogueUIVisibility.Show(dialogueUI);
SetPlayerControlEnabled(false); UIStateController.Instance?.SetDialogueActive(true);
controlLock?.Acquire(this);
} }
// Safety net: a node that ends without <<enter_environment>> must still // Safety net: a node that ends without <<enter_environment>> must still
@@ -74,40 +74,12 @@ namespace NightclubArcadia.Dialogue
{ {
// Hide, don't deactivate: deactivating the Canvas breaks TMP's // Hide, don't deactivate: deactivating the Canvas breaks TMP's
// cached Canvas reference and makes the next conversation throw. // cached Canvas reference and makes the next conversation throw.
// See DialogueUIVisibility. // See DialogueUIVisibility / PanelVisibility.
DialogueUIVisibility.Hide(dialogueUI); DialogueUIVisibility.Hide(dialogueUI);
SetPlayerControlEnabled(true); UIStateController.Instance?.SetDialogueActive(false);
} // Release is idempotent on a HashSet — safe when both
// <<enter_environment>> and onDialogueComplete fire.
void SetPlayerControlEnabled(bool value) controlLock?.Release(this);
{
if (playerController == null)
{
return;
}
if (!value)
{
// Clear pending input and the locomotion blend before freezing
// the controller. Disabling it mid-stride otherwise leaves
// Speed at its last value, and the character keeps running on
// the spot for the whole conversation.
if (playerInputs != null)
{
playerInputs.MoveInput(Vector2.zero);
playerInputs.LookInput(Vector2.zero);
playerInputs.SprintInput(false);
playerInputs.JumpInput(false);
}
if (playerAnimator != null)
{
playerAnimator.SetFloat(AnimIDSpeed, 0f);
playerAnimator.SetFloat(AnimIDMotionSpeed, 0f);
}
}
playerController.enabled = value;
} }
} }
} }
@@ -1,23 +1,13 @@
using NightclubArcadia.UI;
using UnityEngine; using UnityEngine;
namespace NightclubArcadia.Dialogue namespace NightclubArcadia.Dialogue
{ {
/// <summary> /// <summary>
/// Shows and hides the dialogue UI *without* deactivating its GameObject. /// Shows and hides the dialogue UI *without* deactivating its GameObject.
/// /// Forwards to <see cref="PanelVisibility"/> — kept as a thin wrapper so
/// SetActive(false) is not a safe way to hide this UI. TextMeshProUGUI /// existing call sites (NPCStandIn, DialogueInteractable,
/// resolves its Canvas through Graphic.CacheCanvas, which calls /// DialogueTransitionController) continue to compile unchanged.
/// GetComponentsInParent(includeInactive: false) and then requires
/// canvas.isActiveAndEnabled. Once the Canvas GameObject has been
/// deactivated, that lookup yields null, and TMP.GetTextInfo does:
///
/// if (m_canvas == null) m_canvas = this.canvas; // still null
/// GenerateTextMesh(); // m_canvas.worldCamera -> NRE
///
/// GenerateTextMesh dereferences m_canvas unguarded, so the very next line
/// Yarn tries to type throws NullReferenceException. Keeping the hierarchy
/// active and driving a CanvasGroup instead means the cached Canvas
/// reference stays valid across any number of enter/exit dialogue cycles.
/// </summary> /// </summary>
public static class DialogueUIVisibility public static class DialogueUIVisibility
{ {
@@ -27,41 +17,12 @@ namespace NightclubArcadia.Dialogue
/// case the caller must wait one frame before rendering text so that /// case the caller must wait one frame before rendering text so that
/// TMP's OnEnable can re-cache its Canvas. /// TMP's OnEnable can re-cache its Canvas.
/// </summary> /// </summary>
public static bool Show(GameObject dialogueUI) => SetVisible(dialogueUI, true); public static bool Show(GameObject dialogueUI) => PanelVisibility.Show(dialogueUI);
/// <summary> /// <summary>
/// Hides the dialogue UI, leaving the hierarchy active. See class docs. /// Hides the dialogue UI, leaving the hierarchy active. See
/// <see cref="PanelVisibility"/>.
/// </summary> /// </summary>
public static void Hide(GameObject dialogueUI) => SetVisible(dialogueUI, false); public static void Hide(GameObject dialogueUI) => PanelVisibility.Hide(dialogueUI);
static bool SetVisible(GameObject dialogueUI, bool visible)
{
if (dialogueUI == null)
{
return false;
}
// The UI may still be deactivated by an older saved scene state or
// by code that predates this helper. Recover from that, and tell
// the caller a frame of grace is needed.
var wasReactivated = false;
if (!dialogueUI.activeSelf)
{
dialogueUI.SetActive(true);
wasReactivated = true;
}
var group = dialogueUI.GetComponent<CanvasGroup>();
if (group == null)
{
group = dialogueUI.AddComponent<CanvasGroup>();
}
group.alpha = visible ? 1f : 0f;
group.interactable = visible;
group.blocksRaycasts = visible;
return wasReactivated;
}
} }
} }
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 97642050992484049b6c021481f2baf2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,29 @@
using UnityEngine;
namespace NightclubArcadia.Interaction
{
/// <summary>
/// Adapts NPCStandIn to the click-to-interact pipeline without modifying
/// the existing proximity + keypress path.
/// </summary>
public sealed class ClickInteractableBridge : MonoBehaviour, IClickInteractable
{
[SerializeField] NPCStandIn npc;
public Transform ApproachPoint => transform;
public float ApproachRadius => npc != null ? Mathf.Max(0.15f, npc.interactionRange - 0.5f) : 0.15f;
void Awake()
{
if (npc == null)
{
npc = GetComponent<NPCStandIn>();
}
}
public void OnApproached()
{
npc?.Interact();
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5257f07d188de44eb9a04ba4d3a65fec
@@ -0,0 +1,11 @@
using UnityEngine;
namespace NightclubArcadia.Interaction
{
public interface IClickInteractable
{
Transform ApproachPoint { get; }
float ApproachRadius { get; }
void OnApproached();
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4812c7fb9cf2d41c28966640827dd0c8
@@ -3,6 +3,7 @@ using UnityEngine.InputSystem;
using TMPro; using TMPro;
using Yarn.Unity; using Yarn.Unity;
using NightclubArcadia.Dialogue; using NightclubArcadia.Dialogue;
using NightclubArcadia.UI;
/// <summary> /// <summary>
/// Drop this on a sphere primitive to use it as a placeholder NPC: /// Drop this on a sphere primitive to use it as a placeholder NPC:
@@ -153,6 +154,11 @@ public class NPCStandIn : MonoBehaviour
return; return;
} }
if (UIStateController.Instance != null && UIStateController.Instance.IsMenuOpen)
{
return;
}
if (!dialogueRunner.IsDialogueRunning) if (!dialogueRunner.IsDialogueRunning)
{ {
StartDialogueAsync(); StartDialogueAsync();
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 381786de30b3e49e7a693028cc2127f5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,234 @@
using System;
using NightclubArcadia.Interaction;
using NightclubArcadia.Player.Math;
using StarterAssets;
using UnityEngine;
using UnityEngine.AI;
namespace NightclubArcadia.Player
{
/// <summary>
/// NavMeshAgent in oracle mode: computes desired move input for the arbiter
/// without moving the CharacterController directly.
/// </summary>
[DefaultExecutionOrder(-60)]
[RequireComponent(typeof(NavMeshAgent))]
public sealed class ClickToMoveController : MonoBehaviour
{
const float SampleRadius = 1.5f;
const float StallWindow = 0.4f;
const float StallDistance = 0.05f;
[SerializeField] Camera brainCamera;
NavMeshAgent agent;
ThirdPersonController locomotion;
IClickInteractable pendingInteractable;
bool forceRunForPath;
[SerializeField] float runDistanceThreshold = 6f;
Vector3 lastPosition;
float stallTimer;
bool hasPath;
public bool HasPath => hasPath;
public Vector3 Destination { get; private set; }
public Vector2 DesiredMoveInput { get; private set; }
public float RemainingDistance => agent != null ? agent.remainingDistance : 0f;
public bool WantsSprint => hasPath && (forceRunForPath || agent.remainingDistance > runDistanceThreshold);
public event Action<bool> PathFinished;
public event Action RunRequested;
void Awake()
{
agent = GetComponent<NavMeshAgent>();
locomotion = GetComponent<ThirdPersonController>();
agent.updatePosition = false;
agent.updateRotation = false;
agent.updateUpAxis = false;
agent.angularSpeed = 0f;
agent.acceleration = 1000f;
agent.autoBraking = true;
agent.stoppingDistance = 0.15f;
agent.radius = 0.3f;
agent.height = 1.8f;
if (brainCamera == null)
{
brainCamera = Camera.main;
}
SyncAgentSpeed(false);
}
void Update()
{
if (!hasPath)
{
DesiredMoveInput = Vector2.zero;
return;
}
SyncAgentSpeed(forceRunForPath || agent.remainingDistance > runDistanceThreshold);
if (brainCamera == null)
{
brainCamera = Camera.main;
}
var cameraYaw = brainCamera != null ? brainCamera.transform.eulerAngles.y : 0f;
DesiredMoveInput = MotionInputMath.WorldToCameraRelativeInput(
agent.desiredVelocity,
agent.speed,
cameraYaw);
CheckStall();
CheckArrival();
}
void LateUpdate()
{
if (agent != null)
{
agent.nextPosition = transform.position;
}
}
public void RequestRun()
{
forceRunForPath = true;
RunRequested?.Invoke();
}
public bool SetDestination(Vector3 worldPoint)
{
pendingInteractable = null;
if (!TrySampleNavMesh(worldPoint, out var hit))
{
return false;
}
agent.stoppingDistance = 0.15f;
agent.isStopped = false;
agent.SetDestination(hit.position);
Destination = hit.position;
hasPath = true;
ResetStallTracking();
return true;
}
public bool SetInteractionTarget(IClickInteractable interactable)
{
if (interactable == null || interactable.ApproachPoint == null)
{
return false;
}
pendingInteractable = interactable;
var approach = interactable.ApproachPoint.position;
if (!TrySampleNavMesh(approach, out var hit))
{
pendingInteractable = null;
return false;
}
agent.stoppingDistance = Mathf.Max(0.15f, interactable.ApproachRadius);
agent.isStopped = false;
agent.SetDestination(hit.position);
Destination = hit.position;
hasPath = true;
ResetStallTracking();
return true;
}
public void Cancel()
{
if (agent != null)
{
agent.ResetPath();
agent.isStopped = true;
}
hasPath = false;
forceRunForPath = false;
pendingInteractable = null;
DesiredMoveInput = Vector2.zero;
ResetStallTracking();
}
bool TrySampleNavMesh(Vector3 point, out NavMeshHit hit)
{
return NavMesh.SamplePosition(point, out hit, SampleRadius, NavMesh.AllAreas);
}
void CheckArrival()
{
if (!hasPath || agent.pathPending)
{
return;
}
if (agent.remainingDistance > agent.stoppingDistance)
{
return;
}
var success = agent.pathStatus != NavMeshPathStatus.PathInvalid;
hasPath = false;
agent.ResetPath();
var interactable = pendingInteractable;
pendingInteractable = null;
PathFinished?.Invoke(success);
if (success && interactable != null)
{
interactable.OnApproached();
}
}
void CheckStall()
{
var displacement = Vector3.Distance(
new Vector3(transform.position.x, 0f, transform.position.z),
new Vector3(lastPosition.x, 0f, lastPosition.z));
if (displacement < StallDistance)
{
stallTimer += Time.deltaTime;
}
else
{
stallTimer = 0f;
lastPosition = transform.position;
}
if (stallTimer >= StallWindow && agent.remainingDistance > agent.stoppingDistance)
{
Cancel();
PathFinished?.Invoke(false);
}
}
void ResetStallTracking()
{
lastPosition = transform.position;
stallTimer = 0f;
}
void SyncAgentSpeed(bool sprint)
{
if (locomotion == null)
{
return;
}
agent.speed = sprint ? locomotion.SprintSpeed : locomotion.MoveSpeed;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c2762b30721644611b9672bd4781cf15
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c32faf711a4044ed88ff1be2790915f7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,42 @@
using UnityEngine;
namespace NightclubArcadia.Player.Math
{
/// <summary>
/// Pure math helpers shared by click-to-move and camera pan.
/// </summary>
public static class MotionInputMath
{
/// <summary>
/// Converts a NavMeshAgent desired velocity into the camera-relative
/// Vector2 that ThirdPersonController expects on StarterAssetsInputs.move.
/// </summary>
public static Vector2 WorldToCameraRelativeInput(Vector3 worldVelocity, float agentSpeed, float cameraYaw)
{
if (worldVelocity.sqrMagnitude < 0.0001f || agentSpeed <= 0f)
{
return Vector2.zero;
}
var horizontal = new Vector3(worldVelocity.x, 0f, worldVelocity.z);
var magnitude = horizontal.magnitude;
var fraction = Mathf.Clamp01(magnitude / agentSpeed);
var local = Quaternion.Euler(0f, -cameraYaw, 0f) * horizontal.normalized;
return new Vector2(local.x, local.z) * fraction;
}
/// <summary>
/// Converts screen-space pointer delta into a world-plane pan offset.
/// Drag direction is inverted so the world follows the cursor.
/// </summary>
public static Vector3 ScreenDeltaToWorldPan(
Vector2 pixelDelta,
Vector3 camRight,
Vector3 camForward,
float metresPerPixel)
{
var forward = Vector3.ProjectOnPlane(camForward, Vector3.up).normalized;
return (-pixelDelta.x * camRight + -pixelDelta.y * forward) * metresPerPixel;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9af00d68e15e24c02811500cdf0dd2d4
@@ -0,0 +1,14 @@
{
"name": "NightclubArcadia.Locomotion.Math",
"rootNamespace": "NightclubArcadia.Player.Math",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 12491a5edc87346d28ffc48f9ab6562c
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,114 @@
using NightclubArcadia.Interaction;
using NightclubArcadia.UI;
using StarterAssets;
using UnityEngine;
#if ENABLE_INPUT_SYSTEM
using UnityEngine.InputSystem;
#endif
namespace NightclubArcadia.Player
{
public enum MotionSource
{
None,
Direct,
Navigation
}
/// <summary>
/// Sole writer of StarterAssetsInputs move/sprint. Picks one input source
/// per frame: direct keyboard/gamepad or click-to-move navigation.
/// </summary>
[DefaultExecutionOrder(-50)]
public sealed class PlayerMotionArbiter : MonoBehaviour
{
[SerializeField] float directInputCancelThreshold = 0.15f;
[SerializeField] float runDistanceThreshold = 6f;
StarterAssetsInputs playerInputs;
PlayerControlLock controlLock;
ClickToMoveController clickToMove;
#if ENABLE_INPUT_SYSTEM
PlayerInput playerInput;
#endif
public MotionSource ActiveSource { get; private set; }
void Awake()
{
playerInputs = GetComponent<StarterAssetsInputs>();
controlLock = GetComponent<PlayerControlLock>();
clickToMove = GetComponent<ClickToMoveController>();
#if ENABLE_INPUT_SYSTEM
playerInput = GetComponent<PlayerInput>();
#endif
}
public void ResetState()
{
ActiveSource = MotionSource.None;
clickToMove?.Cancel();
WriteInput(Vector2.zero, false);
}
void Update()
{
if (controlLock != null && controlLock.IsLocked)
{
clickToMove?.Cancel();
ActiveSource = MotionSource.None;
WriteInput(Vector2.zero, false);
return;
}
#if ENABLE_INPUT_SYSTEM
var raw = playerInput.actions["Move"].ReadValue<Vector2>();
#else
var raw = Vector2.zero;
#endif
if (raw.sqrMagnitude > directInputCancelThreshold * directInputCancelThreshold)
{
clickToMove?.Cancel();
ActiveSource = MotionSource.Direct;
WriteInput(raw, ReadDirectSprint());
return;
}
if (clickToMove != null && clickToMove.HasPath)
{
ActiveSource = MotionSource.Navigation;
WriteInput(clickToMove.DesiredMoveInput, ShouldNavigationSprint());
return;
}
ActiveSource = MotionSource.None;
WriteInput(Vector2.zero, false);
}
bool ReadDirectSprint()
{
#if ENABLE_INPUT_SYSTEM
return playerInput.actions["Sprint"].IsPressed();
#else
return false;
#endif
}
bool ShouldNavigationSprint()
{
return clickToMove != null && clickToMove.WantsSprint;
}
void WriteInput(Vector2 move, bool sprint)
{
if (playerInputs == null)
{
return;
}
playerInputs.MoveInput(move);
playerInputs.SprintInput(sprint);
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 91bf24256c6694185b4247a736593727
@@ -0,0 +1,61 @@
using System;
using UnityEngine;
#if ENABLE_INPUT_SYSTEM
using UnityEngine.InputSystem;
#endif
namespace NightclubArcadia.Player
{
/// <summary>
/// Receives pointer and camera-pan SendMessages from PlayerInput and
/// exposes them as C# events for navigation and camera systems.
/// </summary>
[DefaultExecutionOrder(-100)]
public sealed class PlayerPointerInput : MonoBehaviour
{
public Vector2 ScreenPosition { get; private set; }
public bool IsPanning { get; private set; }
public event Action Clicked;
public event Action PanStarted;
public event Action<Vector2> PanDelta;
public event Action PanEnded;
#if ENABLE_INPUT_SYSTEM
void OnPoint(InputValue value)
{
ScreenPosition = value.Get<Vector2>();
}
void OnClick(InputValue value)
{
if (value.isPressed)
{
Clicked?.Invoke();
}
}
void OnCameraPan(InputValue value)
{
if (value.isPressed && !IsPanning)
{
IsPanning = true;
PanStarted?.Invoke();
}
else if (!value.isPressed && IsPanning)
{
IsPanning = false;
PanEnded?.Invoke();
}
}
void OnPointerDelta(InputValue value)
{
if (IsPanning)
{
PanDelta?.Invoke(value.Get<Vector2>());
}
}
#endif
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ff77faf7e79154095ad57ad50df8c605
@@ -0,0 +1,203 @@
using System;
using NightclubArcadia.Interaction;
using NightclubArcadia.UI;
using UnityEngine;
using UnityEngine.EventSystems;
namespace NightclubArcadia.Player
{
/// <summary>
/// Converts pointer clicks into click-to-move destinations or interactable
/// approach targets.
/// </summary>
public sealed class PointerNavigationInput : MonoBehaviour
{
const float DoubleClickWindow = 0.35f;
const float DoubleClickPixelThreshold = 40f;
[SerializeField] Camera brainCamera;
[SerializeField] LayerMask clickMask = ~0;
[SerializeField] PlayerPointerInput pointerInput;
[SerializeField] ClickToMoveController clickToMove;
[SerializeField] PlayerMotionArbiter motionArbiter;
float lastClickTime = -1f;
Vector2 lastClickPosition;
bool pendingClick;
Vector2 pendingClickPosition;
void Awake()
{
if (pointerInput == null)
{
pointerInput = GetComponent<PlayerPointerInput>();
}
if (clickToMove == null)
{
clickToMove = GetComponent<ClickToMoveController>();
}
if (motionArbiter == null)
{
motionArbiter = GetComponent<PlayerMotionArbiter>();
}
if (brainCamera == null)
{
brainCamera = Camera.main;
}
if (clickMask.value == ~0)
{
clickMask = LayerMask.GetMask("Default", "Ground", "Interactable");
}
}
void OnEnable()
{
if (pointerInput != null)
{
pointerInput.Clicked += OnClicked;
}
}
void OnDisable()
{
if (pointerInput != null)
{
pointerInput.Clicked -= OnClicked;
}
pendingClick = false;
}
// Input System callbacks fire during event processing, where
// IsPointerOverGameObject() is invalid (queries last frame's UI).
// Queue the click and resolve it in Update instead.
void OnClicked()
{
if (pointerInput == null)
{
return;
}
pendingClick = true;
pendingClickPosition = pointerInput.ScreenPosition;
}
void Update()
{
if (!pendingClick)
{
return;
}
pendingClick = false;
ProcessClick(pendingClickPosition);
}
void ProcessClick(Vector2 screenPos)
{
if (!CanNavigate())
{
return;
}
if (EventSystem.current != null && EventSystem.current.IsPointerOverGameObject())
{
return;
}
if (brainCamera == null)
{
brainCamera = Camera.main;
}
if (brainCamera == null || clickToMove == null)
{
return;
}
var ray = brainCamera.ScreenPointToRay(screenPos);
var hits = Physics.RaycastAll(ray, 200f, clickMask, QueryTriggerInteraction.Collide);
Array.Sort(hits, (a, b) => a.distance.CompareTo(b.distance));
var isDoubleClick = IsDoubleClick(screenPos);
lastClickTime = Time.unscaledTime;
lastClickPosition = screenPos;
foreach (var hit in hits)
{
var interactable = FindInteractable(hit.collider);
if (interactable != null)
{
if (isDoubleClick)
{
clickToMove.RequestRun();
}
if (clickToMove.SetInteractionTarget(interactable))
{
return;
}
}
}
foreach (var hit in hits)
{
if (isDoubleClick)
{
clickToMove.RequestRun();
}
if (clickToMove.SetDestination(hit.point))
{
return;
}
}
}
bool CanNavigate()
{
if (GetComponent<PlayerControlLock>() is { IsLocked: true })
{
return false;
}
if (UIStateController.Instance == null)
{
return true;
}
return !UIStateController.Instance.IsDialogueActive
&& !UIStateController.Instance.IsMenuOpen;
}
bool IsDoubleClick(Vector2 screenPos)
{
if (lastClickTime < 0f)
{
return false;
}
var withinTime = Time.unscaledTime - lastClickTime <= DoubleClickWindow;
var withinDistance = Vector2.Distance(screenPos, lastClickPosition) <= DoubleClickPixelThreshold;
return withinTime && withinDistance;
}
static IClickInteractable FindInteractable(Collider collider)
{
var behaviours = collider.GetComponentsInParent<MonoBehaviour>();
foreach (var behaviour in behaviours)
{
if (behaviour is IClickInteractable interactable)
{
return interactable;
}
}
return null;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5f62460e35fda4829bd6ffeffe633a7e
@@ -3,7 +3,8 @@
"rootNamespace": "NightclubArcadia.Skills", "rootNamespace": "NightclubArcadia.Skills",
"references": [ "references": [
"YarnSpinner.Unity", "YarnSpinner.Unity",
"Unity.TextMeshPro" "Unity.TextMeshPro",
"UnityEngine.UI"
], ],
"includePlatforms": [], "includePlatforms": [],
"excludePlatforms": [], "excludePlatforms": [],
@@ -0,0 +1,50 @@
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace NightclubArcadia.Skills
{
/// <summary>
/// One skill row: name, numeric rank, and accent-tinted fill bar.
/// </summary>
public sealed class SkillRowView : MonoBehaviour
{
[SerializeField] TMP_Text nameLabel;
[SerializeField] TMP_Text rankLabel;
[SerializeField] Image barFill;
[SerializeField] Image accentStripe;
public void Bind(SkillDefinition def, int rank, int displayMaxRank)
{
if (def == null)
{
return;
}
if (nameLabel != null)
{
nameLabel.text = string.IsNullOrEmpty(def.DisplayName)
? def.Id.ToUpperInvariant()
: def.DisplayName;
nameLabel.color = def.AccentColor;
}
if (rankLabel != null)
{
rankLabel.text = rank.ToString();
}
if (barFill != null)
{
var max = Mathf.Max(1, displayMaxRank);
barFill.fillAmount = Mathf.Clamp01(rank / (float)max);
barFill.color = def.AccentColor;
}
if (accentStripe != null)
{
accentStripe.color = def.AccentColor;
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6ccda37aee7e42b09a0628f8a5729060
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,88 @@
using System.Collections.Generic;
using TMPro;
using UnityEngine;
namespace NightclubArcadia.Skills
{
/// <summary>
/// Skills tab content. Rebuilds the list from SkillDatabase.All +
/// PlayerSkills.GetRank on each show. No change event on PlayerSkills —
/// refresh on show is deliberate (menu is modal; ranks cannot change while open).
/// </summary>
public sealed class SkillsPanelView : MonoBehaviour
{
[SerializeField] RectTransform contentRoot;
[SerializeField] SkillRowView rowPrefab;
[SerializeField] TMP_Text axisHeaderPrefab;
[SerializeField] int displayMaxRank = 6;
readonly List<GameObject> spawned = new List<GameObject>();
/// <summary>
/// Wired from MenuTabBar TabEntry.onShown in the Inspector.
/// </summary>
public void Refresh()
{
Clear();
var runtime = SkillRuntime.Instance;
if (runtime == null || runtime.Database == null || runtime.Skills == null)
{
return;
}
if (contentRoot == null || rowPrefab == null)
{
Debug.LogWarning($"[{nameof(SkillsPanelView)}] Missing contentRoot or rowPrefab.", this);
return;
}
SkillAxis? currentAxis = null;
foreach (var def in runtime.Database.All)
{
if (def == null || string.IsNullOrEmpty(def.Id))
{
continue;
}
if (currentAxis == null || currentAxis.Value != def.Axis)
{
currentAxis = def.Axis;
SpawnAxisHeader(def.Axis);
}
var rank = runtime.Skills.GetRank(def.Id);
var row = Instantiate(rowPrefab, contentRoot);
row.gameObject.SetActive(true);
row.Bind(def, rank, displayMaxRank);
spawned.Add(row.gameObject);
}
}
void SpawnAxisHeader(SkillAxis axis)
{
if (axisHeaderPrefab == null)
{
return;
}
var header = Instantiate(axisHeaderPrefab, contentRoot);
header.gameObject.SetActive(true);
header.text = axis.ToString().ToUpperInvariant();
spawned.Add(header.gameObject);
}
void Clear()
{
for (var i = 0; i < spawned.Count; i++)
{
if (spawned[i] != null)
{
Destroy(spawned[i]);
}
}
spawned.Clear();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3955c87e179f42a790c048be66b69606
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: dfde056299764ef1b8308f5df3774fe7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f0166936dfea40599b3d29101ae1c086
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,53 @@
using TMPro;
using UnityEngine;
namespace NightclubArcadia.UI.Dialogue
{
/// <summary>
/// One message row in the dialogue stream: optional speaker name + body text.
/// </summary>
public sealed class DialogueMessageRow : MonoBehaviour
{
[SerializeField] TMP_Text speakerText;
[SerializeField] TMP_Text bodyText;
[SerializeField] GameObject speakerLabel;
public TMP_Text BodyText => bodyText;
public void SetContent(string speaker, string body)
{
if (string.IsNullOrWhiteSpace(speaker))
{
if (speakerLabel != null)
{
speakerLabel.SetActive(false);
}
else if (speakerText != null)
{
speakerText.gameObject.SetActive(false);
}
}
else
{
if (speakerLabel != null)
{
speakerLabel.SetActive(true);
}
else if (speakerText != null)
{
speakerText.gameObject.SetActive(true);
}
if (speakerText != null)
{
speakerText.text = speaker;
}
}
if (bodyText != null)
{
bodyText.text = body ?? string.Empty;
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a7773ea9a6f44798aa98356903037d16
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,173 @@
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
using Yarn.Unity;
// Annotations only (not warnings): DialoguePresenterBase declares
// RunOptionsAsync as YarnTask<DialogueOption?>, so the override needs a
// nullable annotation context to match it without CS8632.
#nullable enable annotations
namespace NightclubArcadia.UI.Dialogue
{
/// <summary>
/// Presents Yarn options as rows at the bottom of the dialogue stream,
/// reusing the stock OptionItem component from the Yarn package.
/// </summary>
public sealed class DialogueStreamOptionsPresenter : DialoguePresenterBase
{
[SerializeField] OptionItem optionViewPrefab;
[SerializeField] Transform optionsContainer;
[SerializeField] CanvasGroup canvasGroup;
[SerializeField] bool showUnavailableOptions;
readonly List<OptionItem> optionViews = new List<OptionItem>();
public override YarnTask OnDialogueStartedAsync() => YarnTask.CompletedTask;
public override YarnTask OnDialogueCompleteAsync()
{
HideAllOptions();
return YarnTask.CompletedTask;
}
public override YarnTask RunLineAsync(LocalizedLine line, LineCancellationToken token)
{
// Lines are handled by DialogueStreamPresenter.
return YarnTask.CompletedTask;
}
public override async YarnTask<DialogueOption?> RunOptionsAsync(
DialogueOption[] dialogueOptions,
LineCancellationToken cancellationToken)
{
var anyAvailable = false;
foreach (var option in dialogueOptions)
{
if (option.IsAvailable)
{
anyAvailable = true;
break;
}
}
if (!anyAvailable)
{
return null;
}
while (dialogueOptions.Length > optionViews.Count)
{
optionViews.Add(CreateNewOptionView());
}
var selectedOptionCompletionSource = new YarnTaskCompletionSource<DialogueOption?>();
var completionCancellationSource = CancellationTokenSource.CreateLinkedTokenSource(
cancellationToken.NextContentToken);
async YarnTask CancelSourceWhenDialogueCancelled()
{
await YarnTask.WaitUntilCanceled(completionCancellationSource.Token);
if (cancellationToken.IsNextContentRequested)
{
selectedOptionCompletionSource.TrySetResult(null);
}
}
CancelSourceWhenDialogueCancelled().Forget();
for (var i = 0; i < dialogueOptions.Length; i++)
{
var optionView = optionViews[i];
var option = dialogueOptions[i];
if (!option.IsAvailable && !showUnavailableOptions)
{
continue;
}
optionView.gameObject.SetActive(true);
optionView.Option = option;
optionView.OnOptionSelected = selectedOptionCompletionSource;
optionView.completionToken = completionCancellationSource.Token;
}
var optionIndexToSelect = -1;
for (var i = 0; i < optionViews.Count; i++)
{
var view = optionViews[i];
if (!view.isActiveAndEnabled)
{
continue;
}
if (view.IsHighlighted)
{
optionIndexToSelect = i;
break;
}
if (optionIndexToSelect == -1)
{
optionIndexToSelect = i;
}
}
if (optionIndexToSelect > -1)
{
optionViews[optionIndexToSelect].Select();
}
if (canvasGroup != null)
{
canvasGroup.alpha = 1f;
canvasGroup.interactable = true;
canvasGroup.blocksRaycasts = true;
}
var completedTask = await selectedOptionCompletionSource.Task;
completionCancellationSource.Cancel();
if (canvasGroup != null)
{
canvasGroup.interactable = false;
canvasGroup.blocksRaycasts = false;
canvasGroup.alpha = 0f;
}
HideAllOptions();
await YarnTask.Yield();
if (cancellationToken.NextContentToken.IsCancellationRequested)
{
return await DialogueRunner.NoOptionSelected;
}
return completedTask;
}
OptionItem CreateNewOptionView()
{
var parent = optionsContainer != null
? optionsContainer
: (canvasGroup != null ? canvasGroup.transform : transform);
var optionView = Instantiate(optionViewPrefab, parent, false);
optionView.transform.SetAsLastSibling();
optionView.gameObject.SetActive(false);
return optionView;
}
void HideAllOptions()
{
foreach (var optionView in optionViews)
{
if (optionView != null)
{
optionView.gameObject.SetActive(false);
}
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8d86cc99d5b545c4a3fad9e1482031a2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,133 @@
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using Yarn.Unity;
// Annotations only (not warnings): DialoguePresenterBase declares
// RunOptionsAsync as YarnTask<DialogueOption?>, so the override needs a
// nullable annotation context to match it without CS8632.
#nullable enable annotations
namespace NightclubArcadia.UI.Dialogue
{
/// <summary>
/// Yarn presenter that appends each line to a scrolling chat-style stream
/// rather than replacing a single text box.
/// </summary>
public sealed class DialogueStreamPresenter : DialoguePresenterBase
{
[SerializeField] DialogueMessageRow messageRowPrefab;
[SerializeField] RectTransform messageContainer;
[SerializeField] ScrollRect scrollRect;
[SerializeField] int maxRows = 100;
[SerializeField] float lettersPerSecond = 60f;
readonly List<DialogueMessageRow> rows = new List<DialogueMessageRow>();
void Awake()
{
// Must exist before LineAdvancer.Start(), which does
// presenter.Typewriter?.ActionMarkupHandlers.Add(this);
// to learn when a line has finished displaying. Leave Typewriter
// null and that is a silent no-op: LineAdvancer never receives
// OnLineDisplayComplete, its status never leaves LineBegan, and
// pressing the advance key only ever hurries up the line — the
// conversation can never move past the first message.
Typewriter = new LetterTypewriter
{
CharactersPerSecond = lettersPerSecond,
};
}
public override YarnTask OnDialogueStartedAsync()
{
ClearRows();
return YarnTask.CompletedTask;
}
public override YarnTask OnDialogueCompleteAsync()
{
// DialogueTransitionController owns showing/hiding the panel.
return YarnTask.CompletedTask;
}
public override async YarnTask RunLineAsync(LocalizedLine line, LineCancellationToken token)
{
if (messageRowPrefab == null || messageContainer == null)
{
Debug.LogError($"[{nameof(DialogueStreamPresenter)}] Missing messageRowPrefab or messageContainer.", this);
return;
}
var row = Instantiate(messageRowPrefab, messageContainer);
row.gameObject.SetActive(true);
rows.Add(row);
while (rows.Count > maxRows)
{
var oldest = rows[0];
rows.RemoveAt(0);
if (oldest != null)
{
Destroy(oldest.gameObject);
}
}
var text = line.TextWithoutCharacterName;
row.SetContent(line.CharacterName, text.Text ?? string.Empty);
// Delegate the reveal to Yarn's own typewriter rather than
// hand-rolling maxVisibleCharacters. It drives the
// IActionMarkupHandler lifecycle — including LineAdvancer's
// OnLineDisplayComplete, which is what lets the advance key move to
// the next line instead of only hurrying up the current one — and
// it honours [pause] markup for free.
//
// TextElement is re-pointed at each new row; the typewriter itself
// is reused so LineAdvancer's registration survives.
if (Typewriter != null && row.BodyText != null)
{
Typewriter.TextElement = row.BodyText;
Typewriter.PrepareForContent(text);
await Typewriter.RunTypewriter(text, token.HurryUpToken).SuppressCancellationThrow();
}
// Deliberately no ContentWillDismiss/ContentDidDismiss: rows persist
// in the stream, and ContentDidDismiss would blank the row by
// resetting maxVisibleCharacters to 0.
Canvas.ForceUpdateCanvases();
if (scrollRect != null)
{
scrollRect.verticalNormalizedPosition = 0f;
}
if (!token.IsNextContentRequested)
{
await YarnTask.WaitUntilCanceled(token.NextContentToken).SuppressCancellationThrow();
}
}
public override YarnTask<DialogueOption?> RunOptionsAsync(
DialogueOption[] dialogueOptions,
LineCancellationToken cancellationToken)
{
// Options are handled by DialogueStreamOptionsPresenter.
return DialogueRunner.NoOptionSelected;
}
void ClearRows()
{
for (var i = 0; i < rows.Count; i++)
{
if (rows[i] != null)
{
Destroy(rows[i].gameObject);
}
}
rows.Clear();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 88cb6495795a4e13ac7fb72343c132af
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 43777cd37e914ac1872021e3de3ceaed
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,65 @@
using NightclubArcadia.UI;
using UnityEngine;
namespace NightclubArcadia.UI.HUD
{
/// <summary>
/// Bottom-right player portrait. Visible only when dialogue is inactive
/// and the player menu is closed.
/// </summary>
public sealed class PortraitHudView : MonoBehaviour
{
[SerializeField] GameObject panelRoot;
void OnEnable()
{
if (UIStateController.Instance != null)
{
UIStateController.Instance.StateChanged += OnStateChanged;
}
}
void Start()
{
// Re-subscribe in case Instance was not ready during OnEnable,
// and apply the initial visibility.
if (UIStateController.Instance != null)
{
UIStateController.Instance.StateChanged -= OnStateChanged;
UIStateController.Instance.StateChanged += OnStateChanged;
}
ApplyVisibility();
}
void OnDisable()
{
if (UIStateController.Instance != null)
{
UIStateController.Instance.StateChanged -= OnStateChanged;
}
}
void OnStateChanged() => ApplyVisibility();
void ApplyVisibility()
{
if (panelRoot == null)
{
return;
}
var state = UIStateController.Instance;
var visible = state == null || (!state.IsDialogueActive && !state.IsMenuOpen);
if (visible)
{
PanelVisibility.Show(panelRoot);
}
else
{
PanelVisibility.Hide(panelRoot);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fd1354ade14b4b1d80da9acac4aa9e12
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 36b77035604148a0bec372b5f51e0f5f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,82 @@
using NightclubArcadia.Dialogue;
using TMPro;
using UnityEngine;
using Yarn.Unity;
namespace NightclubArcadia.UI.Menu
{
/// <summary>
/// Character tab stub: shows player name / alias from Yarn variable storage
/// and an empty inventory placeholder.
/// </summary>
public sealed class CharacterPanelView : MonoBehaviour
{
[SerializeField] TMP_Text nameLabel;
[SerializeField] TMP_Text aliasLabel;
[SerializeField] TMP_Text inventoryPlaceholder;
[SerializeField] DialogueRunner dialogueRunner;
// No OnEnable refresh: panels are toggled via CanvasGroup, so OnEnable
// fires exactly once during scene load — before the DialogueRunner has
// initialised its variables. MenuTabBar calls Refresh on tab show,
// which is both correctly timed and repeatable.
public void Refresh()
{
if (dialogueRunner == null)
{
dialogueRunner = FindFirstObjectByType<DialogueRunner>();
}
var storage = dialogueRunner != null ? dialogueRunner.VariableStorage : null;
if (nameLabel != null)
{
nameLabel.text = ReadString(storage, "$player_name_full", "Unknown");
}
if (aliasLabel != null)
{
// $player_alias is a *smart* variable
// <<declare $player_alias = alias_name($player_name) as string>>
// and Yarn's Unity runtime never assigns
// VariableStorageBehaviour.SmartVariableEvaluator, so reading it
// through TryGetValue always throws InvalidOperationException.
// Derive it from $player_name with the same generator the Yarn
// function wraps — deterministic, so the result is identical.
var realName = ReadString(storage, "$player_name", string.Empty);
aliasLabel.text = string.IsNullOrEmpty(realName)
? "—"
: AliasNameGenerator.AliasName(realName);
}
if (inventoryPlaceholder != null)
{
inventoryPlaceholder.text = "Inventory — empty";
}
}
static string ReadString(VariableStorageBehaviour storage, string key, string fallback)
{
if (storage == null)
{
return fallback;
}
try
{
if (storage.TryGetValue<string>(key, out var value) && !string.IsNullOrEmpty(value))
{
return value;
}
}
catch (System.InvalidOperationException)
{
// Smart variables, and variables read before the runner has a
// compiled Program, throw rather than returning false. A HUD
// panel showing a fallback string is the right failure mode.
}
return fallback;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ef17c93c7dec4af2ae7ce565c8984de3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,21 @@
using TMPro;
using UnityEngine;
namespace NightclubArcadia.UI.Menu
{
/// <summary>
/// Journal tab stub — no journal data model exists yet.
/// </summary>
public sealed class JournalPanelView : MonoBehaviour
{
[SerializeField] TMP_Text placeholderLabel;
void OnEnable()
{
if (placeholderLabel != null)
{
placeholderLabel.text = "Nothing recorded yet.";
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 74efa3bf7a354892a401418d8f56fb2b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,93 @@
using System;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace NightclubArcadia.UI.Menu
{
/// <summary>
/// Selects among menu tabs. Panels are toggled via CanvasGroup (never
/// SetActive) so TMP's cached Canvas stays valid. Each tab can fire an
/// Inspector-wired UnityEvent on show — used by SkillsPanelView.Refresh
/// without a cross-assembly interface.
/// </summary>
public sealed class MenuTabBar : MonoBehaviour
{
[Serializable]
public struct TabEntry
{
public Button button;
public CanvasGroup panel;
public UnityEvent onShown;
}
[SerializeField] TabEntry[] tabs = Array.Empty<TabEntry>();
int currentIndex = -1;
bool bound;
void OnEnable()
{
BindButtons();
}
void BindButtons()
{
if (bound || tabs == null)
{
return;
}
for (var i = 0; i < tabs.Length; i++)
{
var index = i;
if (tabs[i].button != null)
{
tabs[i].button.onClick.RemoveAllListeners();
tabs[i].button.onClick.AddListener(() => SelectTab(index));
}
}
bound = tabs.Length > 0;
}
/// <summary>Runtime / bootstrap entry point for assigning tabs after AddComponent.</summary>
public void SetTabs(TabEntry[] entries)
{
tabs = entries ?? System.Array.Empty<TabEntry>();
bound = false;
BindButtons();
}
public void SelectTab(int index)
{
if (tabs == null || tabs.Length == 0)
{
return;
}
index = Mathf.Clamp(index, 0, tabs.Length - 1);
currentIndex = index;
for (var i = 0; i < tabs.Length; i++)
{
var active = i == index;
var panel = tabs[i].panel;
if (panel != null)
{
panel.alpha = active ? 1f : 0f;
panel.interactable = active;
panel.blocksRaycasts = active;
}
}
tabs[index].onShown?.Invoke();
if (tabs[index].button != null && EventSystem.current != null)
{
EventSystem.current.SetSelectedGameObject(tabs[index].button.gameObject);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: db83a1a74e0e418881880ca808f68160
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,139 @@
using UnityEngine;
namespace NightclubArcadia.UI.Menu
{
/// <summary>
/// Opens and closes the player menu from Tab (PlayerMenuInput) or an
/// external Open() call (portrait click). Holds a PlayerControlLock so
/// opening the menu during dialogue does not re-enable movement when the
/// menu is closed — the dialogue holder remains in the lock set.
/// </summary>
public sealed class PlayerMenuController : MonoBehaviour
{
[SerializeField] GameObject menuRoot;
[SerializeField] PlayerMenuInput menuInput;
[SerializeField] PlayerControlLock controlLock;
[SerializeField] MenuTabBar tabBar;
bool isOpen;
void OnEnable()
{
SubscribeToMenuInput();
}
void Start()
{
// Re-run unconditionally: when this component is created by
// UILayerBootstrap, AddComponent fires OnEnable *before* menuInput
// has been assigned, so the OnEnable subscription is a no-op.
// Subscribing again here (idempotent via -= then +=) is what makes
// Tab work on both the bootstrap and the authored-prefab paths.
SubscribeToMenuInput();
if (controlLock == null)
{
controlLock = FindFirstObjectByType<PlayerControlLock>();
}
if (menuRoot != null)
{
PanelVisibility.Hide(menuRoot);
}
}
/// <summary>
/// Resolves <see cref="menuInput"/> if unassigned and (re)subscribes.
/// Safe to call repeatedly — the -= before += keeps it single-shot.
/// </summary>
void SubscribeToMenuInput()
{
if (menuInput == null)
{
menuInput = FindFirstObjectByType<PlayerMenuInput>();
}
if (menuInput != null)
{
menuInput.MenuToggleRequested -= Toggle;
menuInput.MenuToggleRequested += Toggle;
}
}
void OnDisable()
{
if (menuInput != null)
{
menuInput.MenuToggleRequested -= Toggle;
}
if (isOpen)
{
// Ensure we release the lock if destroyed while open.
CloseInternal(notifyState: false);
}
}
public void Toggle()
{
if (isOpen)
{
Close();
}
else
{
Open();
}
}
public void Open()
{
if (isOpen)
{
return;
}
isOpen = true;
if (menuRoot != null)
{
PanelVisibility.Show(menuRoot);
}
UIStateController.Instance?.SetMenuOpen(true);
controlLock?.Acquire(this);
tabBar?.SelectTab(0);
}
public void Close()
{
if (!isOpen)
{
return;
}
CloseInternal(notifyState: true);
}
void CloseInternal(bool notifyState)
{
isOpen = false;
if (menuRoot != null)
{
PanelVisibility.Hide(menuRoot);
}
if (notifyState)
{
UIStateController.Instance?.SetMenuOpen(false);
}
// Tab during dialogue works and is the whole point of the
// ref-counted lock: the dialogue holder is still in the set, so
// closing the menu leaves the player locked and the conversation
// intact.
controlLock?.Release(this);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 118cc9783dba4b3cac1646d97ebd3998
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,67 @@
using UnityEngine;
namespace NightclubArcadia.UI
{
/// <summary>
/// Shows and hides a UI panel *without* deactivating its GameObject.
///
/// SetActive(false) is not a safe way to hide this UI. TextMeshProUGUI
/// resolves its Canvas through Graphic.CacheCanvas, which calls
/// GetComponentsInParent(includeInactive: false) and then requires
/// canvas.isActiveAndEnabled. Once the Canvas GameObject has been
/// deactivated, that lookup yields null, and TMP.GetTextInfo does:
///
/// if (m_canvas == null) m_canvas = this.canvas; // still null
/// GenerateTextMesh(); // m_canvas.worldCamera -> NRE
///
/// GenerateTextMesh dereferences m_canvas unguarded, so the very next line
/// Yarn tries to type throws NullReferenceException. Keeping the hierarchy
/// active and driving a CanvasGroup instead means the cached Canvas
/// reference stays valid across any number of enter/exit dialogue cycles.
/// </summary>
public static class PanelVisibility
{
/// <summary>
/// Makes the panel visible and interactive. Returns true if the
/// GameObject had to be re-activated (legacy scene state), in which
/// case the caller must wait one frame before rendering text so that
/// TMP's OnEnable can re-cache its Canvas.
/// </summary>
public static bool Show(GameObject panel) => SetVisible(panel, true);
/// <summary>
/// Hides the panel, leaving the hierarchy active. See class docs.
/// </summary>
public static void Hide(GameObject panel) => SetVisible(panel, false);
static bool SetVisible(GameObject panel, bool visible)
{
if (panel == null)
{
return false;
}
// The UI may still be deactivated by an older saved scene state or
// by code that predates this helper. Recover from that, and tell
// the caller a frame of grace is needed.
var wasReactivated = false;
if (!panel.activeSelf)
{
panel.SetActive(true);
wasReactivated = true;
}
var group = panel.GetComponent<CanvasGroup>();
if (group == null)
{
group = panel.AddComponent<CanvasGroup>();
}
group.alpha = visible ? 1f : 0f;
group.interactable = visible;
group.blocksRaycasts = visible;
return wasReactivated;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 988359a7b8f64e3aa42a4527989ec6e7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,101 @@
using System.Collections.Generic;
using NightclubArcadia.Player;
using StarterAssets;
using UnityEngine;
namespace NightclubArcadia.UI
{
/// <summary>
/// Ref-counted freeze of the player's ThirdPersonController. Multiple
/// independent holders (dialogue, menu) can Acquire/Release; the controller
/// stays disabled until the last holder releases.
/// </summary>
public sealed class PlayerControlLock : MonoBehaviour
{
readonly HashSet<object> holders = new HashSet<object>();
ThirdPersonController playerController;
StarterAssetsInputs playerInputs;
Animator playerAnimator;
PlayerMotionArbiter motionArbiter;
static readonly int AnimIDSpeed = Animator.StringToHash("Speed");
static readonly int AnimIDMotionSpeed = Animator.StringToHash("MotionSpeed");
public bool IsLocked => holders.Count > 0;
void Awake()
{
playerController = GetComponent<ThirdPersonController>();
playerInputs = GetComponent<StarterAssetsInputs>();
playerAnimator = GetComponent<Animator>();
motionArbiter = GetComponent<PlayerMotionArbiter>();
}
public void Acquire(object reason)
{
if (reason == null)
{
throw new System.ArgumentNullException(nameof(reason));
}
var wasLocked = IsLocked;
holders.Add(reason);
if (!wasLocked && IsLocked)
{
ApplyLock(true);
}
}
public void Release(object reason)
{
if (reason == null)
{
return;
}
var wasLocked = IsLocked;
holders.Remove(reason);
if (wasLocked && !IsLocked)
{
ApplyLock(false);
}
}
void ApplyLock(bool locked)
{
if (playerController == null)
{
return;
}
if (locked)
{
// Clear pending input and the locomotion blend before freezing
// the controller. Disabling it mid-stride otherwise leaves
// Speed at its last value, and the character keeps running on
// the spot for the whole conversation.
if (playerInputs != null)
{
playerInputs.MoveInput(Vector2.zero);
playerInputs.LookInput(Vector2.zero);
playerInputs.SprintInput(false);
playerInputs.JumpInput(false);
}
if (playerAnimator != null)
{
playerAnimator.SetFloat(AnimIDSpeed, 0f);
playerAnimator.SetFloat(AnimIDMotionSpeed, 0f);
}
motionArbiter?.ResetState();
}
// cursor state hook — see plan §3.4
playerController.enabled = !locked;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2323f96ac8bc4e7080b4e3dac9a23795
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,24 @@
using System;
using UnityEngine;
using UnityEngine.InputSystem;
namespace NightclubArcadia.UI
{
/// <summary>
/// Receives the Player/Menu SendMessage from PlayerInput (sibling of
/// StarterAssetsInputs on PlayerArmature) and raises
/// <see cref="MenuToggleRequested"/>.
/// </summary>
public sealed class PlayerMenuInput : MonoBehaviour
{
public event Action MenuToggleRequested;
void OnMenu(InputValue value)
{
if (value.isPressed)
{
MenuToggleRequested?.Invoke();
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d08e055ec81347c4bddb8231f5c20cd2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,646 @@
using NightclubArcadia.Cinematics;
using NightclubArcadia.Dialogue;
using NightclubArcadia.Skills;
using NightclubArcadia.UI.Dialogue;
using NightclubArcadia.UI.HUD;
using NightclubArcadia.UI.Menu;
using StarterAssets;
using TMPro;
using Unity.Cinemachine;
using UnityEngine;
using UnityEngine.UI;
using Yarn.Unity;
namespace NightclubArcadia.UI
{
/// <summary>
/// Builds the rudimentary UI layer at runtime, for scenes where the UI
/// prefabs have not been instantiated. It is a fallback only: the authored
/// path is Tools → Nightclub Arcadia → Set Up UI Layer, which produces the
/// prefabs under Assets/Prefabs/UI and wires them into the scene.
///
/// It does NOT auto-spawn. It used to, which meant that once the scene had
/// been wired properly it would still create a second "UI System" object
/// carrying a duplicate UIStateController — logging a Debug.LogError every
/// play — and would reflection-overwrite DialogueCameraFraming's serialised
/// dialogueScreenX, making that value impossible to tune in the Inspector.
/// Add this component to a scene by hand if you want the fallback.
/// </summary>
[DefaultExecutionOrder(-100)]
public sealed class UILayerBootstrap : MonoBehaviour
{
[SerializeField] bool buildIfMissing = true;
void Awake()
{
EnsureFoundation();
if (!buildIfMissing)
{
return;
}
if (FindFirstObjectByType<DialogueStreamPresenter>() == null)
{
BuildDialogueStream();
}
if (FindFirstObjectByType<PortraitHudView>() == null)
{
BuildHud();
}
if (FindFirstObjectByType<PlayerMenuController>() == null)
{
BuildMenu();
}
EnsureCameraFraming();
WireDialogueRunner();
HidePackageDialogueCanvas();
}
void EnsureFoundation()
{
if (UIStateController.Instance == null && FindFirstObjectByType<UIStateController>() == null)
{
var go = GameObject.Find("UI System") ?? new GameObject("UI System");
go.AddComponent<UIStateController>();
}
var player = GameObject.Find("PlayerArmature");
if (player == null)
{
return;
}
if (player.GetComponent<PlayerControlLock>() == null)
{
player.AddComponent<PlayerControlLock>();
}
if (player.GetComponent<PlayerMenuInput>() == null)
{
player.AddComponent<PlayerMenuInput>();
}
var inputs = player.GetComponent<StarterAssetsInputs>();
if (inputs != null)
{
inputs.cursorLocked = false;
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
var transition = FindFirstObjectByType<DialogueTransitionController>();
if (transition != null)
{
var soLock = player.GetComponent<PlayerControlLock>();
// Assign via reflection-free serialized path: public setter not available,
// so use SendMessage-style field via SerializedObject is editor-only.
// Runtime: DialogueTransitionController finds lock from playerArmature in Awake.
var field = typeof(DialogueTransitionController).GetField(
"controlLock",
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
field?.SetValue(transition, soLock);
}
}
void BuildDialogueStream()
{
var canvasGo = CreateCanvas("DialogueStreamCanvas", 5);
var canvasGroup = canvasGo.AddComponent<CanvasGroup>();
canvasGroup.alpha = 0f;
canvasGroup.interactable = false;
canvasGroup.blocksRaycasts = false;
var panel = new GameObject("Panel", typeof(RectTransform), typeof(Image));
panel.transform.SetParent(canvasGo.transform, false);
var panelRt = panel.GetComponent<RectTransform>();
panelRt.anchorMin = new Vector2(0.66f, 0f);
panelRt.anchorMax = Vector2.one;
panelRt.offsetMin = Vector2.zero;
panelRt.offsetMax = Vector2.zero;
panel.GetComponent<Image>().color = new Color(0.05f, 0.05f, 0.08f, 0.92f);
var scrollGo = new GameObject("Scroll", typeof(RectTransform), typeof(ScrollRect), typeof(Image));
scrollGo.transform.SetParent(panel.transform, false);
Stretch(scrollGo.GetComponent<RectTransform>(), 8f);
scrollGo.GetComponent<Image>().color = new Color(0f, 0f, 0f, 0.01f);
var viewport = new GameObject("Viewport", typeof(RectTransform), typeof(RectMask2D), typeof(Image));
viewport.transform.SetParent(scrollGo.transform, false);
Stretch(viewport.GetComponent<RectTransform>());
viewport.GetComponent<Image>().color = new Color(1f, 1f, 1f, 0.01f);
var content = new GameObject("Content", typeof(RectTransform), typeof(VerticalLayoutGroup), typeof(ContentSizeFitter));
content.transform.SetParent(viewport.transform, false);
var contentRt = content.GetComponent<RectTransform>();
contentRt.anchorMin = new Vector2(0f, 0f);
contentRt.anchorMax = new Vector2(1f, 0f);
contentRt.pivot = new Vector2(0.5f, 0f);
var vlg = content.GetComponent<VerticalLayoutGroup>();
vlg.childAlignment = TextAnchor.LowerCenter;
vlg.childControlHeight = true;
vlg.childControlWidth = true;
vlg.childForceExpandHeight = false;
vlg.childForceExpandWidth = true;
vlg.spacing = 6f;
content.GetComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
var messages = new GameObject("Messages", typeof(RectTransform), typeof(VerticalLayoutGroup), typeof(ContentSizeFitter));
messages.transform.SetParent(content.transform, false);
ConfigureVertical(messages);
var options = new GameObject("Options", typeof(RectTransform), typeof(VerticalLayoutGroup), typeof(ContentSizeFitter), typeof(CanvasGroup));
options.transform.SetParent(content.transform, false);
ConfigureVertical(options);
var optionsGroup = options.GetComponent<CanvasGroup>();
optionsGroup.alpha = 0f;
optionsGroup.interactable = false;
optionsGroup.blocksRaycasts = false;
var scroll = scrollGo.GetComponent<ScrollRect>();
scroll.content = contentRt;
scroll.viewport = viewport.GetComponent<RectTransform>();
scroll.horizontal = false;
scroll.vertical = true;
var templates = new GameObject("UITemplates");
templates.transform.SetParent(transform, false);
templates.SetActive(false);
var rowPrefab = BuildMessageRowPrefab(templates.transform);
var stream = canvasGo.AddComponent<DialogueStreamPresenter>();
SetPrivate(stream, "messageRowPrefab", rowPrefab);
SetPrivate(stream, "messageContainer", messages.GetComponent<RectTransform>());
SetPrivate(stream, "scrollRect", scroll);
OptionItem yarnOption = null;
#if UNITY_EDITOR
yarnOption = UnityEditor.AssetDatabase.LoadAssetAtPath<OptionItem>(
"Packages/dev.yarnspinner.unity/Prefabs/Option Item.prefab");
#endif
if (yarnOption == null)
{
yarnOption = BuildFallbackOptionItem(templates.transform);
}
var optionsPresenter = canvasGo.AddComponent<DialogueStreamOptionsPresenter>();
SetPrivate(optionsPresenter, "optionViewPrefab", yarnOption);
SetPrivate(optionsPresenter, "optionsContainer", options.transform);
SetPrivate(optionsPresenter, "canvasGroup", optionsGroup);
var transition = FindFirstObjectByType<DialogueTransitionController>();
if (transition != null)
{
SetPrivate(transition, "dialogueUI", canvasGo);
}
foreach (var npc in FindObjectsByType<NPCStandIn>(FindObjectsInactive.Include, FindObjectsSortMode.None))
{
npc.dialogueUI = canvasGo;
}
}
DialogueMessageRow BuildMessageRowPrefab(Transform parent)
{
var root = new GameObject("DialogueMessageRow", typeof(RectTransform), typeof(DialogueMessageRow), typeof(VerticalLayoutGroup), typeof(ContentSizeFitter));
root.transform.SetParent(parent, false);
var layout = root.GetComponent<VerticalLayoutGroup>();
layout.padding = new RectOffset(12, 12, 8, 8);
layout.spacing = 4f;
layout.childControlHeight = true;
layout.childControlWidth = true;
layout.childForceExpandWidth = true;
layout.childForceExpandHeight = false;
root.GetComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
var speaker = CreateTmp("Speaker", root.transform, 22f, FontStyles.Bold);
var body = CreateTmp("Body", root.transform, 28f, FontStyles.Normal);
var row = root.GetComponent<DialogueMessageRow>();
SetPrivate(row, "speakerText", speaker);
SetPrivate(row, "bodyText", body);
SetPrivate(row, "speakerLabel", speaker.gameObject);
return row;
}
OptionItem BuildFallbackOptionItem(Transform parent)
{
var go = new GameObject("OptionItem", typeof(RectTransform), typeof(Image), typeof(OptionItem));
go.transform.SetParent(parent, false);
go.GetComponent<Image>().color = new Color(0.15f, 0.15f, 0.2f, 1f);
var text = CreateTmp("Text", go.transform, 24f, FontStyles.Normal);
Stretch(text.rectTransform);
SetPrivate(go.GetComponent<OptionItem>(), "text", text);
return go.GetComponent<OptionItem>();
}
void BuildHud()
{
var canvasGo = CreateCanvas("HudCanvas", 10);
var panel = new GameObject("PortraitPanel", typeof(RectTransform), typeof(CanvasGroup), typeof(Image), typeof(Button));
panel.transform.SetParent(canvasGo.transform, false);
var rt = panel.GetComponent<RectTransform>();
rt.anchorMin = new Vector2(1f, 0f);
rt.anchorMax = new Vector2(1f, 0f);
rt.pivot = new Vector2(1f, 0f);
rt.sizeDelta = new Vector2(220f, 280f);
rt.anchoredPosition = new Vector2(-24f, 24f);
panel.GetComponent<Image>().color = new Color(0.15f, 0.15f, 0.18f, 0.95f);
// Lives in Assets/Art/UI/Placeholder/Resources so this resolves in
// builds too — the AssetDatabase fallback below is editor-only.
var sprite = Resources.Load<Sprite>("portrait_placeholder");
#if UNITY_EDITOR
if (sprite == null)
{
sprite = UnityEditor.AssetDatabase.LoadAssetAtPath<Sprite>(
"Assets/Art/UI/Placeholder/Resources/portrait_placeholder.png");
}
#endif
if (sprite != null)
{
panel.GetComponent<Image>().sprite = sprite;
panel.GetComponent<Image>().preserveAspect = true;
}
var hint = CreateTmp("TabHint", panel.transform, 18f, FontStyles.Normal);
hint.text = "Tab";
hint.alignment = TextAlignmentOptions.Center;
var hintRt = hint.rectTransform;
hintRt.anchorMin = new Vector2(0f, 0f);
hintRt.anchorMax = new Vector2(1f, 0f);
hintRt.pivot = new Vector2(0.5f, 0f);
hintRt.sizeDelta = new Vector2(0f, 28f);
hintRt.anchoredPosition = new Vector2(0f, 4f);
var view = canvasGo.AddComponent<PortraitHudView>();
SetPrivate(view, "panelRoot", panel);
}
void BuildMenu()
{
var canvasGo = CreateCanvas("PlayerMenuCanvas", 20);
var rootGroup = canvasGo.AddComponent<CanvasGroup>();
rootGroup.alpha = 0f;
rootGroup.interactable = false;
rootGroup.blocksRaycasts = false;
var dimmer = new GameObject("Dimmer", typeof(RectTransform), typeof(Image));
dimmer.transform.SetParent(canvasGo.transform, false);
Stretch(dimmer.GetComponent<RectTransform>());
dimmer.GetComponent<Image>().color = new Color(0f, 0f, 0f, 0.6f);
var body = new GameObject("MenuBody", typeof(RectTransform), typeof(Image));
body.transform.SetParent(canvasGo.transform, false);
var bodyRt = body.GetComponent<RectTransform>();
bodyRt.anchorMin = new Vector2(0.15f, 0.1f);
bodyRt.anchorMax = new Vector2(0.85f, 0.9f);
bodyRt.offsetMin = Vector2.zero;
bodyRt.offsetMax = Vector2.zero;
body.GetComponent<Image>().color = new Color(0.08f, 0.08f, 0.1f, 0.98f);
var tabBarGo = new GameObject("TabBar", typeof(RectTransform), typeof(HorizontalLayoutGroup), typeof(MenuTabBar));
tabBarGo.transform.SetParent(body.transform, false);
var tabBarRt = tabBarGo.GetComponent<RectTransform>();
tabBarRt.anchorMin = new Vector2(0f, 1f);
tabBarRt.anchorMax = new Vector2(1f, 1f);
tabBarRt.pivot = new Vector2(0.5f, 1f);
tabBarRt.sizeDelta = new Vector2(0f, 56f);
var tabHlg = tabBarGo.GetComponent<HorizontalLayoutGroup>();
tabHlg.spacing = 8f;
tabHlg.padding = new RectOffset(12, 12, 8, 8);
// childControl* default to false on a script-added layout group.
tabHlg.childControlWidth = true;
tabHlg.childControlHeight = true;
tabHlg.childForceExpandWidth = true;
tabHlg.childForceExpandHeight = true;
var contentArea = new GameObject("ContentArea", typeof(RectTransform));
contentArea.transform.SetParent(body.transform, false);
var contentRt = contentArea.GetComponent<RectTransform>();
contentRt.anchorMin = Vector2.zero;
contentRt.anchorMax = Vector2.one;
contentRt.offsetMin = new Vector2(16f, 16f);
contentRt.offsetMax = new Vector2(-16f, -64f);
var characterPanel = CreateTabPanel("CharacterPanel", contentArea.transform);
var skillsPanel = CreateTabPanel("SkillsPanel", contentArea.transform);
var journalPanel = CreateTabPanel("JournalPanel", contentArea.transform);
// Character
var charVlg = characterPanel.AddComponent<VerticalLayoutGroup>();
charVlg.spacing = 12f;
charVlg.padding = new RectOffset(8, 8, 8, 8);
charVlg.childControlWidth = true;
charVlg.childControlHeight = true;
charVlg.childForceExpandWidth = true;
var charView = characterPanel.AddComponent<CharacterPanelView>();
var nameLabel = CreateTmp("Name", characterPanel.transform, 36f, FontStyles.Bold);
var aliasLabel = CreateTmp("Alias", characterPanel.transform, 28f, FontStyles.Italic);
var invLabel = CreateTmp("Inventory", characterPanel.transform, 24f, FontStyles.Normal);
SetPrivate(charView, "nameLabel", nameLabel);
SetPrivate(charView, "aliasLabel", aliasLabel);
SetPrivate(charView, "inventoryPlaceholder", invLabel);
// Skills
var skillsContent = new GameObject("Content", typeof(RectTransform), typeof(VerticalLayoutGroup), typeof(ContentSizeFitter));
skillsContent.transform.SetParent(skillsPanel.transform, false);
Stretch(skillsContent.GetComponent<RectTransform>());
ConfigureVertical(skillsContent);
skillsContent.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
skillsContent.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
skillsContent.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 1f);
var axisHeader = CreateTmp("AxisHeaderTemplate", skillsContent.transform, 20f, FontStyles.Bold);
axisHeader.gameObject.SetActive(false);
var templates = GameObject.Find("UI System")?.transform.Find("UITemplates")
?? new GameObject("UITemplates").transform;
if (templates.parent == null && transform != null)
{
templates.SetParent(transform, false);
templates.gameObject.SetActive(false);
}
var rowPrefab = BuildSkillRowPrefab(templates);
var skillsView = skillsPanel.AddComponent<SkillsPanelView>();
SetPrivate(skillsView, "contentRoot", skillsContent.GetComponent<RectTransform>());
SetPrivate(skillsView, "rowPrefab", rowPrefab);
SetPrivate(skillsView, "axisHeaderPrefab", axisHeader);
SetPrivate(skillsView, "displayMaxRank", 6);
// Journal
var journalView = journalPanel.AddComponent<JournalPanelView>();
var journalLabel = CreateTmp("Placeholder", journalPanel.transform, 28f, FontStyles.Italic);
journalLabel.text = "Nothing recorded yet.";
journalLabel.alignment = TextAlignmentOptions.Center;
Stretch(journalLabel.rectTransform);
SetPrivate(journalView, "placeholderLabel", journalLabel);
var charBtn = CreateTabButton("Character", tabBarGo.transform);
var skillsBtn = CreateTabButton("Skills", tabBarGo.transform);
var journalBtn = CreateTabButton("Journal", tabBarGo.transform);
var tabBar = tabBarGo.GetComponent<MenuTabBar>();
var tabs = new MenuTabBar.TabEntry[3];
tabs[0] = new MenuTabBar.TabEntry
{
button = charBtn,
panel = characterPanel.GetComponent<CanvasGroup>(),
onShown = new UnityEngine.Events.UnityEvent(),
};
// Panels toggle via CanvasGroup, never SetActive, so OnEnable fires
// once at construction and never again — before Yarn has set
// $player_name_full. Refresh on show or the tab stays stale forever.
tabs[0].onShown.AddListener(charView.Refresh);
tabs[1] = new MenuTabBar.TabEntry
{
button = skillsBtn,
panel = skillsPanel.GetComponent<CanvasGroup>(),
onShown = new UnityEngine.Events.UnityEvent(),
};
tabs[1].onShown.AddListener(skillsView.Refresh);
tabs[2] = new MenuTabBar.TabEntry
{
button = journalBtn,
panel = journalPanel.GetComponent<CanvasGroup>(),
onShown = new UnityEngine.Events.UnityEvent(),
};
tabBar.SetTabs(tabs);
var player = GameObject.Find("PlayerArmature");
var menuController = canvasGo.AddComponent<PlayerMenuController>();
SetPrivate(menuController, "menuRoot", canvasGo);
SetPrivate(menuController, "menuInput", player != null ? player.GetComponent<PlayerMenuInput>() : null);
SetPrivate(menuController, "controlLock", player != null ? player.GetComponent<PlayerControlLock>() : null);
SetPrivate(menuController, "tabBar", tabBar);
// Portrait click
var portraitButton = FindFirstObjectByType<PortraitHudView>()?.GetComponentInChildren<Button>(true);
if (portraitButton != null)
{
portraitButton.onClick.AddListener(menuController.Open);
}
}
SkillRowView BuildSkillRowPrefab(Transform parent)
{
var root = new GameObject("SkillRow", typeof(RectTransform), typeof(SkillRowView), typeof(HorizontalLayoutGroup));
root.transform.SetParent(parent, false);
var hlg = root.GetComponent<HorizontalLayoutGroup>();
hlg.padding = new RectOffset(8, 8, 4, 4);
hlg.spacing = 12f;
hlg.childAlignment = TextAnchor.MiddleLeft;
hlg.childControlHeight = true;
hlg.childControlWidth = true;
hlg.childForceExpandHeight = true;
var stripe = new GameObject("Accent", typeof(RectTransform), typeof(Image), typeof(LayoutElement));
stripe.transform.SetParent(root.transform, false);
stripe.GetComponent<LayoutElement>().preferredWidth = 6f;
stripe.GetComponent<Image>().color = Color.white;
var name = CreateTmp("Name", root.transform, 24f, FontStyles.Bold);
name.GetComponent<LayoutElement>().flexibleWidth = 1f;
var bar = new GameObject("Bar", typeof(RectTransform), typeof(Image), typeof(LayoutElement));
bar.transform.SetParent(root.transform, false);
bar.GetComponent<Image>().color = new Color(0.2f, 0.2f, 0.22f);
bar.GetComponent<LayoutElement>().preferredWidth = 160f;
bar.GetComponent<LayoutElement>().preferredHeight = 16f;
var fill = new GameObject("Fill", typeof(RectTransform), typeof(Image));
fill.transform.SetParent(bar.transform, false);
Stretch(fill.GetComponent<RectTransform>());
var fillImage = fill.GetComponent<Image>();
fillImage.type = Image.Type.Filled;
fillImage.fillMethod = Image.FillMethod.Horizontal;
fillImage.color = Color.white;
var rank = CreateTmp("Rank", root.transform, 24f, FontStyles.Normal);
rank.alignment = TextAlignmentOptions.Right;
rank.GetComponent<LayoutElement>().preferredWidth = 40f;
var view = root.GetComponent<SkillRowView>();
SetPrivate(view, "nameLabel", name);
SetPrivate(view, "rankLabel", rank);
SetPrivate(view, "barFill", fillImage);
SetPrivate(view, "accentStripe", stripe.GetComponent<Image>());
return view;
}
void EnsureCameraFraming()
{
var vcam = GameObject.Find("CinemachineCamera");
if (vcam == null)
{
return;
}
var framing = vcam.GetComponent<DialogueCameraFraming>();
if (framing == null)
{
framing = vcam.AddComponent<DialogueCameraFraming>();
}
SetPrivate(framing, "composer", vcam.GetComponent<CinemachinePositionComposer>());
SetPrivate(framing, "dialogueScreenX", -0.17f);
}
void WireDialogueRunner()
{
var runner = FindFirstObjectByType<DialogueRunner>();
var stream = FindFirstObjectByType<DialogueStreamPresenter>();
var options = FindFirstObjectByType<DialogueStreamOptionsPresenter>();
var advancer = FindFirstObjectByType<LineAdvancer>();
if (runner == null || stream == null || options == null)
{
return;
}
var list = new System.Collections.Generic.List<DialoguePresenterBase>();
list.Add(stream);
list.Add(options);
if (advancer != null)
{
list.Add(advancer);
SetPrivate(advancer, "presenter", stream);
}
runner.DialoguePresenters = list;
}
void HidePackageDialogueCanvas()
{
var dialogueSystem = GameObject.Find("Dialogue System");
if (dialogueSystem == null)
{
return;
}
var packageCanvas = dialogueSystem.transform.Find("Canvas");
if (packageCanvas == null)
{
return;
}
var banner = packageCanvas.Find("Skill Check Banner");
var streamCanvas = GameObject.Find("DialogueStreamCanvas");
if (banner != null && streamCanvas != null)
{
banner.SetParent(streamCanvas.transform, false);
var bannerRt = banner.GetComponent<RectTransform>();
if (bannerRt != null)
{
bannerRt.anchorMin = new Vector2(0f, 0.85f);
bannerRt.anchorMax = new Vector2(0.66f, 1f);
bannerRt.offsetMin = new Vector2(16f, 0f);
bannerRt.offsetMax = new Vector2(-16f, -16f);
}
}
packageCanvas.gameObject.SetActive(false);
}
static GameObject CreateCanvas(string name, int sortingOrder)
{
var go = new GameObject(name, typeof(RectTransform), typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster));
var canvas = go.GetComponent<Canvas>();
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
canvas.sortingOrder = sortingOrder;
var scaler = go.GetComponent<CanvasScaler>();
scaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
scaler.referenceResolution = new Vector2(1920f, 1080f);
scaler.matchWidthOrHeight = 0.5f;
return go;
}
static GameObject CreateTabPanel(string name, Transform parent)
{
var go = new GameObject(name, typeof(RectTransform), typeof(CanvasGroup));
go.transform.SetParent(parent, false);
Stretch(go.GetComponent<RectTransform>());
var group = go.GetComponent<CanvasGroup>();
group.alpha = 0f;
group.interactable = false;
group.blocksRaycasts = false;
return go;
}
static Button CreateTabButton(string label, Transform parent)
{
var go = new GameObject(label, typeof(RectTransform), typeof(Image), typeof(Button), typeof(LayoutElement));
go.transform.SetParent(parent, false);
go.GetComponent<Image>().color = new Color(0.2f, 0.2f, 0.25f, 1f);
var text = CreateTmp("Label", go.transform, 22f, FontStyles.Bold);
text.text = label;
text.alignment = TextAlignmentOptions.Center;
Stretch(text.rectTransform);
return go.GetComponent<Button>();
}
static TextMeshProUGUI CreateTmp(string name, Transform parent, float size, FontStyles style)
{
var go = new GameObject(name, typeof(RectTransform), typeof(TextMeshProUGUI), typeof(LayoutElement));
go.transform.SetParent(parent, false);
var tmp = go.GetComponent<TextMeshProUGUI>();
tmp.fontSize = size;
tmp.fontStyle = style;
tmp.color = Color.white;
tmp.enableWordWrapping = true;
tmp.text = name;
// No LayoutElement.preferredHeight — it would pin wrapped text to a
// single line's height and make stream rows overlap. See the same
// note in UILayerSetup.CreateTmp.
return tmp;
}
static void Stretch(RectTransform rt, float pad = 0f)
{
rt.anchorMin = Vector2.zero;
rt.anchorMax = Vector2.one;
rt.offsetMin = new Vector2(pad, pad);
rt.offsetMax = new Vector2(-pad, -pad);
}
static void ConfigureVertical(GameObject go)
{
var rt = go.GetComponent<RectTransform>();
rt.anchorMin = new Vector2(0f, 0f);
rt.anchorMax = new Vector2(1f, 0f);
rt.pivot = new Vector2(0.5f, 0f);
// See UILayerSetup.ConfigureVerticalContent: a script-added
// RectTransform starts at sizeDelta (100,100), which overhangs 50px
// off each side under stretch anchors and gets sheared by the mask.
rt.sizeDelta = new Vector2(0f, rt.sizeDelta.y);
rt.anchoredPosition = Vector2.zero;
var vlg = go.GetComponent<VerticalLayoutGroup>();
vlg.childControlHeight = true;
vlg.childControlWidth = true;
vlg.childForceExpandHeight = false;
vlg.childForceExpandWidth = true;
vlg.spacing = 4f;
go.GetComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
}
static void SetPrivate(object target, string fieldName, object value)
{
var type = target.GetType();
while (type != null)
{
var field = type.GetField(fieldName, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public);
if (field != null)
{
field.SetValue(target, value);
return;
}
type = type.BaseType;
}
Debug.LogWarning($"[UILayerBootstrap] Could not set field '{fieldName}' on {target.GetType().Name}");
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e244f08c4f1b4fe08ddef0a1c5409136
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: -100
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,63 @@
using System;
using UnityEngine;
namespace NightclubArcadia.UI
{
/// <summary>
/// Owns the two independent UI state flags — dialogue active and menu open —
/// and raises <see cref="StateChanged"/> so HUD, camera framing, and panels
/// can derive their visibility from a single source of truth.
/// </summary>
public sealed class UIStateController : MonoBehaviour
{
public static UIStateController Instance { get; private set; }
public bool IsDialogueActive { get; private set; }
public bool IsMenuOpen { get; private set; }
/// <summary>Raised after any state change. Subscribers derive their own visibility.</summary>
public event Action StateChanged;
void Awake()
{
if (Instance != null && Instance != this)
{
Debug.LogError($"[{nameof(UIStateController)}] Duplicate instance on '{name}'. Destroying this component.", this);
Destroy(this);
return;
}
Instance = this;
}
void OnDestroy()
{
if (Instance == this)
{
Instance = null;
}
}
public void SetDialogueActive(bool value)
{
if (IsDialogueActive == value)
{
return;
}
IsDialogueActive = value;
StateChanged?.Invoke();
}
public void SetMenuOpen(bool value)
{
if (IsMenuOpen == value)
{
return;
}
IsMenuOpen = value;
StateChanged?.Invoke();
}
}
}

Some files were not shown because too many files have changed in this diff Show More