binary encode
This commit is contained in:
@@ -8,7 +8,6 @@ import NetworkManager from '../Global/NetworkManager';
|
||||
import ObjectPoolManager from '../Global/ObjectPoolManager';
|
||||
import { BulletManager } from '../Entity/Bullet/BulletManager';
|
||||
import { ApiMsgEnum, EntityTypeEnum, IMsgServerSync, InputTypeEnum } from '../Common';
|
||||
import { toFixed } from '../Utils';
|
||||
|
||||
const { ccclass } = _decorator;
|
||||
|
||||
@@ -86,7 +85,7 @@ export class BattleManager extends Component {
|
||||
map.setParent(this.stage)
|
||||
}
|
||||
|
||||
handleSync({ inputs }: IMsgServerSync) {
|
||||
handleSync(inputs: IMsgServerSync) {
|
||||
for (const input of inputs) {
|
||||
DataManager.Instance.applyInput(input)
|
||||
}
|
||||
@@ -102,7 +101,7 @@ export class BattleManager extends Component {
|
||||
|
||||
tick(dt: number) {
|
||||
this.tickPlayer(dt)
|
||||
this.tickGlobal(dt)
|
||||
// this.tickGlobal(dt)
|
||||
}
|
||||
|
||||
tickPlayer(dt: number) {
|
||||
@@ -115,14 +114,14 @@ export class BattleManager extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
tickGlobal(dt: number) {
|
||||
NetworkManager.Instance.sendMsg(ApiMsgEnum.MsgClientSync, {
|
||||
input: {
|
||||
type: InputTypeEnum.TimePast,
|
||||
dt: toFixed(dt),
|
||||
}
|
||||
})
|
||||
}
|
||||
// tickGlobal(dt: number) {
|
||||
// NetworkManager.Instance.sendMsg(ApiMsgEnum.MsgClientSync, {
|
||||
// input: {
|
||||
// type: InputTypeEnum.TimePast,
|
||||
// dt: toFixed(dt),
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
render() {
|
||||
this.renderPlayer()
|
||||
|
Reference in New Issue
Block a user