diff --git a/examples/cocos-creator-multiplayer/frontend/assets/scenes/GameScene/GameScene.ts b/examples/cocos-creator-multiplayer/frontend/assets/scenes/GameScene/GameScene.ts index ada0915..8356c1d 100644 --- a/examples/cocos-creator-multiplayer/frontend/assets/scenes/GameScene/GameScene.ts +++ b/examples/cocos-creator-multiplayer/frontend/assets/scenes/GameScene/GameScene.ts @@ -164,6 +164,6 @@ export class GameScene extends Component { // 显示坐标 —> 逻辑坐标 targetPos: { x: targetPos.x, y: targetPos.y }, targetTime: this.gameManager.state.now + gameConfig.arrowFlyTime - }) + } as any) } } \ No newline at end of file diff --git a/examples/cocos-creator-multiplayer/frontend/assets/scripts/models/GameManager.ts b/examples/cocos-creator-multiplayer/frontend/assets/scripts/models/GameManager.ts index 4546077..5dd50ca 100644 --- a/examples/cocos-creator-multiplayer/frontend/assets/scripts/models/GameManager.ts +++ b/examples/cocos-creator-multiplayer/frontend/assets/scripts/models/GameManager.ts @@ -23,7 +23,7 @@ export class GameManager { let client = this.client = new WsClient(serviceProto, { server: `ws://${location.hostname}:3000`, json: true, - logger: console + // logger: console });; client.listenMsg('server/Frame', msg => { this._onServerSync(msg) }); @@ -96,18 +96,12 @@ export class GameManager { return; } - console.log('sendClientInput', input, this.state.now); - let msg: MsgClientInput = { sn: ++this.lastSN, inputs: [input] } this.pendingInputMsgs.push(msg); - this.client.sendMsg('client/ClientInput', msg).then(v => { - if (!v.isSucc) { - console.error('xxxxxxxxxxxxxx', msg, v) - } - }); + this.client.sendMsg('client/ClientInput', msg); // 预测 this.gameSystem.applyInput({ diff --git a/examples/cocos-creator-multiplayer/frontend/package.json b/examples/cocos-creator-multiplayer/frontend/package.json index 8155950..fbe38b4 100644 --- a/examples/cocos-creator-multiplayer/frontend/package.json +++ b/examples/cocos-creator-multiplayer/frontend/package.json @@ -7,6 +7,7 @@ "version": "3.3.2" }, "dependencies": { + "tsrpc-base-client": "^1.2.3", "tsrpc-browser": "^3.1.3" } }