Beispiel #1
0
 public void SetWhisperGroup(GroupWhisperType type, GroupWhisperTarget target, ulong targetId = 0)
 {
     ClearData();
     SendMode = TargetSendMode.WhisperGroup;
     setMeta.GroupWhisperType   = type;
     setMeta.GroupWhisperTarget = target;
     setMeta.TargetId           = targetId;
 }
Beispiel #2
0
        public void SendAudioGroupWhisper(ReadOnlySpan <byte> data, Codec codec, GroupWhisperType type, GroupWhisperTarget target, ulong targetId = 0)
        {
            // [X,X,Y,N,M,U,U,U,U,U,U,U,U,DATA]
            // > X is a ushort in H2N order of an own audio packet counter
            //     it seems it can be the same as the packet counter so we will let the packethandler do it.
            // > Y is the codec byte (see Enum)
            // > N is a byte, specifying the GroupWhisperType
            // > M is a byte, specifying the GroupWhisperTarget
            // > U is a ulong in H2N order for the targeted channelId or groupId (0 if not applicable)
            byte[] tmpBuffer = new byte[data.Length + 13];
            tmpBuffer[2] = (byte)codec;
            tmpBuffer[3] = (byte)type;
            tmpBuffer[4] = (byte)target;
            NetUtil.H2N(targetId, tmpBuffer, 5);
            data.CopyTo(new Span <byte>(tmpBuffer, 13));

            packetHandler.AddOutgoingPacket(tmpBuffer, PacketType.VoiceWhisper, PacketFlags.Newprotocol);
        }
Beispiel #3
0
        public void SendAudioGroupWhisper(ReadOnlySpan <byte> data, Codec codec, GroupWhisperType type, GroupWhisperTarget target, ulong targetId = 0)
        {
            // [X,X,Y,N,M,U,U,U,U,U,U,U,U,DATA]
            // > X is a ushort in H2N order of an own audio packet counter
            //     it seems it can be the same as the packet counter so we will let the packethandler do it.
            // > Y is the codec byte (see Enum)
            // > N is a byte, specifying the GroupWhisperType
            // > M is a byte, specifying the GroupWhisperTarget
            // > U is a ulong in H2N order for the targeted channelId or groupId (0 if not applicable)
            var tmpBuffer     = new byte[data.Length + 13];
            var tmpBufferSpan = tmpBuffer.AsSpan();             // stackalloc

            tmpBuffer[2] = (byte)codec;
            tmpBuffer[3] = (byte)type;
            tmpBuffer[4] = (byte)target;
            BinaryPrimitives.WriteUInt64BigEndian(tmpBufferSpan.Slice(5), targetId);
            data.CopyTo(tmpBufferSpan.Slice(13));

            packetHandler.AddOutgoingPacket(tmpBuffer, PacketType.VoiceWhisper, PacketFlags.Newprotocol);
        }
Beispiel #4
0
 public void SetGroupWhisper(GroupWhisperType type, GroupWhisperTarget target, ulong targetId = 0)
 {
     GroupWhisperType     = type;
     GroupWhisperTarget   = target;
     GroupWhisperTargetId = targetId;
 }