forked from datawhale/whale-town-front
修正语法错误
This commit is contained in:
66
claude.md
66
claude.md
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## 1. Project Vision & Context
|
## 1. Project Vision & Context
|
||||||
- **Project**: "WhaleTown" - A 2D top-down pixel art RPG.
|
- **Project**: "WhaleTown" - A 2D top-down pixel art RPG.
|
||||||
- **Engine**: Godot 4.2+ (Strictly NO Godot 3.x syntax).
|
- **Engine**: Godot 4.5+ (Strictly NO Godot 3.x syntax).
|
||||||
- **Architecture**: Strictly layered: `_Core` (Framework), `Scenes` (Gameplay), `UI` (Interface).
|
- **Architecture**: Strictly layered: `_Core` (Framework), `Scenes` (Gameplay), `UI` (Interface).
|
||||||
- **Core Principle**: "Signal Up, Call Down". High decoupling via `EventSystem`.
|
- **Core Principle**: "Signal Up, Call Down". High decoupling via `EventSystem`.
|
||||||
|
|
||||||
@@ -46,36 +46,40 @@
|
|||||||
const PLAYER_MOVED = "player_moved"
|
const PLAYER_MOVED = "player_moved"
|
||||||
const INTERACT_PRESSED = "interact_pressed"
|
const INTERACT_PRESSED = "interact_pressed"
|
||||||
const NPC_TALKED = "npc_talked"
|
const NPC_TALKED = "npc_talked"
|
||||||
Singletons: Only GameManager, SceneManager, EventSystem allowed as Autoloads.
|
```
|
||||||
Decoupling: Low-level entities MUST NOT reference GameManager. Use events.
|
- **Singletons**: Only GameManager, SceneManager, EventSystem allowed as Autoloads.
|
||||||
6. 🏗 Implementation Details
|
- **Decoupling**: Low-level entities MUST NOT reference GameManager. Use events.
|
||||||
Player: CharacterBody2D. Must include Camera2D with position_smoothing_enabled = true.
|
|
||||||
NPC/Interactables: Use Area2D named InteractionArea. Trigger via EventSystem.
|
## 6. 🏗 Implementation Details
|
||||||
TileMap Layers:
|
- **Player**: CharacterBody2D. Must include Camera2D with `position_smoothing_enabled = true`.
|
||||||
Layer 0: Ground (No collision).
|
- **NPC/Interactables**: Use Area2D named InteractionArea. Trigger via EventSystem.
|
||||||
Layer 1: Obstacles (Physics Layer enabled).
|
- **TileMap Layers**:
|
||||||
Layer 2: Decoration (Y-Sort enabled).
|
- Layer 0: Ground (No collision).
|
||||||
Camera: Must auto-calculate limits via TileMap.get_used_rect().
|
- Layer 1: Obstacles (Physics Layer enabled).
|
||||||
7. 🧪 Testing Requirements (MANDATORY)
|
- Layer 2: Decoration (Y-Sort enabled).
|
||||||
Coverage: Every Manager/System in _Core/ MUST have a GUT test.
|
- **Camera**: Must auto-calculate limits via `TileMap.get_used_rect()`.
|
||||||
Naming: Test files must start with test_ and extend GutTest.
|
|
||||||
Example:
|
## 7. 🧪 Testing Requirements (MANDATORY)
|
||||||
code
|
- **Coverage**: Every Manager/System in `_Core/` MUST have a GUT test.
|
||||||
Gdscript
|
- **Naming**: Test files must start with `test_` and extend GutTest.
|
||||||
extends GutTest
|
- **Example**:
|
||||||
func test_event_emission():
|
```gdscript
|
||||||
var sender = Node.new()
|
extends GutTest
|
||||||
watch_signals(EventSystem)
|
func test_event_emission():
|
||||||
EventSystem.emit_event(EventNames.PLAYER_MOVED, {})
|
var sender = Node.new()
|
||||||
assert_signal_emitted(EventSystem, "event_raised")
|
watch_signals(EventSystem)
|
||||||
8. 🧘 The Zen of Development
|
EventSystem.emit_event(EventNames.PLAYER_MOVED, {})
|
||||||
Juice or Death: Every interaction (UI popup, NPC talk) MUST have a Tween placeholder.
|
assert_signal_emitted(EventSystem, "event_raised")
|
||||||
Zero Magic Numbers: All speeds/timers MUST be @export or defined in Config/.
|
```
|
||||||
Simplicity: If a function does two things, split it.
|
|
||||||
Back of the Fence: Hidden logic (like ResponseHandler.gd) must be as clean as the HUD.
|
## 8. 🧘 The Zen of Development
|
||||||
9. 📝 Code Template (Entity Pattern)
|
- **Juice or Death**: Every interaction (UI popup, NPC talk) MUST have a Tween placeholder.
|
||||||
code
|
- **Zero Magic Numbers**: All speeds/timers MUST be `@export` or defined in `Config/`.
|
||||||
Gdscript
|
- **Simplicity**: If a function does two things, split it.
|
||||||
|
- **Back of the Fence**: Hidden logic (like ResponseHandler.gd) must be as clean as the HUD.
|
||||||
|
|
||||||
|
## 9. 📝 Code Template (Entity Pattern)
|
||||||
|
```gdscript
|
||||||
extends CharacterBody2D
|
extends CharacterBody2D
|
||||||
class_name Player
|
class_name Player
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user