mirror of
https://github.com/tiennm99/caro.git
synced 2026-05-14 08:58:01 +00:00
ecc617790e
Phase 04 of the WebSocket protobuf migration:
- Add protobufjs@7.5.4 runtime dep and protobufjs-cli@1.1.3 devDep
- Add proto:gen npm script that runs pbjs + pbts against server/src/main/proto/
- Commit static-module output at client/src/generated/protocol.{js,d.ts}
- Rewrite connection-service.js:
* Set binaryType='arraybuffer' and default URL to ws://localhost:1999/ratel
* Replace string-keyed send(code, data) with 13 typed send helpers
(sendNickname, sendGameMove, sendCreatePveRoom, ...)
* Decode incoming BinaryWebSocketFrame via Response.decode and map
each oneof case to a ClientEventCode for the event bus
- Update 14 call sites across menu-ui, game-ui, game-scene
- game-state-service CLIENT_CONNECT now reads data.clientId
- menu-ui NICKNAME_SET toast only triggers when invalidLength > 0
- Drop ServerEventCode enum from protocol-constants.js
20 lines
546 B
JSON
20 lines
546 B
JSON
{
|
|
"name": "caro-client",
|
|
"version": "0.0.1",
|
|
"type": "module",
|
|
"scripts": {
|
|
"dev": "vite",
|
|
"build": "vite build",
|
|
"preview": "vite preview",
|
|
"proto:gen": "pbjs -t static-module -w es6 -o src/generated/protocol.js ../server/src/main/proto/request.proto ../server/src/main/proto/response.proto && pbts -o src/generated/protocol.d.ts src/generated/protocol.js"
|
|
},
|
|
"dependencies": {
|
|
"phaser": "^3.87.0",
|
|
"protobufjs": "^7.5.4"
|
|
},
|
|
"devDependencies": {
|
|
"protobufjs-cli": "^1.1.3",
|
|
"vite": "^6.3.1"
|
|
}
|
|
}
|