public override void Initialize() { m_SoundSettings = this.Game.Services.GetService(typeof(IGameSettings)) as ISoundSettings; createToggleSoundMenuItem(m_SoundSettings.IsMuted()); createBackgroundMusicVolumeMenuItem(); createSoundEffectsVolumeMenuItem(); CreateDoneMenuItem(); base.Initialize(); }
public void AddMusicBed(ISoundSettings soundSettings, int position = 0) { if (soundSettings.Type != SoundType.MusicBed) { throw new ArgumentException("sound must be a music bed"); } var sound = _soundFactory.Create(soundSettings); _musicBeds.Insert(position, sound); }
public void AddSoundEffect(ISoundSettings soundSettings, int position = 0) { if (soundSettings.Type != SoundType.SoundEffect) { throw new ArgumentException("sound must be a sound effect"); } var sound = _soundFactory.Create(soundSettings); _soundEffects.Insert(position, sound); }
//add stuff public void AddAmbientSound(ISoundSettings soundSettings, int position = 0) { if (soundSettings.Type != SoundType.AmbientSound) { throw new ArgumentException("sound must be an ambient sound type"); } var sound = _soundFactory.Create(soundSettings); _ambientSounds.Insert(position, sound); }
public override void Update(GameTime gameTime) { bool doUpdate = true; switch (this.State) { case eScreenState.Activating: case eScreenState.Deactivating: case eScreenState.Closing: UpdateTransition(gameTime); break; case eScreenState.Active: break; case eScreenState.Inactive: case eScreenState.Closed: doUpdate = false; break; default: break; } if (doUpdate) { base.Update(gameTime); ISoundSettings gameSettings = (this.Game.Services.GetService(typeof(IGameSettings)) as ISoundSettings); if (gameSettings != null) { if (InputManager.KeyPressed(Keys.M)) { gameSettings.SetIsMuted(!gameSettings.IsMuted()); } } if (PreviousScreen != null && !this.IsModal) { PreviousScreen.Update(gameTime); } foreach (KeyValuePair <Keys, NamedAction> keyAndAction in m_ActivationKeys) { if (InputManager.KeyPressed(keyAndAction.Key)) { keyAndAction.Value.Action.Invoke(); } } } }
public async Task SaveSoundSettingsAsync(ISoundSettings soundSettings) { var resolver = new MappedContractResolver(); resolver.Mapping.Map("Filename").Ignore(); var json = JsonConvert.SerializeObject(soundSettings, Formatting.Indented, new JsonSerializerSettings() { ContractResolver = resolver }); var filename = GetFilename(soundSettings); await FileAsync.WriteAllTextAsync(filename, json); await WriteSoundSettingsToCache(filename, _cache); }
public Sound(ISoundSettings soundSettings, ISoundService soundService) { //first, create the audio track AudioTrack = soundService.AudioEngine.AddAudioTrack(soundSettings.AudioFile); //set the name as the sound name initially Name = soundSettings.Name; //need to save the audio file for later AudioFile = soundSettings.AudioFile; Type = soundSettings.Type; //settings for audio track AudioTrack.Loop = soundSettings.LoopEnabled; AudioTrack.MultipartLoopEnabled = soundSettings.MultipartLoopEnabled; AudioTrack.MultipartLoop = soundSettings.MultipartLoopSettings; }
private string GetFilename(ISoundSettings soundSettings) { var name = $"{GetTypeAbbreviation(soundSettings.Type)}-{soundSettings.Name.ToLower().SpacesToDashes()}"; var filename = Path.Combine(_path, $"{name}.{FILE_EXTENSION}"); var index = 1; while (File.Exists(filename)) { var indexedName = $"{GetTypeAbbreviation(soundSettings.Type)}-{soundSettings.Name.ToLower().SpacesToDashes()}-{index}"; filename = Path.Combine(_path, $"{indexedName}.{FILE_EXTENSION}"); index++; } return(filename); }
public SoundLibraryViewSoundSetting(ISoundSettings soundSettings) { _soundSettings = soundSettings; }
public SoundLibrarySelectedItemChanged(ISoundSettings soundSettings) { _soundSettings = soundSettings; }
private void OnSoundLibrarySelectedItemChanged(ISoundSettings obj) { }
public void DeleteSoundSettings(ISoundSettings soundSettings) { throw new NotImplementedException(); }