()
| 26 | } |
| 27 | |
| 28 | func (self *RawPacket) Message() interface{} { |
| 29 | |
| 30 | // 获取消息元信息 |
| 31 | meta := MessageMetaByID(self.MsgID) |
| 32 | |
| 33 | // 消息没有注册 |
| 34 | if meta == nil { |
| 35 | return struct{}{} |
| 36 | } |
| 37 | |
| 38 | // 创建消息 |
| 39 | msg := meta.NewType() |
| 40 | |
| 41 | // 从字节数组转换为消息 |
| 42 | err := meta.Codec.Decode(self.MsgData, msg) |
| 43 | if err != nil { |
| 44 | return struct{}{} |
| 45 | } |
| 46 | |
| 47 | return msg |
| 48 | } |
nothing calls this directly
no test coverage detected