public void build(byte[] data) { ByteBuffer buf = ByteBuffer.wrap(data); for (int i = 0; i < this.__flag.Length; i++) { this.__flag[i] = buf.get(); } if (this.hasClubId()) { this.clubId = buf.getInt(); } if (this.hasContent()) { byte[] bytes = new byte[buf.getInt()]; buf.get(ref bytes, 0, bytes.Length); this.content = bytes; } if (this.hasTypeId()) { this.typeId = (ENUM_PLAYER_MESSAGE)buf.get(); } }
/// <summary> /// 客户端发送消息 /// </summary> /// <param name="message"></param> private void ClientSendMessage(ENUM_PLAYER_MESSAGE type, string message, int toPlayerId) { OP_PLAYER_MESSAGE_GET proto = new OP_PLAYER_MESSAGE_GET(); proto.typeId = type; proto.content = System.Text.Encoding.UTF8.GetBytes(message); proto.toId = toPlayerId; NetWorkSocket.Instance.Send(proto.encode(), OP_PLAYER_MESSAGE_GET.CODE, GameCtrl.Instance.SocketHandle); }
/// <summary> /// 互动表情点击 /// </summary> /// <param name="type"></param> /// <param name="message"></param> /// <param name="toPlayerId"></param> public void OnInteractiveClick(ENUM_PLAYER_MESSAGE type, string message, int toPlayerId, string audioName) { GameCtrl.Instance.OnReceiveMessage(ChatType.InteractiveExpression, AccountProxy.Instance.CurrentAccountEntity.passportId, message, audioName, toPlayerId); ClientSendMessage(type, message, toPlayerId); }