fix getfloat32
This commit is contained in:
		| @@ -1,5 +1,5 @@ | ||||
| import { ApiMsgEnum, InputTypeEnum } from "./Enum"; | ||||
| import { strdecode, strencode } from "./Utils"; | ||||
| import { strdecode, strencode, toFixed } from "./Utils"; | ||||
|  | ||||
| const encodeActorMove = (proto: ApiMsgEnum, data: any, view: DataView, index: number) => { | ||||
|   view.setUint8(index++, data.type) | ||||
| @@ -103,11 +103,11 @@ export const binaryEncode = (proto: ApiMsgEnum, data: any): DataView => { | ||||
|  | ||||
| const decodeActorMove = (view: DataView, index: number) => { | ||||
|   const id = view.getUint8(index++) | ||||
|   const directionX = view.getFloat32(index) | ||||
|   const directionX = toFixed(view.getFloat32(index)) | ||||
|   index += 4 | ||||
|   const directionY = view.getFloat32(index) | ||||
|   const directionY = toFixed(view.getFloat32(index)) | ||||
|   index += 4 | ||||
|   const dt = view.getFloat32(index) | ||||
|   const dt = toFixed(view.getFloat32(index)) | ||||
|   index += 4 | ||||
|   const msg = { | ||||
|     name: ApiMsgEnum.MsgClientSync, | ||||
| @@ -127,13 +127,13 @@ const decodeActorMove = (view: DataView, index: number) => { | ||||
|  | ||||
| const decodeWeaponShoot = (view: DataView, index: number) => { | ||||
|   const owner = view.getUint8(index++) | ||||
|   const positionX = view.getFloat32(index) | ||||
|   const positionX = toFixed(view.getFloat32(index)) | ||||
|   index += 4 | ||||
|   const positionY = view.getFloat32(index) | ||||
|   const positionY = toFixed(view.getFloat32(index)) | ||||
|   index += 4 | ||||
|   const directionX = view.getFloat32(index) | ||||
|   const directionX = toFixed(view.getFloat32(index)) | ||||
|   index += 4 | ||||
|   const directionY = view.getFloat32(index) | ||||
|   const directionY = toFixed(view.getFloat32(index)) | ||||
|   index += 4 | ||||
|   const msg = { | ||||
|     name: ApiMsgEnum.MsgClientSync, | ||||
| @@ -155,7 +155,7 @@ const decodeWeaponShoot = (view: DataView, index: number) => { | ||||
| } | ||||
|  | ||||
| const decodeTimePast = (view: DataView, index: number) => { | ||||
|   const dt = view.getFloat32(index) | ||||
|   const dt = toFixed(view.getFloat32(index)) | ||||
|   index += 4 | ||||
|   const msg = { | ||||
|     name: ApiMsgEnum.MsgClientSync, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user