Add more entries to dictionary

This commit is contained in:
rocheon 2026-03-14 18:57:37 +08:00
parent e8adfc6236
commit adb029a3ff
1 changed files with 654 additions and 15 deletions

View File

@ -1,30 +1,669 @@
# 游戏项目字典 Project Dictionary
**项目:草原解谜游戏(暂定)**
版本v1.0 | 最后更新2026-03-13
# Project Dictionary
**Project: Don't Wake Up My Dream (working title)**
Version: v1.3 | Last updated: 2026-03-14
---
## 使用说明
## How to Use
> 每次新对话开头,将本文档与《协作规范文档》一起粘贴给 Claude。
> 本文档记录项目中所有概念的精确定义,是 Claude 理解这个项目的唯一参考。
> 发现定义不准确或需要新增概念时,告诉 Claude 更新对应条目并升级版本号。
> At the start of every new conversation, paste this document along with the **Collaboration Spec** into AI.
> This dictionary is a **quick reference** — it gives AI enough context to understand and use components correctly. For full detail, search the source file by component name in the project.
> The dictionary is a work-in-progress and does not cover all concepts. Always treat the most recently provided version as current.
> When a definition is incomplete or a new concept needs adding, tell AI to update the entry and bump the version number.
---
## 本次对话目标
## Conversation Goal
> 请在开头告诉 Claude 本次要做什么,例如:
> - "继续补充字典,今天讲 XXX"
> - "字典已够用,帮我做新关卡:XXX"
> - "修改关卡 XXX 的逻辑:XXX"
> Tell AI what this session is for, e.g.:
> - "Continue building the dictionary — today we're covering XXX"
> - "Dictionary is ready, help me build a new level: XXX"
> - "Modify the logic of level XXX: XXX"
---
## 字典内容
## Entry Template
*(待本次对话补充)*
### `ComponentName`
**Type:** [Input / Logic / Visual / Audio / UI / Data / Manager / Utility / Base]
One-sentence summary of what it does.
**Properties**
- `prop` — what it controls
**Events**
- `OnEventName` — when it fires
**Methods**
- `MethodName(params)` — what it does
**[Optional — only if relevant]**
**Freeze** — freeze behavior
**Virtual** — programmatic trigger behavior
**Relation:** `CustomComponentA`, `CustomComponentB`
*(Only list custom project components, not Unity built-ins)*
---
*配套文档:《游戏协作规范文档 v1.0》*
## Dictionary Entries
### `MyMonoBehaviour`
**Type:** Base Component
Base class for all custom components. Provides pause, timing, coroutine, and delay utilities.
**Properties**
- `paused` — pause state
- `directorUpdateMode` — GameTime, UnscaledGameTime, or Manual
**Methods**
- `Pause()` / `Resume()`
- `New_WaitForSeconds(float)` — pause-aware wait
- `DelayActionCall(float, Action)` — delayed action
- `NextFrameActionCall(Action)` — next frame action
- `DestoryGameObject(GameObject)` / `DestoryAllChildren(GameObject)`
---
### `TouchEventTrigger`
**Type:** Input Component
Detects touch on a 2D collider. Fires events when touch begins or is released. Tracks one touch at a time.
**Properties**
- `triggerOnMoving` — also triggers on finger slide in/out
- `group` — for batch freeze/unfreeze
- `touchPosTarget` — GameObject that follows touch in world space
**Events**
- `OnTouchBeganEvent` — on touch begin
- `OnReleaseBeganEvent` — on touch release
**Freeze** — `AddFreeze()` blocks all input and force-releases. `AddFreezeByGroup(group)` for group-level freezing.
**Virtual** — `TouchBeganDirectly()` / `OnVirtualTouched()` trigger without a real finger.
**Relation:** `Canvas`, `Helper`, `GameObjectValue`, `MyMonoBehaviour`
---
### `ActiveEventTrigger`
**Type:** Logic Component
Manages activation/deactivation events with enable types (Solo, Mutual, Sync). Triggers events on lifecycle callbacks.
**Properties**
- `enableType` — Solo, Mutual, Sync, or None
- `initState` — Default, Disabled, or Enabled
- `groupTag` — group identifier for mutual triggers
- `autoDeactived` — auto deactivate after trigger
**Events**
- `OnAwakeTriggerEvent` / `OnStartTriggerEvent`
- `OnEnableTriggerEvent` / `OnDisableTriggerEvent`
- `OnDestroyTriggerEvent`
**Relation:** `MyMonoBehaviour`, `GameObjectFreezable`
---
### `AudioEventTrigger`
**Type:** Audio Component
Plays audio clips (SFX, BGM, Voice) with volume, looping, timeline binding, and percentage-based event triggers.
**Properties**
- `type` — 0: SFX, 1: BGM, 2: Voice
- `startOnAwake` — auto play on awake
- `clipList` — list of AudioScriptableObject
- `minVolume` — minimum volume clamp
- `playPercents` — trigger percentage (01)
**Events**
- `OnAudioPercentTrigger` — fires at playPercents
- `OnAudioBeganTrigger` — fires when audio starts
- `OnAudioEndTrigger` — fires when audio ends
**Relation:** `AudioScriptableObject`, `GlobalObject`, `Helper`
---
### `CollideEventTrigger`
**Type:** Input Component
Detects 2D collision/trigger events. Supports tag filtering, target objects, and root-based detection.
**Properties**
- `TriggerType` — Default, Center, or Whole
- `colliderTag` — tag to filter collisions
- `target` — specific target GameObject
- `root` — parent root for filtering
- `TriggerOnceForTheSameTag` — only trigger once per tag
**Events**
- `OnEnterEvent` / `OnExitEvent` / `OnStayEvent`
**Methods**
- Delegates: `delegateOnTriggerEnter2D`, `delegateOnTriggerExit2D`, `delegateOnTriggerStay2D`
- Delegates: `delegateOnCollisionEnter2D`, `delegateOnCollisionExit2D`, `delegateOnCollisionStay2D`
**Relation:** `MyMonoBehaviour`, `GameObjectFreezable`
---
### `ConfineToCollider2D`
**Type:** Utility Component
Confines a GameObject's position within a collider or screen bounds. Fires events on border enter/exit.
**Properties**
- `targetCollider` — collider to confine within (optional, uses screen bounds if null)
- `debugInEditor` — show gizmos in edit mode
**Events**
- `OnEnterBorder` — fires when object enters border
- `OnExitBorder` — fires when object exits border
---
### `GameObjectFollower`
**Type:** Utility Component
Makes a GameObject follow a target Transform with offset. Supports rotation following and speed-based scaling.
**Properties**
- `target` — target Transform to follow
- `offset` — position offset
- `force` — rotation follow force
- `enableSpeedScale` — scale based on movement speed
- `speedThrethold` — speed threshold for scaling
**Relation:** `MyMonoBehaviour`
---
### `GameObjectFreezable`
**Type:** Utility Component
Adds freeze/unfreeze functionality to any GameObject. Supports group-based freezing.
**Properties**
- `group` — freeze group name
**Events**
- `OnFreezed` — fires when frozen
- `OnNotFreezed` — fires when unfrozen
**Methods**
- `AddFreeze()` / `RemoveFreeze()` / `ClearFreeze()`
- `AddFreezeByGroup(group)` / `RemoveFreezeByGroup(group)`
**Relation:** `MyMonoBehaviour`
---
### `GameObjectOperation`
**Type:** Logic Component
Evaluates mathematical formulas using NCalc. Computes results from GameObjectValue inputs.
**Properties**
- `formula` — NCalc formula string
- `computePerFrame` — recompute every frame
- `result` — output GameObjectValue
- `valueList` — input GameObjectValue list
**Methods**
- `length(vector)`, `add(v1,v2)`, `sub(v1,v2)`, `cross(v1,v2)` — built-in formula functions
**Relation:** `GameObjectValue`
---
### `GameObjectRecorder`
**Type:** Utility Component
Records and replays Transform data. Supports interval-based recording and playback speed control.
**Properties**
- `transformToRecordReplay` — target Transform
- `manual` — manual recording mode
- `playmode` — replay mode
- `replaySpeed` — playback speed multiplier
- `recordInterval` — recording interval
**Methods**
- `StartRecording()` / `StopRecording()`
- `StartReplay()` / `StopReplay()`
- `AddRecord()` — add single record in manual mode
---
### `GameObjectSetter`
**Type:** Utility Component
Sets Transform, Rigidbody2D, and renderer properties. Supports position, rotation, scale, parent, velocity, and active state.
**Properties**
- `positionOffset` — position offset
- `initPostion` — initial position (Left, Right, Top, Bottom, Center, Any)
**Events**
- `OnStart` / `OnSetPosition` / `OnSetRotation` / `OnSetLocalScale` / `OnSetParent`
**Methods**
- `SetPosition(Transform/Vector3/GameObjectValue)`
- `SetRotation(Transform)` / `SetLocalScale(Transform/GameObjectValue)`
- `SetParent(Transform)` / `SetActive(GameObjectValue)`
- `SetRigidBody2DVelocity(Vector3/GameObjectValue)`
**Relation:** `MyMonoBehaviour`, `GameObjectValue`
---
### `GameObjectShake`
**Type:** Visual Component
Shakes a GameObject with rotation or translation. Supports normal and unscaled time.
**Properties**
- `duration` / `frequence` / `magnitude` — shake parameters
- `target` — target to shake (defaults to self)
- `shakeType` — Rotate or Translate
- `UpdateMode` — Normal or UnscaledTime
**Events**
- `OnTriggerBegin` / `OnTriggerEnd`
**Methods**
- `Shake()` — shake with default values
- `Shake(duration, frequence, magnitude)` — shake with custom values
**Relation:** `MyMonoBehaviour`
---
### `GameObjectTrigger`
**Type:** Logic Component
Triggers a UnityEvent with configurable timing (Immediate, NextFrame, Delay).
**Properties**
- `triggerTime` — Immediately, NextFrame, or Delay
- `delayTime` — delay in seconds
- `triggerEvent` — UnityEvent to trigger
**Relation:** `MyMonoBehaviour`
---
### `GameObjectValueData`
**Type:** Data Component
Holds a list of GameObjectValue objects. Manages add/remove/copy operations.
**Properties**
- `list` — list of GameObjectValue
**Events**
- `OnStart`
**Methods**
- `Add(GameObjectValue)` / `Remove(GameObjectValue)`
- `CopyFrom(GameObjectValueData)`
**Relation:** `GameObjectValue`
---
### `KeyEventTrigger`
**Type:** Input Component
Detects keyboard input. Fires events on key down and key up.
**Properties**
- `keyId` — KeyCode as integer (-1 for any key)
- `group` — freeze group
**Events**
- `OnKeyDown` / `OnKeyUp`
**Freeze** — supports `AddFreeze()` / `RemoveFreeze()` by group.
---
### `ListEventTrigger`
**Type:** Logic Component
Manages a list of UnityEvents with index control. Supports looping, random ordering, and sequential triggering.
**Properties**
- `presetList` — list of TriggerEvents
- `loop` — loop after last trigger
- `randomOnAWake` — randomize order on awake
- `currentId` — current trigger index
- `seed` — random seed
**Events**
- `OnRandomFinished` / `AfterLastTrigger` / `InvalidTrigger` / `OnStartTrigger`
**Methods**
- `Trigger()` / `Trigger(int i)`
- `TriggerAndIncreaseIndex()`
- `SetIndex(int i)` / `SetIndexRandom()`
- `RandomTriggerList()`
**Relation:** `GameObjectValue`
---
### `VPEventTrigger`
**Type:** Audio Component
Controls VideoPlayer playback. Fires events on start and stop.
**Properties**
- `timeUpdateMode` — GameTime or UnscaledGameTime
- `playOnAwake` — auto play on awake
**Events**
- `OnStartEvent` / `OnStopEvent`
**Methods**
- `Play()` / `Stop()`
- `Play(startTime, duration)` — play a segment
**Relation:** `MyMonoBehaviour`
---
### `RendererSetter`
**Type:** Visual Component
Sets color, material, and sprite on renderers. Supports multiple renderer types.
**Properties**
- `includeChild` — apply to children
**Methods**
- `SetColor(Color/GameObjectValue/string)`
- `SetMaterial(Material)` / `SetSprite(Sprite)`
---
### `GameObjectQueue`
**Type:** Data Component
Manages a queue of GameObjectQueueHolders. Handles add/remove with before/after events.
**Properties**
- `holderList` — list of holders
- `currentId` — current index
**Events**
- `OnAddItemEventTrigger` / `AfterAddedEventTrigger`
- `OnRemoveItemEventTrigger` / `BeforeRemovedEventTrigger`
**Methods**
- `Add(GameObjectQueue)` / `Remove(GameObjectQueue)`
- `RemoveFirst()` / `RemoveLast()`
**Relation:** `GameObjectQueueHolder`
---
### `GameObjectQueueHolder`
**Type:** Data Component
Holds a single GameObject slot in a `GameObjectQueue`.
**Properties**
- `queue` — the queue this holder belongs to
**Relation:** `GameObjectQueue`
---
### `GameObjectPseudo3D`
**Type:** Utility Component
Detects contact with ground/surfaces using raycasts. Supports 2D and 3D raycasting with snap.
**Properties**
- `rayLength` / `contactLayer` — ray config
- `useGroundZ` / `detect3d` — mode flags
- `snap` / `snapOffset` — snap to contact point
**Events**
- `OnContactedBegan` / `OnContactedEnd`
**Relation:** `MyMonoBehaviour`
---
### `GameObjectList`
**Type:** Data Component
Holds a list of GameObjects with index management. Supports random and sequential triggering.
**Properties**
- `list` — list of GameObjects
- `currentId` — current index
- `seed` / `loop`
**Methods**
- `Trigger(int i)` / `TriggerAll()` / `TriggerRandom(int count)`
- `Add(GameObject)` / `Remove(GameObject)`
- `AddAllChildren()` / `RemoveAllChildren()`
**Relation:** `GameObjectTrigger`
---
### `MessageBox`
**Type:** UI Component
Displays a message box with OK/Cancel buttons. Uses localization for text.
**Properties**
- `UI` — the UI root
- `textMessage` / `textOK` / `textCancel`
**Methods**
- `Show(bool)` — show/hide
**Relation:** `GlobalObject`, `Localization`
---
### `GenericData`
**Type:** Data (ScriptableObject)
Stores key-value data (bool, int, float, string, Vector3, GameObject). Supports save/load to JSON.
**Properties**
- `boolDict`, `intDict`, `floatDict`, `stringDict`, `vector3Dict`, `gameObjectDict`
- `version` — data version
**Methods**
- `GetBool/SetBool(key)`, `GetInteger/SetInteger(key)`, `GetFloat/SetFloat(key)`
- `GetString/SetString(key)`, `GetVector3/SetVector3(key)`, `GetGameObject/SetGameObject(key)`
- `Reset()` / `ClearAll()` / `Save()` / `Load()`
---
### `GlobalObject`
**Type:** Manager Component
Singleton. Manages global game state, audio scalers, localization, level data, and scene loading.
**Properties**
- `BGMScaler`, `SFXScaler`, `VoiceScaler`
- `globalCanvas`, `currentLevelScene`, `levelTask`
- `Instance` (static) / `levelNames` / `currentVersion`
**Methods**
- `SetCurrentLevel(string)` / `ResetAllGameData()` / `LoadScene(string)`
**Relation:** `MyMonoBehaviour`, `LocalizationManager`, `LevelData`, `LevelTask`
---
### `Canvas`
**Type:** UI Component
Main game UI controller. Manages progress bar, pause/resume, hint, and game over screens.
**Properties**
- `HintButton`, `PauseButton`, `ResumeButton`, `HomeButton`, `SkipButton`
- `progress`, `textCenter`, `whiteScreen`, `playing`
- `gameMenu`, `inventoryUI`, `gameover`
**Events**
- `onProgressStart` / `onProgressFinished` / `onDogHPEmpty`
**Methods**
- `UpdateProgress(int)` / `ResetProgress()` / `AddProgress(int)`
- `OnGamePaused()` / `OnGameResumed()`
**Relation:** `MyMonoBehaviour`, `GlobalObject`, `GameObjectValue`
---
### `Conversation`
**Type:** UI Component
Displays conversation text with animation. Supports localization and voice playback.
**Properties**
- `KeyArray` — localization key array
- `uiText` / `uiBackground`
- `oneShot` / `dynamicSequence`
**Events**
- `OnConversationLoaded` / `OnConversationEnd` / `OnEndList`
**Methods**
- `ShowText(int id)` / `ShowTextAndIncreaseIndex()`
**Relation:** `MyMonoBehaviour`, `GlobalObject`, `ListEventTrigger`
---
### `Dialogue`
**Type:** UI Component
Displays dialogue with speaker name and content separately with animation.
**Properties**
- `KeyArray` / `speakerList` / `uiText` / `uiBackground`
- `oneShot` / `dynamicSequence`
**Events**
- `OnEndList`
**Methods**
- `ShowText(int id)` / `ShowItem(int i)`
**Relation:** `MyMonoBehaviour`, `GlobalObject`, `DialogueSpeaker`, `ListEventTrigger`
---
### `DialogueSpeaker`
**Type:** UI Component
Represents a dialogue speaker. Fires events on speak begin/end.
**Properties**
- `speakerName`
**Events**
- `SpeakBeginEventTrigger` / `SpeakEndEventTrigger` / `OnEventList`
**Methods**
- `SpeakBegin()` / `SpeakEnd()` / `Trigger(int i)`
**Relation:** `MyMonoBehaviour`, `ListEventTrigger`
---
### `GameOver`
**Type:** UI Component
Game over screen. Manages replay, continue, home, sharing, and screenshot.
**Properties**
- `sFailed` / `sSucceed` — success/fail screens
- `btnSkip` / `btnContinue` / `btnShare` / `btnLeaderboard`
- `autoNextLevel` / `manualNextLevel`
- `snapshotEffect` / `snapshotShow` / `snapshotTake`
**Methods**
- `Replay()` / `Continue()` / `NextLevel()`
- `GotoHome()` / `GotoCatalog()` / `ShareClicked()`
**Relation:** `GlobalObject`, `SnapshotSprite`
---
### `Localization`
**Type:** Utility Component
Localizes text and sprites. Applies language-specific fonts and content.
**Properties**
- `customFontName` / `propertiesSaver`
- `textComponents` / `textMeshComponents` / `textMeshProComponents`
- `spriteRendererComponents`
**Events**
- `OnStart`
**Methods**
- `Localize()` / `LocalizeText()` / `LocalizeTextMesh()` / `LocalizeTextMeshPro()`
- `SetSprite(SpriteRenderer)` / `SetImage(Image)`
**Relation:** `GlobalObject`, `PropertiesSaver`
---
### `AutoTest`
**Type:** Utility Component
Testing utility for automated gameplay. Provides UI for running test cases.
**Properties**
- `testList` / `caseList` / `ui`
- `dropDownCommand` / `dropDownScene` / `dropDownEntry`
- `data` — GenericData for testing
**Events**
- `OnAutoNextBegan`
**Methods**
- `Run()` / `Run(int i)` / `Run(string command)`
- `GenerateData()`
**Relation:** `MyMonoBehaviour`, `GenericData`, `LevelData`
---
### `Block`
**Type:** Utility Component
Wraps a GameObject's position for infinite scrolling. Moves object when it exits bounds.
**Properties**
- `widthInWorld` / `heightInWorld` — wrap boundaries
- `minRandomCount` / `maxRandomCount` / `randomActiveList`
- `delay` — movement delay
**Events**
- `OnBlockSwitched` — when position wraps
---
*Companion document: Game Collaboration Spec v1.0*
*This document is subject to change at any time — always treat the most recently provided version as current.*