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));
}
}