Example #1
0
        public void Enqueue(Agent sender, EventID msgID, object data = null)
        {
            DataEventMsg eventMsg = new DataEventMsg();

            eventMsg.attchData = data;
            eventMsg.sAgent    = sender;
            eventMsg.typeID    = msgID;
            this.Enqueue(eventMsg);
        }
Example #2
0
        public void WriteRawData(byte msgType, EventID msgID, byte[] b)
        {
            var buf = TransportManager.GetWriteStream();

            buf.Reserve(b.Length + MSG_HEADER_LENGTH + MSG_ID_LENGTH);
            buf.WriteByte(msgType);
            buf.WriteUInt32((UInt32)(b.Length + MSG_ID_LENGTH));
            buf.WriteByte(0);
            buf.WriteUInt32(msgID);
            buf.WriteBytes(b);
            TransportManager.QueueWriteBuffer(this, buf);
        }
Example #3
0
        private void OnTakeSingleMsg()
        {
            EventID msgID = recvBuffer.ReadUInt32();
            var     b     = recvBuffer.SpanBytes((int)recvBodyLenght);

            switch (recvMsgType)
            {
            case 0x50:     // 'P'
                networkMgr.ServeHandler(this, msgID, b);
                break;

            case 0x52:     // 'R'
                networkMgr.ServeRpc(this, msgID, b);
                break;

            default:
                break;
            }
        }
Example #4
0
        public int CompareTo(object obj)
        {
            EventID rhs = (EventID)obj;

            return(s.CompareTo(rhs.s));
        }
Example #5
0
 public void RegisterEventHandler(EventID typeID, MsgHandler handler)
 {
     msgHandlerMap[typeID] = handler;
 }