update tsrpc-browser

This commit is contained in:
k8w 2021-12-03 13:59:00 +08:00
parent 906c355348
commit 5c588ea56e
3 changed files with 4 additions and 9 deletions

View File

@ -164,6 +164,6 @@ export class GameScene extends Component {
// 显示坐标 —> 逻辑坐标 // 显示坐标 —> 逻辑坐标
targetPos: { x: targetPos.x, y: targetPos.y }, targetPos: { x: targetPos.x, y: targetPos.y },
targetTime: this.gameManager.state.now + gameConfig.arrowFlyTime targetTime: this.gameManager.state.now + gameConfig.arrowFlyTime
}) } as any)
} }
} }

View File

@ -23,7 +23,7 @@ export class GameManager {
let client = this.client = new WsClient(serviceProto, { let client = this.client = new WsClient(serviceProto, {
server: `ws://${location.hostname}:3000`, server: `ws://${location.hostname}:3000`,
json: true, json: true,
logger: console // logger: console
});; });;
client.listenMsg('server/Frame', msg => { this._onServerSync(msg) }); client.listenMsg('server/Frame', msg => { this._onServerSync(msg) });
@ -96,18 +96,12 @@ export class GameManager {
return; return;
} }
console.log('sendClientInput', input, this.state.now);
let msg: MsgClientInput = { let msg: MsgClientInput = {
sn: ++this.lastSN, sn: ++this.lastSN,
inputs: [input] inputs: [input]
} }
this.pendingInputMsgs.push(msg); this.pendingInputMsgs.push(msg);
this.client.sendMsg('client/ClientInput', msg).then(v => { this.client.sendMsg('client/ClientInput', msg);
if (!v.isSucc) {
console.error('xxxxxxxxxxxxxx', msg, v)
}
});
// 预测 // 预测
this.gameSystem.applyInput({ this.gameSystem.applyInput({

View File

@ -7,6 +7,7 @@
"version": "3.3.2" "version": "3.3.2"
}, },
"dependencies": { "dependencies": {
"tsrpc-base-client": "^1.2.3",
"tsrpc-browser": "^3.1.3" "tsrpc-browser": "^3.1.3"
} }
} }