Exemple #1
0
        // Tells both of the clients to play a sound effect
        private void _playSoundEffect(string sfxName)
        {
            // Make the packet
            PlaySoundEffectPacket packet = new PlaySoundEffectPacket();

            packet.SFXName = sfxName;

            _sendTo(LeftPlayer, packet);
            _sendTo(RightPlayer, packet);
        }
        public void Can_deserialize()
        {
            var rawPacket = FakePackets.Instantiate(new byte[]
            {
                0x54,       // packet id
                0x01,       // mode
                0x01, 0x3E, // sound id
                0x00, 0x00, // unknown
                0x06, 0xA5, // x
                0x04, 0xCB, // y
                0x00, 0x23, // z
            });

            var packet = new PlaySoundEffectPacket();

            packet.Deserialize(rawPacket);

            packet.Id.Should().Be((SoundId)0x13E);
            packet.Location.Should().Be(new Location3D(0x06A5, 0x04CB, 0));
        }
Exemple #3
0
        private Packet?FilterBlockedSounds(Packet rawPacket)
        {
            var sounds = filteredSounds;

            if (sounds != null)
            {
                if (rawPacket.Id == PacketDefinitions.PlaySoundEffect.Id)
                {
                    PlaySoundEffectPacket packet =
                        PacketDefinitionRegistry.Materialize <PlaySoundEffectPacket>(rawPacket);

                    var ev = new SoundEffectPlayedEvent(packet.Id, packet.Location);
                    eventJournalSource.Publish(ev);

                    if (sounds.Contains(packet.Id))
                    {
                        return(null);
                    }
                }
            }

            return(rawPacket);
        }
Exemple #4
0
        private void ReceivePlaySoundEffect(IRecvPacket packet)
        {
            PlaySoundEffectPacket p = (PlaySoundEffectPacket)packet;

            UltimaData.SoundData.PlaySound(p.SoundModel);
        }