binary optimization

This commit is contained in:
sli97
2022-12-05 21:46:02 +08:00
parent c31af6b02a
commit eeaa7915de
8 changed files with 208 additions and 236 deletions

View File

@@ -87,7 +87,6 @@ export default class DataManager extends Singleton {
player.direction = { x, y }
break
}
case InputTypeEnum.WeaponShoot: {
const { owner, position, direction } = input
const bullet: IBullet = {

View File

@@ -1,7 +1,6 @@
import Singleton from '../Base/Singleton'
import { ApiMsgEnum, IModel, strdecode, strencode } from '../Common';
import { binaryEncode } from '../Common/Binary';
import { binaryDecode } from '../Utils';
import { binaryEncode, binaryDecode } from '../Common/Binary';
const TIMEOUT = 5000
@@ -94,8 +93,6 @@ export default class NetworkManager extends Singleton {
sendMsg<T extends keyof IModel['msg']>(name: T, data: IModel['msg'][T]) {
const view = binaryEncode(name, data)
console.log("view", view.buffer);
this.ws.send(view.buffer)
}