private void HandleMessage(MyPacket p) { int bitPosition = p.BitStream.BitPosition; MyMessageId id = (MyMessageId)p.BitStream.ReadByte(8); if (id == MyMessageId.FLUSH) { this.ClearBuffer(); p.Return(); } else { p.BitStream.SetBitPositionRead(bitPosition); if ((this.IsBuffering && ((id != MyMessageId.JOIN_RESULT) && ((id != MyMessageId.WORLD_DATA) && (id != MyMessageId.WORLD)))) && (id != MyMessageId.PLAYER_DATA)) { this.m_buffer.Add(p); } else { this.ProfilePacketStatistics(true); MyStatsGraph.Begin("Live data", 0, "HandleMessage", 0xc5, @"E:\Repo1\Sources\Sandbox.Game\Engine\Multiplayer\MyTransportLayer.cs"); this.ProcessMessage(p); float?bytesTransfered = null; MyStatsGraph.End(bytesTransfered, 0f, "", "{0} B", null, "HandleMessage", 0xc7, @"E:\Repo1\Sources\Sandbox.Game\Engine\Multiplayer\MyTransportLayer.cs"); this.ProfilePacketStatistics(false); } } }
private unsafe void ProcessMessage(MyPacket p) { HandlerId id; Action <MyPacket> action; id.messageId = (MyMessageId)p.BitStream.ReadByte(8); id.receiverIndex = p.BitStream.ReadByte(8); if (((ulong)id.messageId) < this.m_thisFrameTraffic.Length) { int *numPtr1 = (int *)ref this.m_thisFrameTraffic[(int)id.messageId]; numPtr1[0] += p.BitStream.ByteLength; } p.Sender = new Endpoint(p.Sender.Id, id.receiverIndex); if (!this.m_handlers.TryGetValue(id, out action)) { HandlerId key = new HandlerId { messageId = id.messageId, receiverIndex = 0xff }; this.m_handlers.TryGetValue(key, out action); } if (action == null) { p.Return(); } else { MyStatsGraph.Begin(MyEnum <MyMessageId> .GetName(id.messageId), 0x7fffffff, "ProcessMessage", 0xe2, @"E:\Repo1\Sources\Sandbox.Game\Engine\Multiplayer\MyTransportLayer.cs"); action(p); MyStatsGraph.End(new float?((float)p.BitStream.ByteLength), 0f, "", "{0} B", null, "ProcessMessage", 0xe4, @"E:\Repo1\Sources\Sandbox.Game\Engine\Multiplayer\MyTransportLayer.cs"); } }
private void OnWorldData(MyPacket packet) { ServerDataMsg msg = base.ReplicationLayer.OnWorldData(packet); this.OnServerData(ref msg); packet.Return(); }
private void OnJoinResult(MyPacket packet) { JoinResultMsg msg = base.ReplicationLayer.OnJoinResult(packet); this.OnUserJoined(ref msg); packet.Return(); }
private void OnClientConnected(MyPacket packet) { Sync.ClientConnected(packet.Sender.Id.Value); ConnectedClientDataMsg msg = base.ReplicationLayer.OnClientConnected(packet); this.OnConnectedClient(ref msg); packet.Return(); }
private unsafe void ClientConnected(MyPacket packet) { Sync.ClientConnected(packet.Sender.Id.Value); ConnectedClientDataMsg msg = base.ReplicationLayer.OnClientConnected(packet); ConnectedClientDataMsg *msgPtr1 = (ConnectedClientDataMsg *)ref msg; this.OnConnectedClient(ref (ConnectedClientDataMsg) ref msgPtr1, msg.SteamID); packet.Return(); }
private void ControlMessageReceived(MyPacket p) { ITransportCallback callback; MyControlMessageEnum enum2 = (MyControlMessageEnum)((byte)p.ByteStream.ReadUShort()); if (this.m_controlMessageHandlers.TryGetValue((int)enum2, out callback)) { callback.Receive(p.ByteStream, p.Sender.Id.Value); } p.Return(); }
private void OnServerStateSync(MyPacket packet) { byte item = packet.BitStream.ReadByte(8); if (!packet.BitStream.ReadBool() && !this.m_acks.Contains(item)) { this.m_acks.Add(item); } this.m_lastStateSyncPacketId = item; packet.Return(); }
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 OnServerData(MyPacket packet) { packet.Return(); }
private void OnReplicationStreamBegin(MyPacket packet) { this.OnReplicationCreate(packet); packet.Return(); }
private void OnReplicationIslandDone(MyPacket packet) { packet.Return(); }
private void OnReplicationDestroy(MyPacket packet) { packet.Return(); }
private void ClientReady(MyPacket packet) { this.ReplicationLayer.OnClientReady(packet.Sender, packet); packet.Return(); }