Add MainHUD gameplay UI, net handshake updates, and server maintenance mode.

Introduce UiManager/MainHUD prefab flow, strengthen GameNet/WsClient, and add AIServer maintenance endpoint support.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
udx
2026-09-21 17:34:42 +08:00
co-authored by Cursor
parent 10d9b98637
commit c94b8fefeb
32 changed files with 1907 additions and 74 deletions
+16 -1
View File
@@ -19,7 +19,8 @@ Base: `https://game.xworld.ren`(Caddy → 后端)
| --- | --- | --- | --- | --- |
| POST | `/register` | `{"username","password"}` | `{token,pid}` | `invalid_input` / `user_exists` |
| POST | `/login` | `{"username","password"}` | `{token,pid}` | `invalid_credentials` |
| GET | `/health` | — | `{ok,service}` | — |
| GET | `/health` | — | `{ok,service,maintenance}` | — |
| GET | `/maintenance` | — | `{enabled,message}` | — |
## WebSocket
@@ -29,8 +30,22 @@ Base: `https://game.xworld.ren`(Caddy → 后端)
- 无 token / token 无效 → HTTP 401
- 应用层:`{"op":"hello"}` → `{"op":"hello_ack","ok":true}`;`{"op":"ping"}` → `{"op":"pong"}`
- 维护:若 `data/maintenance.json` 中 `enabled=true`,升级后立刻下发 `{"op":"maintenance","message":"..."}` 并断开
- 协议层 Ping/Pong 由服务端应答
## 维护开关
文件:`AIServer/data/maintenance.json`(与 `--db` 同目录,可用 `--maintenance` 覆盖)
```json
{ "enabled": true, "message": "今晚 2:00-4:00 维护" }
```
| GET | `/maintenance` | — | `{enabled,message}` |
| GET | `/health` | — | 增加 `maintenance` 字段 |
CDN `version.json.notice` 也会在客户端启动时弹公告(不依赖游戏服)。
## 客户端
- `HotUpdate.Net.AuthApi` / `GameNet` / `WsClient`