Ejemplo n.º 1
0
        public void Return(params object[] args)
        {
            var name = "On" + m_currInvokingName;

            Debuger.Log("->[{0}] {1}({2})", m_currInvokingSrc, name, args.ToListString());

            RPCWork.RPCMessage rpcmsg = new RPCWork.RPCMessage();
            rpcmsg.name = name;
            rpcmsg.args = args;

            IPCMessage msg = new IPCMessage();

            msg.src = m_id;
            msg.rpc = rpcmsg;

            m_SendBuff.Reset();
            m_SendBuff.EncodeProtoMsg(msg);
            SendMessage(m_currInvokingSrc, m_SendBuff.GetBuffer(), (int)m_SendBuff.Size);
        }
Ejemplo n.º 2
0
        private void DoReceiveInMain()
        {
            lock (m_RecvBufferQueue)
            {
                if (m_RecvBufferQueue.Count > 0)
                {
                    byte[] buffer = m_RecvBufferQueue.Dequeue();
                    m_RecvBuff.Reset();
                    m_RecvBuff.In(buffer, 0, (uint)buffer.Length);
                    IPCMessage msg = new IPCMessage();
                    m_RecvBuff.DecodeProtoMsg(msg);

                    HandleMessage(msg);
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 发送网络数据包
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="instance"></param>
 public void SendNetPacket <T>(T instance, UInt16 opcode)
 {
     __sendBuffer.Reset();
     Serializer.Serialize <T>(__sendBuffer, instance);
     SendNetPacket(__sendBuffer.GetBuffer(), opcode);
 }