private void OnReplicationCreate(MyPacket packet) { packet.BitStream.ReadTypeId(); NetworkId networkId = packet.BitStream.ReadNetworkId(); MyPacketDataBitStreamBase bitStreamPacketData = MyNetworkWriter.GetBitStreamPacketData(); bitStreamPacketData.Stream.WriteNetworkId(networkId); bitStreamPacketData.Stream.WriteBool(true); bitStreamPacketData.Stream.Terminate(); this.SendReplicableReady(bitStreamPacketData); packet.Return(); }
private void SendUpdate() { MyPacketDataBitStreamBase bitStreamPacketData = MyNetworkWriter.GetBitStreamPacketData(); BitStream stream = bitStreamPacketData.Stream; stream.WriteByte(this.m_lastStateSyncPacketId, 8); stream.WriteByte((byte)this.m_acks.Count, 8); foreach (byte num2 in this.m_acks) { stream.WriteByte(num2, 8); } stream.Terminate(); this.m_acks.Clear(); this.SendClientAcks(bitStreamPacketData); bitStreamPacketData = MyNetworkWriter.GetBitStreamPacketData(); stream = bitStreamPacketData.Stream; this.m_clientPacketId = (byte)(this.m_clientPacketId + 1); stream.WriteByte(this.m_clientPacketId, 8); stream.WriteDouble(MyTimeSpan.FromTicks(Stopwatch.GetTimestamp()).Milliseconds); stream.WriteDouble(0.0); this.m_clientState.Serialize(stream, false); stream.Terminate(); this.SendClientUpdate(bitStreamPacketData); }
public MyPacketDataBitStreamBase GetBitStreamPacketData() => MyNetworkWriter.GetBitStreamPacketData();