public void OnNewVoiceSample(VoiceChatPacket packet) { if (!GameManager.DoesLevelHaveSmartFoxRoom(GameManager.Inst.LevelLoaded) || !CommunicationManager.InASmartFoxRoom) { return; } Sfs2X.Util.ByteArray data = new Sfs2X.Util.ByteArray(); data.WriteBytes(packet.Data, 0, packet.Length); SendPacket(packet, data); }
private void OnHttpResponse(string rawData) { byte[] data = Convert.FromBase64String(rawData); ByteArray byteArray = new ByteArray(); ByteArray byteArray2 = new ByteArray(); byteArray.WriteBytes(data, 0, 16); byteArray2.WriteBytes(data, 16, 16); sfs.GetSocketEngine().CryptoKey = new CryptoKey(byteArray2, byteArray); Hashtable hashtable = new Hashtable(); hashtable["success"] = true; sfs.DispatchEvent(new SFSEvent(SFSEvent.CRYPTO_INIT, hashtable)); }
void SendPackets(Queue <VoiceChatPacket> packets) { if (packets.Count == 0) { return; } VoiceChatPacket v = new VoiceChatPacket(); Sfs2X.Util.ByteArray data = new Sfs2X.Util.ByteArray(); v.Length = 0; while (packets.Count > 0) { VoiceChatPacket packet = packets.Dequeue(); v.Compression = packet.Compression; data.WriteBytes(packet.Data, 0, packet.Length); v.Length += packet.Length; v.NetworkId = packet.NetworkId; } SendPacket(v, data); }