Base.AChannel.Send C# (CSharp) Метод

Send() публичный абстрактный Метод

public abstract Send ( List buffers, byte channelID, PacketFlags flags = PacketFlags.Reliable ) : void
buffers List
channelID byte
flags PacketFlags
Результат void
		public abstract void Send(List<byte[]> buffers, byte channelID = 0, PacketFlags flags = PacketFlags.Reliable);

Same methods

AChannel::Send ( byte buffer, byte channelID, PacketFlags flags = PacketFlags.Reliable ) : void

Usage Example

Пример #1
0
        private void Send(object message, uint rpcId)
        {
            Opcode opcode = EnumHelper.FromString <Opcode>(message.GetType().Name);

            byte[] opcodeBytes  = BitConverter.GetBytes((ushort)opcode);
            byte[] seqBytes     = BitConverter.GetBytes(rpcId);
            byte[] messageBytes = MongoHelper.ToBson(message);

            NetChannelType channelType;

            if ((ushort)opcode > 7000 && (ushort)opcode < 8000)
            {
                channelType = NetChannelType.Login;
            }
            else if ((ushort)opcode > 0 && (ushort)opcode <= 1000)
            {
                channelType = NetChannelType.Battle;
            }
            else
            {
                channelType = NetChannelType.Gate;
            }

            AChannel channel = this.GetChannel(channelType);

            if (channel == null)
            {
                throw new GameException("game channel not found!");
            }

            channel.Send(new List <byte[]> {
                opcodeBytes, seqBytes, messageBytes
            });

            if (OpcodeHelper.IsNeedDebugLogMessage(opcode))
            {
                Log.Debug(MongoHelper.ToJson(message));
            }
        }