Beispiel #1
0
        public void WriteReliableBuffer(BinaryWriter writer)
        {
            writer.Write(LastReceivedReliable);

            lock (OutReliableCommands)
            {
                var outReliableCommands = OutReliableCommands.GetRange(0, OutReliableCommands.Count);

                foreach (var cmd in outReliableCommands)
                {
                    if (cmd.Command == null)
                    {
                        continue;
                    }

                    writer.Write(cmd.Type);

                    if (cmd.Command.Length > ushort.MaxValue)
                    {
                        writer.Write(cmd.ID | 0x80000000);
                        writer.Write(cmd.Command.Length);
                    }
                    else
                    {
                        writer.Write(cmd.ID);
                        writer.Write((ushort)cmd.Command.Length);
                    }

                    writer.Write(cmd.Command);
                }
            }
        }
Beispiel #2
0
        public void SendReliableCommand(uint commandType, byte[] commandData)
        {
            lock (OutReliableCommands)
            {
                OutReliableCommands.Add(new OutReliableCommand()
                {
                    ID = OutReliableSequence + 1, Command = commandData, Type = commandType
                });
            }

            OutReliableSequence++;
        }