public void PlayMusic(int music) { if (!_canReproduceAudio) { return; } if (music >= Constants.MAX_MUSIC_DATA_INDEX_COUNT) { return; } float volume; if (CUOEnviroment.Client.Scene is LoginScene) { if (!Settings.GlobalSettings.LoginMusic) { return; } volume = Settings.GlobalSettings.LoginMusicVolume / Constants.SOUND_DELTA; } else { if (ProfileManager.Current == null || !ProfileManager.Current.EnableMusic) { return; } volume = ProfileManager.Current.MusicVolume / Constants.SOUND_DELTA; } if (volume < -1 || volume > 1f) { return; } Sound m = UOFileManager.Sounds.GetMusic(music); if (m == null && _currentMusic != null) { StopMusic(); } else if (m != null && m != _currentMusic) { StopMusic(); _currentMusic = (UOMusic)m; _currentMusic.Play(false, volume: volume); } }
public void PlayMusic(int music) { if (music >= Constants.MAX_MUSIC_DATA_INDEX_COUNT) { return; } float volume; if (Engine.SceneManager.CurrentScene is LoginScene) { if (!Engine.GlobalSettings.LoginMusic) { return; } volume = Engine.GlobalSettings.LoginMusicVolume / Constants.SOUND_DELTA; } else { if (Engine.Profile == null || Engine.Profile.Current == null || !Engine.Profile.Current.EnableMusic) { return; } volume = Engine.Profile.Current.MusicVolume / Constants.SOUND_DELTA; } if (volume < -1 || volume > 1f) { return; } Sound m = FileManager.Sounds.GetMusic(music); if (m == null && _currentMusic != null) { StopMusic(); } else if (m != null && m != _currentMusic) { StopMusic(); _currentMusic = (UOMusic)m; _currentMusic.Play(false, volume: volume); } }
public static void PlaySound(string file) { Profile currentProfile = ProfileManager.CurrentProfile; if (currentProfile == null) { return; } float volume = currentProfile.SoundVolume / Constants.SOUND_DELTA; if (Client.Game.IsActive) { if (!currentProfile.ReproduceSoundsInBackground) { volume = currentProfile.SoundVolume / Constants.SOUND_DELTA; } } else if (!currentProfile.ReproduceSoundsInBackground) { volume = 0; } if (volume < -1 || volume > 1f) { return; } if (!currentProfile.EnableSound || !Client.Game.IsActive && !currentProfile.ReproduceSoundsInBackground) { volume = 0; } try { // full path will be: \UoMarsClient/Music/Digital/UoMars/file.mp3 UOMusic music = new UOMusic(0, "UoMars/" + file, false); music.Play(volume); } catch (Exception e) {} }
public void PlayMusic(int music) { float volume; if (Engine.SceneManager.CurrentScene is LoginScene) { if (!Engine.GlobalSettings.LoginMusic) { return; } volume = Engine.GlobalSettings.LoginMusicVolume / 100f; } else { if (Engine.Profile == null || Engine.Profile.Current == null || !Engine.Profile.Current.EnableMusic) { return; } volume = Engine.Profile.Current.MusicVolume / 100f; } if (volume < 0.01f || volume > 1f) { return; } Sound m = FileManager.Sounds.GetMusic(music); if (m == null && _currentMusic != null) { StopMusic(); } else if (m != null && m != _currentMusic) { StopMusic(); _currentMusic = (UOMusic)m; _currentMusic.Play(false, volume: volume); } }