19 Commits

Author SHA1 Message Date
48216b72f7 Merge pull request 'revert d671e4d3117ae8d902cb15a43a1c1d9c30fc8e27' (#14) from moyin-patch-1 into main
Reviewed-on: #14
2026-01-14 16:45:00 +08:00
229461c83f revert d671e4d311
revert Merge pull request '聊天系统' (#13) from qbb0530/whale-town-front:main into main

Reviewed-on: #13
2026-01-14 16:44:46 +08:00
d671e4d311 Merge pull request '聊天系统' (#13) from qbb0530/whale-town-front:main into main
Reviewed-on: #13
2026-01-14 15:22:13 +08:00
625fe0ff6c merge upstream 2026-01-14 15:19:15 +08:00
WhaleTown Developer
0e5b9f947b refactor: 移除SocketIOClient并更新认证场景
- 移除SocketIOClient.gd及.uid文件
- 更新ChatManager以适配新的架构
- 添加认证UI图片资源和背景音乐
- 优化AuthScene布局和配置
- 更新MainScene和项目配置
2026-01-11 23:12:35 +08:00
7cca58cb07 Merge pull request 'feature/whaletown-developer-skill' (#12) from feature/whaletown-developer-skill into main
Reviewed-on: #12
2026-01-10 19:31:05 +08:00
王浩
749e2c257b assets: 添加认证UI图片资源 2026-01-09 23:24:32 +08:00
王浩
e335a35f6c feat(chat-ui): 更新聊天UI和场景配置
- 优化聊天消息显示
- 调整UI布局
2026-01-09 23:23:41 +08:00
王浩
136e1344a0 fix(chat): 修复WebSocket连接和消息格式
- 修复连接状态检测时机问题
- 修复聊天消息格式为 {t: chat, content, scope}
- 添加 _send_login_message 函数
- 移除空消息心跳避免服务器错误
2026-01-09 23:21:12 +08:00
WhaleTown Developer
25a21f92be feat(chat): 优化聊天UI布局和WebSocket连接
- 更新 WebSocket URL 以支持 Socket.IO 握手参数 (EIO=4)
- 重构聊天面板布局,使用绝对定位和百分比锚点
- 优化输入框样式,添加装饰元素
- 修复输入框焦点释放的事件冲突问题
- 将 ChatUI 集成到主场景中
- 改进主场景容器布局设置
2026-01-08 23:59:21 +08:00
王浩
9c2e3bf15a refactor(chat-ui): 移除HeaderContainer和SendButton,添加装饰图片,修复Enter键监听
- 删除 HeaderContainer 和 StatusLabel(状态显示)
- 删除 SendButton(发送按钮)
- 添加聊天框背景图和装饰图片
- 设置 TextureRect modulate 为白色,修复黑框问题
- 移除 ChatPanel 背景色,使背景透明
- 修复 is_key_pressed 错误,改用 InputEventKey 类型检查
- 移除 _update_connection_status 函数及相关调用
2026-01-08 18:14:48 +08:00
WhaleTown Developer
9e288dbb62 docs: 更新聊天系统实施进度
- 简化文档,移除详细修复记录
- 更新实施状态:所有编译错误已修复
- 记录待后端解决的 Zulip 集成问题
2026-01-08 00:31:07 +08:00
WhaleTown Developer
c8e73bec59 fix: 修复聊天系统编译错误
- 修复 WebSocketManager/SocketIOClient 函数缩进错误
- 重命名 is_connected() 避免与 Object 基类冲突
- 修复 tscn 文件多余前导空格
- 修复测试文件 GUT 断言函数调用
- 添加 GUT 测试框架
2026-01-08 00:11:12 +08:00
王浩
16f24ab26f feat:添加聊天UI资源文件
- 添加聊天界面UI资源(缩略框背景、输入框背景、装饰图片)
- 修复 GrassTile.gd.uid 文件缺失

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 17:46:26 +08:00
王浩
414225e8c1 docs:更新项目规范文档
- 在 claude.md 添加 Plan Mode Protocol 章节
- 明确规划阶段的输出要求和执行报告流程
- 强制要求在每个 TODO 完成后更新文档并等待用户确认

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 17:42:48 +08:00
王浩
fb7cba4088 feat:实现聊天系统核心功能
- 添加 SocketIOClient.gd 实现 Socket.IO 协议封装
- 添加 WebSocketManager.gd 管理连接生命周期和自动重连
- 添加 ChatManager.gd 实现聊天业务逻辑与会话管理
  - 支持当前会话缓存(最多 100 条消息)
  - 支持历史消息按需加载(每次 100 条)
  - 每次登录/重连自动重置会话缓存
  - 客户端频率限制(10 条/分钟)
  - Token 管理与认证
- 添加 ChatMessage.gd/tscn 消息气泡 UI 组件
- 添加 ChatUI.gd/tscn 聊天界面
- 在 EventNames.gd 添加 7 个聊天事件常量
- 在 AuthManager.gd 添加 game_token 管理方法
- 添加完整的单元测试(128 个测试用例)
  - test_socketio_client.gd (42 个测试)
  - test_websocket_manager.gd (38 个测试)
  - test_chat_manager.gd (48 个测试)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 17:42:31 +08:00
7b85147994 chore: 合并 main 分支,统一 CLAUDE.md 格式规范
合并 main 分支对 CLAUDE.md 的格式改进,同时保留 feature 分支新增的标准开发工作流(第 8 节)。

主要改动:
- 更新 Godot 版本要求从 4.2+ 到 4.5+
- 规范化 Markdown 格式(代码块、粗体、列表)
- 保留新增的「Standard Development Workflow」章节
- 调整章节编号(第 9、10 节)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-06 19:41:29 +08:00
e3c4d08021 Merge pull request '修正语法错误' (#11) from qbb0530/whale-town-front:main into main
Reviewed-on: #11
2026-01-05 11:28:13 +08:00
王浩
3bdda47191 修正语法错误 2026-01-04 17:17:34 +08:00

View File

@@ -2,7 +2,7 @@
## 1. Project Vision & Context
- **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).
- **Core Principle**: "Signal Up, Call Down". High decoupling via `EventSystem`.
@@ -46,28 +46,31 @@
const PLAYER_MOVED = "player_moved"
const INTERACT_PRESSED = "interact_pressed"
const NPC_TALKED = "npc_talked"
Singletons: Only GameManager, SceneManager, EventSystem allowed as Autoloads.
Decoupling: Low-level entities MUST NOT reference GameManager. Use events.
6. 🏗 Implementation Details
Player: CharacterBody2D. Must include Camera2D with position_smoothing_enabled = true.
NPC/Interactables: Use Area2D named InteractionArea. Trigger via EventSystem.
TileMap Layers:
Layer 0: Ground (No collision).
Layer 1: Obstacles (Physics Layer enabled).
Layer 2: Decoration (Y-Sort enabled).
Camera: Must auto-calculate limits via TileMap.get_used_rect().
7. 🧪 Testing Requirements (MANDATORY)
Coverage: Every Manager/System in _Core/ MUST have a GUT test.
Naming: Test files must start with test_ and extend GutTest.
Example:
code
Gdscript
extends GutTest
func test_event_emission():
```
- **Singletons**: Only GameManager, SceneManager, EventSystem allowed as Autoloads.
- **Decoupling**: Low-level entities MUST NOT reference GameManager. Use events.
## 6. 🏗 Implementation Details
- **Player**: CharacterBody2D. Must include Camera2D with `position_smoothing_enabled = true`.
- **NPC/Interactables**: Use Area2D named InteractionArea. Trigger via EventSystem.
- **TileMap Layers**:
- Layer 0: Ground (No collision).
- Layer 1: Obstacles (Physics Layer enabled).
- Layer 2: Decoration (Y-Sort enabled).
- **Camera**: Must auto-calculate limits via `TileMap.get_used_rect()`.
## 7. 🧪 Testing Requirements (MANDATORY)
- **Coverage**: Every Manager/System in `_Core/` MUST have a GUT test.
- **Naming**: Test files must start with `test_` and extend GutTest.
- **Example**:
```gdscript
extends GutTest
func test_event_emission():
var sender = Node.new()
watch_signals(EventSystem)
EventSystem.emit_event(EventNames.PLAYER_MOVED, {})
assert_signal_emitted(EventSystem, "event_raised")
```
## 🔄 8. Standard Development Workflow (MANDATORY)
@@ -130,14 +133,14 @@ See `docs/02-开发规范/命名规范.md` for complete details.
**Remember**: Consistency through automation. Use `/whaletown-developer` to ensure no steps are missed.
9. 🧘 The Zen of Development
Juice or Death: Every interaction (UI popup, NPC talk) MUST have a Tween placeholder.
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.
9. 📝 Code Template (Entity Pattern)
code
Gdscript
## 9. 🧘 The Zen of Development
- **Juice or Death**: Every interaction (UI popup, NPC talk) MUST have a Tween placeholder.
- **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.
## 10. 📝 Code Template (Entity Pattern)
```gdscript
extends CharacterBody2D
class_name Player