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); }
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); }
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; } }
public int CompareTo(object obj) { EventID rhs = (EventID)obj; return(s.CompareTo(rhs.s)); }
public void RegisterEventHandler(EventID typeID, MsgHandler handler) { msgHandlerMap[typeID] = handler; }