binary encode

This commit is contained in:
sli97
2022-12-04 22:10:30 +08:00
parent a678a5b3fc
commit c31af6b02a
23 changed files with 1089 additions and 745 deletions

View File

@@ -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()