/// <summary> /// 服务器定位消息 /// </summary> /// <param name="data"></param> /// <param name="len"></param> /// <returns></returns> private int proc_server_location(ref Byte[] data, int len) { if (len < 16) { return(len); } LoadArchive arLoad = LoadArchive.Load(data, len); // Byte[] buffer = new Byte[1024]; StoreArchive arStore = StoreArchive.Load(m_pBuffer_SP, 4096); uint nMsgType = 0; arLoad.ReadUInt8(ref nMsgType); arStore.WriteUInt8(nMsgType); ObjectID objectId = ObjectID.zero; arLoad.ReadObject(ref objectId); arStore.WriteObject(objectId); int x = 0; arLoad.ReadInt16(ref x); arStore.WriteFloat(x / 100.0f); int y = 0; arLoad.ReadInt16(ref y); arStore.WriteFloat(y / 100.0f); int z = 0; arLoad.ReadInt16(ref z); arStore.WriteFloat(z / 100.0f); int orient = 0; arLoad.ReadInt16(ref orient); arStore.WriteFloat(orient / 100.0f); data = arStore.GetData(); return(arStore.GetLength()); }
/// <summary> /// 服务器所有目标点移动 /// </summary> /// <param name="data"></param> /// <param name="len"></param> /// <returns></returns> private int proc_server_all_dest(ref Byte[] data, int len) { LoadArchive arLoad = LoadArchive.Load(data, len); // Byte[] buffer = new Byte[1024]; StoreArchive arStore = StoreArchive.Load(m_pBuffer_SP, 4096); uint nMsgType = 0; arLoad.ReadUInt8(ref nMsgType); arStore.WriteUInt8(nMsgType); uint nCount = 0; arLoad.ReadUInt16(ref nCount); arStore.WriteUInt16(nCount); if (nCount > 50) { LogSystem.Log("proc_server_all_dest"); return(len); } for (int i = 0; i < nCount; ++i) { ObjectID objectId = ObjectID.zero; arLoad.ReadObject(ref objectId); arStore.WriteObject(objectId); int x = 0; arLoad.ReadInt16(ref x); arStore.WriteFloat(x / 100.0f); int y = 0; arLoad.ReadInt16(ref y); arStore.WriteFloat(y / 100.0f); int z = 0; arLoad.ReadInt16(ref z); arStore.WriteFloat(z / 100.0f); int orient = 0; arLoad.ReadInt16(ref orient); arStore.WriteFloat(orient / 100.0f); int moveSpeed = 0; arLoad.ReadInt16(ref moveSpeed); arStore.WriteFloat(moveSpeed / 100.0f); int rotateSpeed = 0; arLoad.ReadInt16(ref rotateSpeed); arStore.WriteFloat(rotateSpeed / 100.0f); int jumpSpeed = 0; arLoad.ReadInt16(ref jumpSpeed); arStore.WriteFloat(jumpSpeed / 100.0f); int gravity = 0; arLoad.ReadInt16(ref gravity); arStore.WriteFloat(gravity / 100.0f); int mode = 0; arLoad.ReadInt32(ref mode); arStore.WriteInt32(mode); } data = arStore.GetData(); return(arStore.GetLength()); }
/// <summary> /// 服务器移动消息 /// </summary> /// <param name="data"></param> /// <param name="len"></param> /// <returns></returns> private int proc_server_moving(ref Byte[] data, int len) { if (len < 28) { return(len); } LoadArchive arLoad = LoadArchive.Load(data, len); // Byte[] buffer = new Byte[1024]; StoreArchive arStore = StoreArchive.Load(m_pBuffer_SP, 4096); uint nMsgType = 0; arLoad.ReadUInt8(ref nMsgType); arStore.WriteUInt8(nMsgType); ObjectID objectId = ObjectID.zero; arLoad.ReadObject(ref objectId); arStore.WriteObject(objectId); int x = 0; arLoad.ReadInt16(ref x); arStore.WriteFloat(x / 100.0f); int y = 0; arLoad.ReadInt16(ref y); arStore.WriteFloat(y / 100.0f); int z = 0; arLoad.ReadInt16(ref z); arStore.WriteFloat(z / 100.0f); int orient = 0; arLoad.ReadInt16(ref orient); arStore.WriteFloat(orient / 100.0f); int moveSpeed = 0; arLoad.ReadInt16(ref moveSpeed); arStore.WriteFloat(moveSpeed / 100.0f); int rotateSpeed = 0; arLoad.ReadInt16(ref rotateSpeed); arStore.WriteFloat(rotateSpeed / 100.0f); int jumpSpeed = 0; arLoad.ReadInt16(ref jumpSpeed); arStore.WriteFloat(jumpSpeed / 100.0f); int gravity = 0; arLoad.ReadInt16(ref gravity); arStore.WriteFloat(gravity / 100.0f); int mode = 0; arLoad.ReadInt32(ref mode); arStore.WriteInt32(mode); data = arStore.GetData(); return(arStore.GetLength()); }