// Use this for initialization void Awake() { if (PlayerPrefs.GetInt("ViolenceMusic") == 1) { GlobalMusic.ViolenceMusic(); //Debug.Log("Violence Music: " + PlayerPrefs.GetInt ("ViolenceMusic")); } else { if (Application.loadedLevelName == "Biker_Bar_Scene1" || Application.loadedLevelName == "Biker_Bar_Scene2" || Application.loadedLevelName == "Biker_Bar_Scene3") { GlobalMusic.BikerBarMusic(); } else if (Application.loadedLevelName == "Beach_Bar_Scene1" || Application.loadedLevelName == "Beach_Bar_Scene2" || Application.loadedLevelName == "Beach_Bar_Scene3") { GlobalMusic.LuauMusic(); } else if (Application.loadedLevelName == "Club_Bar_Scene1" || Application.loadedLevelName == "Club_Bar_Scene2" || Application.loadedLevelName == "Club_Bar_Scene3") { GlobalMusic.RaveMusic(); } else { GlobalMusic.ViolenceMusic(); } } //Debug.Log ("Levelnum: " + GlobalMusic.LEVELNUM); }
void Awake() { m_instance = this; }
private void DeleteSongMain_Executed(object obj) { int delcount = SelectedGlobalMusic.Count(); if (MessageBox.Show("Wollen Sie die (" + delcount + ") ausgewählten Lieder, wirklich aus der Datenbank entfernen?", "Sicher?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes) { var musicDeleteList = new List <Title>(SelectedGlobalMusic); var deleteWindow = InitiateWindow(Templates["Delete"], musicDeleteList.Count()); deleteWindow.Show(); foreach (var song in musicDeleteList) { UpdateWindow(deleteWindow); #region CurrentAlbum Nullable <Int32> currentAlbumId = null; if (song.Albumtitles != null && song.Albumtitles.Any()) { var currentAlbum = song.Albumtitles.FirstOrDefault(); if (currentAlbum != null) { currentAlbumId = currentAlbum.AlbumId; } } #endregion #region CurrentArtist Nullable <Int32> currentArtistId = null; if (song.Artists != null && song.Artists.Any()) { var currentArtist = song.Artists.FirstOrDefault(); if (currentArtist != null) { currentArtistId = currentArtist.Id; } } #endregion //Genre löschen var IsGenreExist = GlobalMusic.Where(g => g.Id != song.Id).Any(g => g.Genre == song.Genre); if (!IsGenreExist && song.Genre.HasValue) { db.Genres.Remove(db.Genres.First(g => g.Id == song.Genre.Value)); } //Lied aus DB löschen db.Titles.Remove(song); //Album löschen if (currentAlbumId.HasValue) { var IsAlbumExists = db.Titles.Where(t => t.Id != song.Id).Any(t => t.Albumtitles.Any(a => a.AlbumId == currentAlbumId)); if (!IsAlbumExists) { var album = db.Albums.FirstOrDefault(a => a.Id == currentAlbumId); if (album != null) { db.Albums.Remove(album); } } var albumtitle = db.Albumtitles.FirstOrDefault(a => a.AlbumId == currentAlbumId); if (albumtitle != null) { db.Albumtitles.Remove(albumtitle); } } //Künstler löschen if (currentArtistId.HasValue) { var IsArtistExist = db.Titles.Where(t => t.Id != song.Id).Any(t => t.Artists.Any(a => a.Id == currentArtistId)); if (!IsArtistExist) { var artist = db.Artists.FirstOrDefault(a => a.Id == currentArtistId); db.Artists.Remove(artist); } } db.SaveChanges(); } db.SaveChanges(); this._ArtistCollection = null; UpdateGlobalMusicCollection(); CloseWindow(deleteWindow); } }