private void OnResourceStart() { // Create a JustAnotherVoiceServer based GtmpVoice Server! var hostname = API.getResourceSetting <string>("justanothervoicechat", "voice_host"); var port = API.getResourceSetting <ushort>("justanothervoicechat", "voice_port"); var teamspeakServerId = API.getResourceSetting <string>("justanothervoicechat", "voice_teamspeak_serverid"); var teamspeakChannelId = API.getResourceSetting <ulong>("justanothervoicechat", "voice_teamspeak_channelid"); var teamspeakChannelPassword = API.getResourceSetting <string>("justanothervoicechat", "voice_teamspeak_channelpassword"); _voiceServer = GtmpVoice.CreateServer(API, new VoiceServerConfiguration(hostname, port, teamspeakServerId, teamspeakChannelId, teamspeakChannelPassword)); // Enables 3D Voice _voiceServer.AddTask(new GtmpPositionalTask()); // Attach to some IVoiceServer events to react to certain them with certain actions. AttachToVoiceServerEvents(); // Attach to GTMP-Events, so the connection works and camera rotation updates. AttachToGtmpEvents(true); _radioHandler = new RadioHandler(); _phoneHandler = new TelephoneHandler(_voiceServer); // Startup VoiceServer, so players are able to connect. _voiceServer.Start(); }
private void OnResourceStop() { API.onResourceStop -= OnResourceStop; API.onResourceStart -= OnResourceStart; _radioHandler = null; _phoneHandler = null; _voiceServer.Stop(); _voiceServer.Dispose(); }
public void UseRepositoryWhenRadioIsDeleted() { // arrange var mockedRadioRepository = RadioRepositoryBuilder.Create(); mockedRadioRepository.Radios.Add(("djam", new Uri("http://djam.fr"))); var radioRepository = mockedRadioRepository.Build(); var radioHandler = new RadioHandler(radioRepository); // act radioHandler.Handle(new RadioDeleted("djam")); // assert Assert.AreEqual(0, mockedRadioRepository.Radios.Count); }
public void UseRepositoryWhenRadioIsCreated() { // arrange var mockedRadioRepository = RadioRepositoryBuilder.Create(); var radioRepository = mockedRadioRepository.Build(); var radioHandler = new RadioHandler(radioRepository); (string name, Uri url) = ("djam", new Uri("http://djam.fr")); // act radioHandler.Handle(new RadioCreated("djam", new Uri("http://djam.fr"))); // assert var(actualName, actualUrl) = mockedRadioRepository.Radios.First(); Assert.AreEqual(name, actualName); Assert.AreEqual(url, actualUrl); }