private AudioClip LoadAndCacheAudioClip(string path, bool streamAudio) { if (!File.Exists(path)) { Debug.LogError("File does not exist: " + path); return(null); } AudioClip audioClip = AudioUtils.GetAudioClipUncached(path, streamAudio); if (audioClip == null) { Debug.LogError("Could not load not AudioClip from path: " + path); return(null); } AddAudioClipToCache(path, audioClip, streamAudio); return(audioClip); }
public void BroadcastCollisionAudio(CollisionAudioHitConfig config, AudioChannel channel, Vector3 pos, float rms, float pitch) { if (showDebug) { Debug.Log(base.name + " Broadcast Collision Audio "); } float num = AudioUtils.ValueToDB(rms) + 32f; if (num < -64f) { return; } if (identity == null) { Debug.LogErrorFormat(this, "No NetIdentity for {0}", base.name); return; } NetStream netStream = identity.BeginEvent(evtCollisionAudio); netStream.Write(config.netId, 8); if (channel == AudioChannel.Footsteps) { netStream.Write(v: true); } else { netStream.Write(v: false); if (channel == AudioChannel.Body) { netStream.Write(v: true); } else { netStream.Write(v: false); } } Vector3 vec = pos - base.transform.position; NetVector3.Quantize(vec, 100f, 10).Write(netStream, 3); netStream.Write(NetFloat.Quantize(AudioUtils.ValueToDB(rms) + 32f, 64f, 6), 6); netStream.Write(NetFloat.Quantize(AudioUtils.RatioToCents(pitch), 4800f, 8), 3, 8); identity.EndEvent(); }
/// ------------------------------------------------------------------------------------ public void BeginPlayback() { if (!AudioUtils.GetCanPlaybackAudio()) { return; } _player = new AudioPlayer(); _player.Stopped += (sender, e) => { _player.Dispose(); _player = null; if (UpdateAction != null) { UpdateAction(sender, e); } }; _player.LoadFile(_path); _player.StartPlaying(); }
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { base.OnNavigatingFrom(e); UnsubscribeToCaptureEvents(); SystemNavigationManager.GetForCurrentView().BackRequested -= OnBackRequested; if (SettingsService.Instance.IsRememberMapZoomEnabled) { SaveZoomLevel(); } SettingsService.Instance.MapPitch = GameMapControl.Pitch; SettingsService.Instance.MapHeading = GameMapControl.Heading; AudioUtils.SoundEnded -= AudioUtils_SoundEnded; if (e.NavigationMode == NavigationMode.Back) { AudioUtils.StopSounds(); } }
public void Move(Vector3 newPos) { if (HasSelection()) { Vector3 avgPos = Vector3.zero; int divisor = 0; List <Unit> units = new List <Unit>(); // Calculate average position foreach (Entity e in selection) { if (IsUnit(e)) { units.Add((Unit)e); avgPos += e.transform.position; divisor++; } } // All entities if (divisor == 0) { return; } avgPos /= divisor; // Offset Vector3 dif = newPos - avgPos; // Relative goal foreach (Unit u in units) { Vector3 newVector = u.transform.position + dif; newVector.y = u.transform.position.y; CmdOrderMove(u.GetComponent <NetworkIdentity>(), newVector, units.Count > 1); } AudioUtils.PlayClipAt(soundMove, transform.position, audioSource); Instantiate(clickEffect, newPos, Quaternion.identity); } }
/// ------------------------------------------------------------------------------------ private void HandleRecordedAnnotationButtonClick(object sender, EventArgs e) { if (!AudioUtils.GetCanRecordAudio()) { return; } ShowSegmentationDialog(delegate { var annotationType = (sender == _buttonCarefulSpeech ? AudioRecordingType.Careful : AudioRecordingType.Translation); if (AssociatedComponentFile.RecordAnnotations(FindForm(), annotationType) != null && ComponentFileListRefreshAction != null) { ComponentFileListRefreshAction(_file.PathToAnnotatedFile, null); } }); }
public byte[] GetSelectedWave() { // return all wave if nothing is selected. if (_partStart != -1 && _partEnd != -1) { int startWav = (_partStart >= _partEnd ? _partEnd : _partStart); int endWav = (_partStart >= _partEnd ? _partStart : _partEnd); startWav = getPosInWavBuffer(startWav); endWav = getPosInWavBuffer(endWav); if (endWav >= _bytes.Length) { endWav = _bytes.Length - 1; } return(AudioUtils.GetWavePart(_bytes, startWav, endWav, true)); } else { return(_bytes); } }
public override async Task Refresh() { var missingFiles = await AudioUtils.GetMissingFiles(new QuranAudioTrack { Surah = Surah, Ayah = 1, ReciterId = Reciter.Id }); if (missingFiles.Count == 0 || (missingFiles.Count == 1 && missingFiles.Contains("001001.mp3"))) { Exists = true; } else { Exists = false; } await base.Refresh(); }
private void criarBotaoRemover() { _RemoverRadarButton = new Image { Aspect = Aspect.AspectFit, Source = ImageSource.FromFile("menos.png"), WidthRequest = 180, HeightRequest = 180 }; AbsoluteLayout.SetLayoutBounds(_RemoverRadarButton, new Rectangle(0.93, 0.93, 0.2, 0.2)); AbsoluteLayout.SetLayoutFlags(_RemoverRadarButton, AbsoluteLayoutFlags.All); _RemoverRadarButton.GestureRecognizers.Add( new TapGestureRecognizer() { Command = new Command(() => { try { AudioUtils.stop(); if (RadarBLL.RadarAtual != null) { RadarBLL regraRadar = RadarFactory.create(); regraRadar.excluir(RadarBLL.RadarAtual); MensagemUtils.avisar("Radar excluído com sucesso."); RadarBLL.RadarAtual = null; } else { MensagemUtils.avisar("Nenhum radar selecionado."); } } catch (Exception e) { MensagemUtils.avisar(e.Message); } } ) }); }
void OnCollisionStay2D(Collision2D col) { bool hittedEnemy = DidHitEnemy(col); int hittedWall = DidHitWall(col); int avoidState = FLAG_STATE_DIE | FLAG_STATE_FALL_DIE | FLAG_STATE_FADE | FLAG_STATE_FADE_SLASH; if ((hittedWall > 0 || hittedEnemy) && (CurrentState & (avoidState)) == 0) { if (CurrentState == FLAG_STATE_RUN && hittedWall > 0) { killedBy = KilledBy.Wall; rigidbody.AddForce(new Vector2(-125f, 25.0f)); } else if (CurrentState == FLAG_STATE_JUMP && hittedWall == 2) { killedBy = KilledBy.Slip; rigidbody.AddForce(new Vector2(125f, 250f)); rigidbody.freezeRotation = false; rigidbody.gravityScale = 2; rigidbody.angularVelocity = -360; animator.SetTrigger("shouldFallDie"); } else if (CurrentState == FLAG_STATE_JUMP && hittedWall == 1) { killedBy = KilledBy.Wall; rigidbody.AddForce(new Vector2(-125f, 0.0f)); } else { killedBy = KilledBy.Mummy; rigidbody.AddForce(new Vector2(-125f, 25.0f)); } var utils = AudioUtils.GetInstance(); utils.StopSound(audioSource); utils.PlayOnce(audioSource, "hit6"); dieCommand.execute(); InputQueue.Clear(); } }
public IEnumerator Play(string resource, bool duckDrones) { currentSong = resource; float vol = 1f; for (int i = 0; i < songList.Length; i++) { if (songList[i].Equals(resource)) { vol = levels[i]; } } SoundLibrary.SerializedSample soundSample = new SoundLibrary.SerializedSample { builtIn = true, category = "Music", name = resource, loaded = true, vB = AudioUtils.DBToValue(vol) }; AudioClip audioClip = HFFResources.instance.GetMusicTrack(resource); yield return(null); SoundLibrary.SerializedClip clip = soundSample.AddClip(resource, resource, null, audioClip); lastSample = soundSample; base.soundSample = soundSample; if (base.isPlaying) { CrossfadeSound(clip, loop: false, 0f, crossfadeDuration, fadeoutDuration, fadeinDuration); } else { PlaySound(clip, loop: false); } if (duckDrones) { menuDrones.Duck(this); } loadCoroutine = null; }
private void OnAudioRecordingDataAvailable(object sender, WaveInEventArgs e) { short[] shorts = AudioUtils.BytesToShorts(e.Buffer); AudioEngineMicDataAvailable handler = this.OnMicDataAvailable; if (handler != null && this.enabled) { try { handler(shorts, this.audioRecorder.WaveFormat.SampleRate, this.audioRecorder.WaveFormat.Channels); } catch (Exception ex) { Logger.Log(LogLevel.Error, ex.Message); } } this.audioRecordingProvider.AddSamples(e.Buffer, 0, e.BytesRecorded); this.audioRecordingMeter.Read(new float[e.BytesRecorded], 0, e.BytesRecorded); }
public async Task Download() { // checking if need to download mp3 var missingFiles = await AudioUtils.GetMissingFiles(new QuranAudioTrack { Surah = Surah, Ayah = 1, ReciterId = Reciter.Id }); if (missingFiles.Count > 0) { string url = Reciter.ServerUrl; StorageFolder destination = await Reciter.GetStorageFolder(); await DownloadMultipleViaHttpClient( missingFiles.Select(f => Path.Combine(url, f)).ToArray(), destination, Resources.loading_audio); } await Refresh(); }
void CropBtnClick(object sender, EventArgs e) { VstHost host = VstHost.Instance; // crop the audio at silence float[] data = AudioUtils.CropAudioAtSilence(host.RecordedLeft.ToArray(), 0, false, 0); host.RecordedLeft.Clear(); host.RecordedLeft.AddRange(data); MaxResolutionTrackBar.Maximum = (int)this.waveDisplayUserControl1.MaxResolution; MaxResolutionTrackBar.TickFrequency = MaxResolutionTrackBar.Maximum / 10; MaxResolutionTrackBar.Value = (int)this.waveDisplayUserControl1.MaxResolution; StartPositionTrackBar.Maximum = (int)this.waveDisplayUserControl1.NumberOfSamples; StartPositionTrackBar.TickFrequency = StartPositionTrackBar.Maximum / 10; StartPositionTrackBar.Value = 0; this.waveDisplayUserControl1.Resolution = (int)this.waveDisplayUserControl1.MaxResolution; this.waveDisplayUserControl1.SetAudioData(host.RecordedLeft.ToArray()); }
void OnAudioFilterRead(float[] data, int channels) { if (!_voipPlaying) { return; } int sampleRate = AudioSettings.outputSampleRate; int dataLen = data.Length / channels; if (_voipBuffer == null || _voipBuffer.Length < Mathf.CeilToInt(dataLen / (sampleRate / 16000f))) { _voipBuffer = new float[Mathf.CeilToInt(dataLen / (AudioSettings.outputSampleRate / 16000f))]; Plugin.log.Debug($"Created new VoIP player buffer! Size: {dataLen}, Channels: {channels}, Resampling rate: {sampleRate / 16000f}x"); } int read = _voipFragQueue.Read(_voipBuffer, 0, Mathf.CeilToInt(dataLen / (sampleRate / 16000f))); AudioUtils.Resample(_voipBuffer, data, read, data.Length, 16000, sampleRate, channels); }
private void удалитьToolStripMenuItem_Click(object sender, EventArgs e) { int startWav = (_partStart >= _partEnd ? _partEnd : _partStart); int endWav = (_partStart >= _partEnd ? _partStart : _partEnd); if (startWav != -1 && endWav != -1) { startWav = getPosInWavBuffer(startWav); if (startWav < AudioUtils.WavHeadSize) { startWav = AudioUtils.WavHeadSize; } endWav = getPosInWavBuffer(endWav); if (endWav >= _bytes.Length) { endWav = _bytes.Length; } _bytes = AudioUtils.DeleteWavePart(_bytes, startWav, endWav); _audioFrame.Process(ref _bytes, true); _partStart = _partEnd = -1; updateWave(); } else { _img = null; Bitmap newPic = new Bitmap(100, PictureBox.Height); PictureBox.Image = newPic; this.Width = 100; _intervalLabels.Clear(); PictureBox.Refresh(); _bytes = null; _partStart = _partEnd = -1; //this.Dispose(); if (DeleteEvent != null) { DeleteEvent(this, e); } // Raise event also here } }
protected internal override void NodeGUI() { #if UNITY_EDITOR EditorGUILayout.BeginVertical("Box", GUILayout.ExpandHeight(true)); EditorGUILayout.BeginVertical("Box"); GUILayout.BeginHorizontal(); CharacterPotrait = (Sprite)EditorGUILayout.ObjectField(CharacterPotrait, typeof(Sprite), false, GUILayout.Width(65f), GUILayout.Height(65f)); CharacterName = EditorGUILayout.TextField("", CharacterName); GUILayout.EndHorizontal(); GUILayout.EndVertical(); EditorGUIUtility.labelWidth = 90; DialogID = EditorGUILayout.IntField("DialogID", DialogID, GUILayout.ExpandWidth(true)); GUILayout.Space(5); EditorStyles.textField.wordWrap = true; GUILayout.BeginHorizontal(); scroll = EditorGUILayout.BeginScrollView(scroll, GUILayout.Height(100)); DialogLine = EditorGUILayout.TextArea(DialogLine, GUILayout.ExpandHeight(true)); EditorGUILayout.EndScrollView(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUIUtility.labelWidth = 90; SoundDialog = EditorGUILayout.ObjectField("Dialog Audio:", SoundDialog, typeof(AudioClip), false) as AudioClip; if (GUILayout.Button("►", GUILayout.Width(20))) { if (SoundDialog) { AudioUtils.PlayClip(SoundDialog); } } GUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); #endif }
public void play(SomAlarmeEnum alarme) { var arquivoStr = Path.Combine(DIR_ALARME, pegarArquivo(alarme)) + ".mp3"; if (Device.OS == TargetPlatform.iOS) { AudioUtils.Volume = PreferenciaUtils.AlturaVolume; AudioUtils.Canal = PreferenciaUtils.CanalAudio; AudioUtils.CaixaSom = PreferenciaUtils.CaixaSom; AudioUtils.play(arquivoStr); } else { if (PreferenciaUtils.CanalAudio != AudioCanalEnum.Notificacao) { AudioUtils.Volume = PreferenciaUtils.AlturaVolume; AudioUtils.Canal = PreferenciaUtils.CanalAudio; AudioUtils.CaixaSom = PreferenciaUtils.CaixaSom; AudioUtils.play(arquivoStr); } } }
private void GameManagerViewModelOnShowSelectAvatarScreen(object sender, EventArgs e) { AudioUtils.PlaySound(AudioUtils.PROFESSOR); ProfessorDialog dialog = new ProfessorDialog(BackGroundType.Dark, false); dialog.Show(); dialog = new ProfessorDialog(BackGroundType.Dark, true); dialog.Messages.Add(new MessageEntry("Hello there! I am Professor Willow.", 60)); dialog.Messages.Add(new MessageEntry("Did you know that this world is inhabited by creatures known as Pokémon?", 90)); dialog.Messages.Add(new MessageEntry("Pokémon can be found in every corner of the earth.", 60)); dialog.Messages.Add(new MessageEntry("Some run across the plains, others fly through the skies, some live in the mountains, or in the forests, or near water...", 120)); dialog.Messages.Add(new MessageEntry("I have spent my whole life studying them and their regional distribution.", 60)); dialog.Messages.Add(new MessageEntry("Will you help me with my research?", 60)); dialog.Messages.Add(new MessageEntry("That's great! I was just looking for someone like you to help!", 60)); dialog.Messages.Add(new MessageEntry("You'll need to find and collect Pokémon from everywhere!", 60)); dialog.Messages.Add(new MessageEntry("Now, choose your style for your adventure.", 60)); dialog.Show(); ShowSelectAvatarStoryboard.Begin(); }
/// <summary> /// This runs everytime the app is launched, even after suspension, so we use this to initialize stuff /// </summary> /// <param name="args"></param> /// <returns></returns> public override async Task OnInitializeAsync(IActivatedEventArgs args) { #if DEBUG // Init logger Logger.SetLogger(new ConsoleLogger(LogLevel.Info)); #endif // If we have a phone contract, hide the status bar if (ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1, 0)) { var statusBar = StatusBar.GetForCurrentView(); await statusBar.HideAsync(); } // Enter into full screen mode ApplicationView.GetForCurrentView().TryEnterFullScreenMode(); ApplicationView.GetForCurrentView().FullScreenSystemOverlayMode = FullScreenSystemOverlayMode.Standard; // Forces the display to stay on while we play //_displayRequest.RequestActive(); WindowWrapper.Current().Window.VisibilityChanged += WindowOnVisibilityChanged; // Init vibration device if (ApiInformation.IsTypePresent("Windows.Phone.Devices.Notification.VibrationDevice")) { _vibrationDevice = VibrationDevice.GetDefault(); } if (SettingsService.Instance.LiveTileMode == LiveTileModes.Peek) { LiveTileUpdater.EnableNotificationQueue(true); } // Respond to changes in inventory and Pokemon in the immediate viscinity. GameClient.PokemonsInventory.CollectionChanged += PokemonsInventory_CollectionChanged; GameClient.CatchablePokemons.CollectionChanged += CatchablePokemons_CollectionChanged; await AudioUtils.PlaySound(@"Gameplay.mp3"); await Task.CompletedTask; }
private async void AudioPlay(object sender, RoutedEventArgs e) { int currentQari = AudioUtils.GetReciterIdByName(SettingsUtils.Get <string>(Constants.PREF_ACTIVE_QARI)); if (currentQari == -1) { Frame.Navigate(typeof(RecitersListView), null, new DrillInNavigationTransitionInfo()); } else { try { await ViewModel.Play(); UpdateAudioControls(AudioState.Playing); } catch (Exception ex) { telemetry.TrackException(ex); } } }
public void play(RadarTipoEnum tipoRadar, int velocidade, int distancia) { IList <string> audios = new List <string>(); if (PreferenciaUtils.BeepAviso) { audios.Add(Path.Combine(DIR_ALARME, pegarArquivo(PreferenciaUtils.SomAlarme) + ".mp3")); } audios.Add(Path.Combine(DIR_AUDIO, AUDIO_RADAR[tipoRadar])); if (velocidade > 0) { audios.Add(Path.Combine(DIR_AUDIO, AUDIO_VELOCIDADE[velocidade])); } if (distancia > 0) { audios.Add(Path.Combine(DIR_AUDIO, AUDIO_DISTANCIA[distancia])); } AudioUtils.Volume = PreferenciaUtils.AlturaVolume; AudioUtils.Canal = PreferenciaUtils.CanalAudio; AudioUtils.CaixaSom = PreferenciaUtils.CaixaSom; AudioUtils.play(audios.ToArray()); }
private void Grid_Tapped(object sender, TappedRoutedEventArgs e) { if (IgnoreGridTapped) { return; } Messages.RemoveAt(0); if (Messages.Count > 0) { CurrentMessage = Messages.FirstOrDefault(); DataContext = null; DataContext = this; AudioUtils.PlaySound(AudioUtils.MESSAGE); } else { Hide(); } }
/// ------------------------------------------------------------------------------------ private bool AttemptBeginAnnotationRecording(string path) { try { AudioUtils.NAudioExceptionThrown += HandleNAudioExceptionThrownDuringRecord; return(Recorder.BeginAnnotationRecording(path)); } catch (Exception e) { AudioUtils.NAudioExceptionThrown -= HandleNAudioExceptionThrownDuringRecord; var args = new CancelExceptionHandlingEventArgs(e); AudioUtils.HandleGlobalNAudioException(this, args); if (!args.Cancel) { ErrorReport.NotifyUserOfProblem(e, LocalizationManager.GetString( "DialogBoxes.Transcription.OralAnnotationRecorderDlgBase.UnexpectedErrorAttemptingToRecordMsg", "An unexpected error occurred when attempting to record an annotation.")); } return(false); } }
/// ------------------------------------------------------------------------------------ private void HandleButtonNewFromRecordingsClick(object sender, EventArgs e) { if (!AudioUtils.GetCanRecordAudio()) { return; } using (var viewModel = new SessionRecorderDlgViewModel()) using (var dlg = new SessionRecorderDlg(viewModel)) { if (dlg.ShowDialog(FindForm()) != DialogResult.OK) { return; } var newSession = _model.CreateNewElement(); viewModel.MoveRecordingToSessionFolder(newSession); LoadElementList(newSession); SetFocusOnId(); } }
/// <summary> /// Displays the dialog modally /// </summary> public void Show() { WindowWrapper.Current().Dispatcher.Dispatch(() => { var modal = Window.Current.Content as ModalDialog; if (modal == null) { return; } _formerModalBrush = modal.ModalBackground; modal.ModalBackground = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)); modal.ModalContent = this; modal.IsModal = true; // animate Storyboard sb = this.Resources["ShowDialogStoryboard"] as Storyboard; sb.Begin(); AudioUtils.PlaySound(AudioUtils.MESSAGE); }); }
private void btnMicFollowing_Click(object sender, EventArgs e) { _musicFollower = new MusicalFollower(_musicHmmModelOnline, (int)nudTempo.Value, _musicXmlDecoder.BeatType, _musicXmlDecoder.Beats); _audioDecoder = new WaveMp3FileDecoder(); _audioDecoder.DetectLevelThreshold = AudioUtils.DecibelToPower(tbSoundAmplitude.Value); _waveIn = new WaveIn(); _waveIn.WaveFormat = new WaveFormat(44100, 1); _waveIn.DataAvailable += OnDataAvailable; _waveIn.RecordingStopped += OnRecordingStopped; var stopwatch = new Stopwatch(); TimeSpan oldTime = new TimeSpan(); lblPitchsCount.Text = "0"; _audioDecoder.InitRealtimeMode(_waveIn.WaveFormat.Channels, _waveIn.WaveFormat.BitsPerSample, _waveIn.WaveFormat.SampleRate, _musicFollower.GetTimerInterval((int)nudTempo.Value), (PitchTracker tracker, PitchRecord record) => { lblPitchsCount.Text = (int.Parse(lblPitchsCount.Text) + 1).ToString(); lblTime.Text = (stopwatch.Elapsed - oldTime).ToString(); oldTime = stopwatch.Elapsed; tbCurNoteName.Text = MusicalTemperament.MidiNoteToNoteName(record.MidiNote); tbCurMidiNote.Text = record.MidiNote <= -1 ? "-" : record.MidiNote.ToString(); tbCurHmmMidiNote.Text = _musicHmmData.MidiNoteToHmmMidiNote(record.MidiNote).ToString(); FollowObservation(record.MidiNote); }); _waveIn.StartRecording(); stopwatch.Start(); oldTime = stopwatch.Elapsed; timerMetronome.Interval = _musicFollower.GetMetronomeInterval((int)nudTempo.Value); timerMetronome.Start(); btnMicFollowing.Text = "Stop"; }
public override void NodeGUI() { EditorGUILayout.BeginVertical("Box"); GUILayout.BeginHorizontal(); CharacterPotrait = (Sprite)EditorGUILayout.ObjectField(CharacterPotrait, typeof(Sprite), false, GUILayout.Width(65f), GUILayout.Height(65f)); CharacterName = EditorGUILayout.TextField("", CharacterName); GUILayout.EndHorizontal(); LeftCharPortrait = (Sprite)EditorGUILayout.ObjectField(LeftCharPortrait, typeof(Sprite), false, GUILayout.Width(65f), GUILayout.Height(65f)); RightCharPortrait = (Sprite)EditorGUILayout.ObjectField(RightCharPortrait, typeof(Sprite), false, GUILayout.Width(65f), GUILayout.Height(65f)); stressLevel = EditorGUILayout.IntField("Stress", stressLevel, GUILayout.ExpandWidth(true)); lawLevel = EditorGUILayout.IntField("Law", lawLevel, GUILayout.ExpandWidth(true)); GUILayout.EndVertical(); GUILayout.Space(5); GUILayout.BeginHorizontal(); scroll = EditorGUILayout.BeginScrollView(scroll, GUILayout.Height(100)); EditorStyles.textField.wordWrap = true; DialogLine = EditorGUILayout.TextArea(DialogLine, GUILayout.ExpandHeight(true)); EditorStyles.textField.wordWrap = false; EditorGUILayout.EndScrollView(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUIUtility.labelWidth = 90; SoundDialog = EditorGUILayout.ObjectField("Dialog Audio:", SoundDialog, typeof(AudioClip), false) as AudioClip; if (GUILayout.Button("►", GUILayout.Width(20))) { if (SoundDialog) { AudioUtils.PlayClip(SoundDialog); } } GUILayout.EndHorizontal(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); SettingsFormShown(this, EventArgs.Empty); txtNetworkLogin.Text = mConfig.VatsimId; txtNetworkPassword.Text = mConfig.VatsimPassword; txtFullName.Text = mConfig.Name; txtHomeAirport.Text = mConfig.HomeAirport; ddlServerName.SelectedIndex = ddlServerName.FindStringExact(mConfig.ServerName); lblPTTValue.Text = mConfig.PTTConfiguration.ToString(); mNewPttConfiguration = mConfig.PTTConfiguration; mToggleDisplayConfig = mConfig.ToggleDisplayConfiguration; spinPluginPort.Value = mConfig.TcpPort; audioInputDevice.SelectedItem = mConfig.InputDeviceName; audioOutputDevice.SelectedItem = mConfig.OutputDeviceName; TrackCom1Volume.Value = (int)AudioUtils.ScaleVolumeDb(mConfig.Com1Volume, 0, 100, 0, 1); TrackCom2Volume.Value = (int)AudioUtils.ScaleVolumeDb(mConfig.Com2Volume, 0, 100, 0, 1); lblVolumeCom1.Text = mConfig.Com1Volume.ToString("0%"); lblVolumeCom2.Text = mConfig.Com2Volume.ToString("0%"); TrackInputVolumeDb.Value = (int)mConfig.InputVolumeDb; inputVolumeLabel.Text = mConfig.InputVolumeDb.ToString("+#;-#;0"); chkDisableRadioEffects.Checked = mConfig.DisableAudioEffects; chkFlashPrivateMessage.Checked = mConfig.FlashTaskbarPrivateMessage; chkFlashRadioMessage.Checked = mConfig.FlashTaskbarRadioMessage; chkFlashSelcal.Checked = mConfig.FlashTaskbarSelCal; chkFlashDisconnect.Checked = mConfig.FlashTaskbarDisconnect; chkAutoSquawkModeC.Checked = mConfig.AutoSquawkModeC; chkKeepVisible.Checked = mConfig.KeepClientWindowVisible; chkUpdates.Checked = mConfig.CheckForUpdates; chkSelcalSound.Checked = mConfig.PlayGenericSelCalAlert; chkRadioMessageSound.Checked = mConfig.PlayRadioMessageAlert; cbUpdateChannel.SelectedValue = mConfig.UpdateChannel; vhfEqualizer.SelectedValue = mConfig.VhfEqualizer; chkVolumeKnobVolume.Checked = mConfig.VolumeKnobsControlVolume; lblDisplayShortcut.Text = mConfig.ToggleDisplayConfiguration.ToString(); TogglePTTButtons(); ToggleDisplayKeyButtons(); }
private void OnCollisionEnter(Collision collision) { if (pickedUp) { speedCollision = GetComponent <Rigidbody>().velocity.magnitude; if (speedCollision > maxSpeedCollision) { maxSpeedCollision = speedCollision; } if (fragile && speedCollision > maxValueForHit) { gameManager.fragileBoxesHits += 1; AudioUtils.PlayClip2D(brokenGlassClip.GetRandomItem(), 1.0f); } float distance = Vector3.Distance(positionThrow, transform.position); if (distance > maxDistanceDone) { maxDistanceDone = distance; } if (gameManager.maximumThrowDistance < maxDistanceDone) { gameManager.maximumThrowDistance = maxDistanceDone; } if (distance > defaultThrowDistance) { gameManager.itemsThrown += 1; boxWasThrown = true; } else { boxWasThrown = false; } distance = 0; } pickedUp = false; }