public SongSelect(int LibraryId) { this.LibraryId = LibraryId; SongLibrary = new SongLibrary(); InitializeComponent(); LoadSongList(); }
private void Save(object sender, EventArgs e) { var IsFormValid = ValidateForm(); CancelClicked = false; if (!IsFormValid) { return; } if (Mode == SongSelect.Modes.Create) { Setlist = new Setlist(); Setlist.SetlistEntries = new List <SetlistEntry>(); } Setlist.Title = SetlistTitle.Text; Setlist.Band = SetlistBand.SelectedValue.ToString(); DetermineSetOrder(); /****************************************************/ // In a larger volume situation, it would make sense // to build three lists: Add, Removed and Reorder. // Here we're talking about a set list, which likely has // fewer than 20 entries. So let's just do the easy thing, // Remove all of them and just add everything back into the // database. /****************************************************/ RemoveExistingSongs(); AddSelectedSongs(); var recordsUpdated = SongLibrary.SaveChanges(); Close(); }
public void TestInitialState() { SongLibrary db = this.GetLibrary(); Assert.IsFalse(db.HasSongs); Assert.AreEqual(0, db.MaxSongsToFetch); }
public SongSelect() { SongLibrary = new SongLibrary(); LibraryId = null; InitializeComponent(); LoadSongList(); }
private void refresh() { //todo show some animation during this transitioning = true; songNameList.Clear(); SongLibrary.cacheSongInfo(); //prob should make separate method since searching forces cache refresh lol. we are good coders dont worry foreach (var pair in SongLibrary.songInfos) { Text temp = new Text(Config.ClientSize, new Size(550, 35), new Point(0, 0)); /*SizeF temp1 = temp.getStringSize(pair.Value.Artist + " - " + pair.Value.SongName); * temp.TextureSize = new Size((int)temp1.Width, (int)temp1.Height);*/ temp.Update(pair.Value.Artist + " - " + pair.Value.SongName); temp.Shadow = true; SelectComponent sc = new SelectComponent(game, new Rectangle(-50, 0, 550, 90), pair.Value.Artist, pair.Value.SongName); sc.clickEvent += new Action <int, SelectComponent>(sc_clickEvent); SongPair sp = new SongPair(sc, pair.Value); songNameList.Add(sp); sc.index = songNameList.IndexOf(sp); } songNameList.Sort(new Comparison <SongPair>(delegate(SongPair f, SongPair j) { return(-f.Info.SongName.CompareTo(j.Info.SongName)); })); foreach (SongPair sp in songNameList) { sp.select.index = songNameList.IndexOf(sp); } }
async Task <IEnumerable <string> > SearchSongs() { // For reference, this is not just an ugly hack made out of laziness - I went and coded the entire thing // with pure async IO calls, going all the way down to TagLib. Ran it and theres a 50% chance statistical // crash coming from inside the implementation of await callbacks. So instead, we're just going to use // the ol' running a separate thread and polling its return value method. // F**k Xamarin. data.IsLoading = true; SongLibrary library = null; new Thread(new ThreadStart(() => library = data.MediaProvider.LoadLibrary())).Start(); while (library == null) { await Task.Delay(10); } try { return(SearchSongsInternal(library, data.Query).Select(x => x.Path)); } catch (InputMismatchException) { await DisplayAlert("Error", "Bad input!", "OK"); } catch (NoViableAltException) { await DisplayAlert("Error", "Other bad input!", "OK"); } finally { data.IsLoading = false; } return(null); }
public SongMaintenance() { SongLibrary = new SongLibrary(); InitializeComponent(); LoadLibraries(); Song = null; Mode = SongSelect.Modes.Create; }
protected void SortButton_Click(object sender, EventArgs e) { var songs = new string[] { TitleBox1.Text, TitleBox2.Text }; var songLib = new SongLibrary(songs); songLib.SortLibrary(); Label.Text = songLib.DisplaySongs(); }
public SetlistShow(int SetlistId) { InitializeComponent(); SongLibrary = new SongLibrary(); this.SetlistId = SetlistId; if (SetlistId > 0) { LoadSetlist(); } }
public void Initialize() { Fonts = new FontLibrary(gs); //LevelMaps = new LevelMapLibrary(gs); LevelScripts = new LevelScriptLibrary(gs); Songs = new SongLibrary(gs); SoundEffects = new SoundEffectLibrary(gs); Textures = new TextureLibrary(gs); Sprites = new SpriteLibrary(gs); Stories = new StoryLibrary(gs); }
public LibraryMaintenance() { SongLibrary = new SongLibrary(); Songs = new List <Song>(); InitializeComponent(); Errors = new Dictionary <String, String>(); Library = null; SongsAtStart = new ListView(); LoadSongList(Library); Mode = SongSelect.Modes.Create; }
public void TestBasicFetchAll() { SongLibrary db = this.GetLibrary(); db.MaxSongsToFetch = MAX_SONGS_TO_FETCH; db.LoadSongs(); db.WaitLoad(); Assert.IsTrue(db.HasSongs); Assert.AreEqual(db.Songs.Count, db.MaxSongsToFetch); }
public SetlistMaintenance() { SongLibrary = new SongLibrary(); InitializeComponent(); //Errors = new Dictionary<String, String>(); Setlist = null; SongsAtStart = new ListView(); LoadBands(); LoadSongs(null); Mode = SongSelect.Modes.Create; }
private void Save(object sender, EventArgs e) { var IsFormValid = ValidateForm(); CancelClicked = false; if (!IsFormValid) { return; } if (Mode == SongSelect.Modes.Create) { Song = new Song(); } Song.Title = SongTitle.Text; Song.Artist = SongArtist.Text; Song.Instrument = SongInstrument.SelectedItem.ToString(); Song.Key = SongKey.SelectedItem.ToString();; Song.Major = true; Song.Filepath = SongFilename.Text; if (SongFirstNote.SelectedItem != null) { Song.FirstNote = SongFirstNote.SelectedItem.ToString(); } else { Song.FirstNote = null; } if (Mode == SongSelect.Modes.Create) { SongLibrary.Songs.Add(Song); } // Another place where the small volume makes it not worth while to selectively remove. // Just remove them all and add them back in. foreach (var SItem in this.Libraries.Items) { var Library = SongLibrary.Libraries.Where(t => t.Title == SItem.ToString()).FirstOrDefault(); if (Library.Songs.Contains(Song)) { Library.Songs.Remove(Song); } } foreach (var SItem in this.Libraries.SelectedItems) { var Library = SongLibrary.Libraries.Where(t => t.Title == SItem.ToString()).FirstOrDefault(); if (!Library.Songs.Contains(Song)) { Library.Songs.Add(Song); } } SongLibrary.SaveChanges(); Close(); }
public void TestFetchCancelling() { SongLibrary db = this.GetLibrary(); db.DoneEvent += new EventHandler <ProgressEventArgs>(db_LoadingDoneEvent2); this.doneEventCalled = false; db.MaxSongsToFetch = MAX_SONGS_TO_FETCH; db.LoadSongs(); db.CancelLoad(); Assert.IsTrue(doneEventCalled); }
public void TestFetchUntriedSongs() { SongLibrary db = this.GetLibrary(); db.MaxSongsToFetch = MAX_SONGS_TO_FETCH; db.LoadSongs(); db.WaitLoad(); Assert.IsTrue(db.UntriedSongs.TrueForAll( delegate(Song s) { return(String.IsNullOrEmpty(s.Lyrics)); } )); }
private void Save(object sender, EventArgs e) { ErrorMessages.Visible = false; ErrorMessages.Rows.Clear(); var IsFormValid = ValidateForm(); CancelClicked = false; if (!IsFormValid) { return; } if (Mode == SongSelect.Modes.Create) { Library = new Library(); } Library.Title = LibraryTitle.Text; Library.Description = LibraryDescription.Text; if (Mode == SongSelect.Modes.Create) { SongLibrary.Libraries.Add(Library); } var Songs_Start = SongsAtStart.Items.Cast <ListViewItem>(); var Songs_End = SongsInLibrary.Items.Cast <ListViewItem>(); // Except() Items in the first set that don't appear in the second. var SongsToRemoveFromLibrary = Songs_Start.Except <ListViewItem>(Songs_End, new ListViewItemComparer()).ToList(); var SongsToAddToLibrary = Songs_End.Except <ListViewItem>(Songs_Start, new ListViewItemComparer()).ToList(); int SongId; foreach (ListViewItem SongToRemove in SongsToRemoveFromLibrary) { var rc = int.TryParse(SongToRemove.SubItems[3].Text, out SongId); if (rc) { Library.Songs.Remove(SongLibrary.Songs.Where(s => s.Id == SongId).FirstOrDefault()); } } // Update the list of songs. foreach (ListViewItem SongToAdd in SongsToAddToLibrary) { var rc = int.TryParse(SongToAdd.SubItems[3].Text, out SongId); if (rc) { Library.Songs.Add(SongLibrary.Songs.Where(s => s.Id == SongId).FirstOrDefault()); } } SongLibrary.SaveChanges(); Close(); }
public void TestFetchSongsWithoutLyrics() { SongLibrary db = this.GetLibrary(); db.MaxSongsToFetch = MAX_SONGS_TO_FETCH; db.LoadSongs(); db.WaitLoad(); Assert.IsTrue(db.SongsWithoutLyrics.TrueForAll( delegate(Song s) { return(String.IsNullOrEmpty(s.Lyrics) || s.Lyrics.StartsWith("Failed") || s.Lyrics.StartsWith("[[LyricsFetcher failed")); } )); }
private void Delete(object sender, EventArgs e) { if (Song == null) { MessageBox.Show("Not found"); } else { DialogResult rc = MessageBox.Show("Delete " + Song.Title + "?", "Confirm Delete", MessageBoxButtons.YesNoCancel); if (rc == DialogResult.Yes) { SongLibrary.Songs.Remove(Song); SongLibrary.SaveChanges(); Close(); } } }
private void DeleteSetlist(object sender, EventArgs e) { var lastSubItem = SetlistList.SelectedItems[0].SubItems.Count - 1; var SetlistId = int.Parse(SetlistList.SelectedItems[0].SubItems[lastSubItem].Text); Setlist setlist = SongLibrary.Setlists.Where(l => l.Id == SetlistId).FirstOrDefault(); var rc = MessageBox.Show("Are you sure you want to delete the library '" + setlist.Title + "'?", "Delete Setlist", MessageBoxButtons.YesNoCancel); if (rc == DialogResult.Yes) { foreach (var entry in setlist.SetlistEntries.ToList()) { SongLibrary.SetlistEntries.Remove(entry); } SongLibrary.Setlists.Remove(setlist); SongLibrary.SaveChanges(); } LoadSetlistList(); EnableButtons(sender, e); }
IEnumerable <Song> SearchSongsInternal(SongLibrary library, string query) { var stream = CharStreams.fromstring(query); var lexer = new HaGrammarLexer(stream); var tokens = new CommonTokenStream(lexer); var parser = new HaGrammarParser(tokens) { ErrorHandler = new BailErrorStrategy() }; var evaluator = new QueryEvaluator(library); try { return(evaluator.Visit(parser.query())); } catch (ParseCanceledException e) { throw e.InnerException; } }
// public event EventHandler<SongSelectedEventArgs> SongSelected; // TODO: Support for multiple devices? public Form1() { InitializeComponent(); SongLibrary = new SongLibrary(); SongSelectDlg = null; SetlistSelectDlg = null; LibrarySelectDlg = null; FootPedalMonitor = new HIDMonitor(); deviceConfigParms = new DeviceConfigParms(); if (String.IsNullOrEmpty(Properties.Settings.Default.ConfigFile)) { Properties.Settings.Default.ConfigFile = "DeviceConfig.xml"; } if (String.IsNullOrEmpty(Properties.Settings.Default.DeviceName)) { Properties.Settings.Default.DeviceName = "xxUSB NETVISTA FULL WIDTH KEYBOARD"; } deviceConfigParms.ConfigFile = Properties.Settings.Default.ConfigFile; deviceConfigParms.DeviceName = Properties.Settings.Default.DeviceName; InitializeDevice(deviceConfigParms); FootPedalMonitor.OnHidDeviceRead += this.HidDeviceRead; }
public void TestFetchEvents() { SongLibrary db = this.GetLibrary(); db.ProgessEvent += new EventHandler <ProgressEventArgs>(db_LoadingProgessEvent1); db.DoneEvent += new EventHandler <ProgressEventArgs>(db_LoadingDoneEvent1); this.doneEventCalled = false; for (int i = 0; i <= 100; i++) { this.progressPercentages[i] = i; } db.MaxSongsToFetch = Math.Max(100, MAX_SONGS_TO_FETCH); db.LoadSongs(); db.WaitLoad(); Assert.IsTrue(this.doneEventCalled); // We should have received one progress event for every value of percentage Assert.IsEmpty(this.progressPercentages.Keys); }
/// <summary> /// Refreshes the music lists for the UI when the SongLibrary's song list changes /// </summary> public void UpdateLists() { AllSongsControl.LibraryListView.ItemsSource = SongLibrary.GetOrderedListBySong(); PlaylistControl.PlaylistListBox.ItemsSource = null; PlaylistControl.PlaylistListBox.ItemsSource = SongLibrary.PlayListList; AlbumsControl.AlbumListBox.ItemsSource = SongLibrary.GetOrderedListByAlbum(); ICollectionView albumGroupView = CollectionViewSource.GetDefaultView(AlbumsControl.AlbumListBox.ItemsSource); albumGroupView.GroupDescriptions.Add(new PropertyGroupDescription("AlbumName")); ArtistsControl.ArtistListBox.ItemsSource = SongLibrary.GetOrderedListByArtist(); ICollectionView artistGroupView = CollectionViewSource.GetDefaultView(ArtistsControl.ArtistListBox.ItemsSource); artistGroupView.GroupDescriptions.Add(new PropertyGroupDescription("Artist")); GenresControl.GenreListBox.ItemsSource = SongLibrary.GetOrderedListByGenre(); ICollectionView genreGroupView = CollectionViewSource.GetDefaultView(GenresControl.GenreListBox.ItemsSource); genreGroupView.GroupDescriptions.Add(new PropertyGroupDescription("Genre")); UpdatePlayListContextMenuItems(); }
public void TestFetchCancelling2() { // This test isn't very reliable since it relies on timing. // It is supposed to test that cancelling a fetch during a progress event does in fact cancel the fetch. // But progress events are triggered asynchronously, so the fetching may actually finish successfully // before the progress events are processed. // We can "hide" this by making sure we fetch "enough" songs so that the progress events have a chance // to cancel the fetching. On my current machine, 200 is usually enough. // JPP 2008/01/14 SongLibrary db = this.GetLibrary(); db.ProgessEvent += new EventHandler <ProgressEventArgs>(db_LoadingProgessEvent2); db.DoneEvent += new EventHandler <ProgressEventArgs>(db_LoadingDoneEvent2); this.doneEventCalled = false; db.MaxSongsToFetch = Math.Max(200, MAX_SONGS_TO_FETCH); db.LoadSongs(); db.WaitLoad(); Assert.IsTrue(doneEventCalled); }
public void Load() { songLibrary = new SongLibrary(); songLibrary.songs = new List <Song>(); RyansMIDILibrary MIDI = new RyansMIDILibrary(); if (baked) //Files are set in the inspector { foreach (SongConfig config in bakedTracks) { LAVA lavaParser = new LAVA(); lavaParser.Load(config.songFile.bytes); //Debug.Log(lavaParser.oggOffset + " | " + lavaParser.oggLength + " | " + lavaParser.midiOffset + " | " + lavaParser.midiLength); //Parse MIDI Song midi = MIDI.LoadMIDI(lavaParser.midiData); for (int i = 0; i < 3; i++) { config.song.difficulties[i] = midi.difficulties[i]; } config.song.tempoEvents = midi.tempoEvents; //Parse OGG var audioConfig = new AudioLoaderConfig(); audioConfig.DataStream = new MemoryStream(lavaParser.oggData); config.song.loader = new AudioLoader(audioConfig); config.song.loader.StartLoading(); songLibrary.songs.Add(config.song); } } else //Files are downloaded to the persistent data path { } }
public LibraryApi() { userRepository = ApiConfiguration.UserRepository; songLibrary = ApiConfiguration.SongLibrary; }
public LibrarySelect() { SongLibrary = new SongLibrary(); InitializeComponent(); LoadLibraryList(); }
public override void onSwitched() { try { Client.PacketWriter.sendSongStart(Game.conn.Bw, Account.currentAccount.AccountName, "", "", (short)2, 0, 0, 0); } catch { } if (play) { game.Title = "Pulse | Play Selection"; playButton.Text = "Play"; newSongb.Enabled = false; newSongb.Visible = false; help.Enabled = false; help.Visible = false; } else { game.Title = "Pulse | Edit Selection"; playButton.Text = "Edit"; newSongb.Enabled = true; newSongb.Visible = true; help.Enabled = false; help.Visible = false; } SongLibrary.cacheSongInfo(); index = 0; for (int x = 0; x < songNameList.Count; x++) { if (songNameList[x].Info.SongName.Equals(Game.M.CurrentSong.SongName) && songNameList[x].Info.Dir.Equals(Game.M.CurrentSong.Dir)) { index = x; } } //currentSong = SongLibrary.loadSong(songNameList[index].Info); string bgString = ""; if (currentSong.FileVersion == 0) { bgString = currentSong.BgName; } else { bgString = currentSong.Charts[0].BgName; } background.useTexture("songs\\" + currentSong.Dir + "\\" + bgString); music = AudioManager.loadFromFile("songs\\" + currentSong.Dir + "\\" + currentSong.FileName); Music.Volume = 0.0f; targetVolume = Config.Volume / 100.0f; music.Speed = 0.0f; changed = true; Music.play(false, true); updateDiffs(); updateScoreLabels(0); changeSong(); for (int x = 0; x < songNameList.Count; x++) { songNameList[x].select.Bounds = new Rectangle(0, 246 + ((x - index) * 90), songNameList[x].select.Bounds.Width, songNameList[x].select.Bounds.Height); } }
public override void OnLoad(EventArgs e) { base.OnLoad(e); panel.Colour = new OpenTK.Graphics.Color4(0.3f, 0.3f, 0.3f, 0.0f); dim.Colour = new OpenTK.Graphics.Color4(0.0f, 0.0f, 0.0f, 0.0f); fsw.EnableRaisingEvents = true; fsw.IncludeSubdirectories = true; fsw.Created += new FileSystemEventHandler(fsw_Created); fsw.Changed += new FileSystemEventHandler(fsw_Created); fsw.Deleted += new FileSystemEventHandler(fsw_Deleted); fsw.Error += new ErrorEventHandler(fsw_Error); fsw.InternalBufferSize = 61440; //lets handle large changes ;D SongLibrary.cacheSongInfo(); game.KeyPress += new EventHandler <OpenTK.KeyPressEventArgs>(game_KeyPress); bgoverlay.Colour = new OpenTK.Graphics.Color4(0.0f, 0.0f, 0.0f, 0.5f); searchLabel = new Label(game, new Point(0, 700), ""); searchLabel.TextTexture.Shadow = true; searchInfoL = new Label(game, new Point(0, 700), "type to begin search.."); //searchInfoL.TextTexture.Shadow = true; searchInfoL.TextTexture.Colour = Color.White; onlineToggle = new ToggleButton(game, new Rectangle(Utils.getMX(780), 130, 50, 40), "O", delegate(int data) { Config.LocalScores = !Config.LocalScores; updateScoreLabels(0); }); prevPage = new Button(game, new Rectangle(Utils.getMX(835), 130, 50, 40), "<<", delegate(int data) { if (displayScores != null && scoreDisplayPage > 0) { scoreDisplayPage--; updateScoreLabels(scoreDisplayPage); } }); nextPage = new Button(game, new Rectangle(Utils.getMX(890), 130, 50, 40), ">>", delegate(int data) { if (displayScores != null && displayScores.Count > 0) //if count was 0 maxpage would be -1 { int maxpage = displayScores.Count / 8; if (displayScores.Count % 8 > 0) //if there's a remainder that means theres some extra scores to display so need new page { maxpage++; } maxpage--; //remember, scoredisplaypage is 0 based! if (scoreDisplayPage < maxpage) { scoreDisplayPage++; updateScoreLabels(scoreDisplayPage); /*if (scoreDisplayPage == maxpage) //finish later, faulty to have in a place like this * { * nextPage.Visible = false; * nextPage.Enabled = false; * }*/ } } }); if (!Config.LocalScores) { ((ToggleButton)onlineToggle).toggle(); } UIComponents.Add(prevPage); UIComponents.Add(nextPage); UIComponents.Add(onlineToggle); calibrateButton = new Button(game, new Rectangle(70, 768 - 170, 200, 50), "Calibrate offset", delegate(int data) { int tIndex = 0; for (int x = 0; x < currentSong.Charts.Count; x++) { if (currentSong.Charts[x].Name.Equals(diffs.BaseText.Line)) { tIndex = x; } } IngameScreen temp = (IngameScreen)game.screens["ingameScreen"]; try { uint flags = 0; flags = flags | (uint)(nfB.Selected ? 1 : 0); flags = flags | (uint)(autoB.Selected ? 2 : 0); flags = flags | (uint)(mirB.Selected ? 4 : 0); flags = flags | (uint)(hdB.Selected ? 8 : 0); temp.loadSong(SongLibrary.loadSong(songNameList[index].Info), tIndex, new Mods() { Speed = dtB.Selected ? 1.5 : 1.0, Flags = flags, Scroll = Config.PlaySpeed }, null, IngameScreen.PlayType.PLAY); Music.stop(); Game.setScreen(game.screens["ingameScreen"]); temp.Calibrate = true; game.Title = "Pulse | " + currentSong.Artist + " - " + currentSong.SongName + " [" + currentSong.Charts[tIndex].Name + "]"; } catch (Exception ex) { ErrorLog.log(ex); } }); calibrateButton.Visible = false; calibrateButton.Enabled = false; // int backpos = Config.ResWidth - 244;//Config.WideScreen? (int)((780d/1024d) * game.Width) : 780; backLabel = new Button(game, new Rectangle(Utils.getMX(780), 10, 220, 50), "Back", delegate(int data) { Game.setScreen(game.screens["menuScreen"]); }); help = new Button(game, new Rectangle(Utils.getMX(780), 130, 220, 50), "Help", delegate(int data) { new EditorHelp().ShowDialog(); Game.resetStates(); }); UIComponents.Add(help); newSongb = new Button(game, new Rectangle(Utils.getMX(780), 70, 220, 50), "New Song", delegate(int data) { new NewSong().ShowDialog(); Game.resetStates(); }); // UIComponents.Add(searchLabel); UIComponents.Add(backLabel); UIComponents.Add(newSongb); #region obsolete /*difficultyTexts[0] = new Text(Config.ClientSize, new Size(300, 33), new Point(0, 0)); * difficultyTexts[0].Update("3key"); * difficultyTexts[0].Shadow = true; * difficultyTexts[1] = new Text(Config.ClientSize, new Size(300, 33), new Point(0, 0)); * difficultyTexts[1].Update("4key"); * difficultyTexts[1].Shadow = true; * difficultyTexts[2] = new Text(Config.ClientSize, new Size(300, 33), new Point(0, 0)); * difficultyTexts[2].Update("6key"); * difficultyTexts[2].Shadow = true; * difficultyTexts[3] = new Text(Config.ClientSize, new Size(300, 33), new Point(0, 0)); * difficultyTexts[3].Update("7key"); * difficultyTexts[3].Shadow = true;*/ #endregion refresh(); index = 0; for (int x = 0; x < songNameList.Count; x++) { if (songNameList[x].Info.SongName.Equals(Game.M.CurrentSong.SongName) && songNameList[x].Info.Dir.Equals(Game.M.CurrentSong.Dir)) { index = x; } } changeSong(); selectionTexture = new Rect(new Rectangle(2, 250, 548, 28)); sel2 = new Rect(new Rectangle(0, 249, 552, 30)); searchBox = new Rect(new Rectangle(0, 700, Config.ResWidth, 30)); searchBox.Colour = new OpenTK.Graphics.Color4(0.27f, 0.509f, 0.705f, .8f); cover = new Rect(new Rectangle(Config.ResWidth - 300, 0, 300, 768)); cover.Colour = new OpenTK.Graphics.Color4(1f, 1f, 1f, .7f); scorebg = new Rect(new Rectangle((int)(Config.ResWidth - 324), 180, 295, 600), Skin.skindict["scoreback"]); sel2.Colour = new OpenTK.Graphics.Color4(0.0f, 0.0f, 0.0f, 1.0f); selectionTexture.Colour = new OpenTK.Graphics.Color4(0.25f, 0.0f, 1.0f, 1.0f); background = new Rect(new Rectangle(0, 0, Config.ResWidth, 768)); currentSong = SongLibrary.loadSong(songNameList[index].Info); string bgString = ""; if (currentSong.FileVersion == 0) { bgString = currentSong.BgName; } else { bgString = currentSong.Charts[0].BgName; } background.useTexture("songs\\" + currentSong.Dir + "\\" + bgString); music = AudioManager.loadFromFile("songs\\" + currentSong.Dir + "\\" + currentSong.FileName); Music.Volume = 0.0f; targetVolume = Config.Volume / 100.0f; changed = true; Music.PositionAsMilli = (long)Game.M.Music.PositionAsMilli; Music.play(false, true); if (play) { game.Title = "Pulse | Play Selection"; newSongb.Enabled = false; newSongb.Visible = false; help.Enabled = false; help.Visible = false; } else { game.Title = "Pulse | Edit Selection"; newSongb.Enabled = true; newSongb.Visible = true; } updateDiffs(); updateScoreLabels(0); // changeSong(); // index = 0; for (int x = 0; x < songNameList.Count; x++) { // if (songNameList[x].textData.Location.Y != 246 + ((x - index) * 33) && !songNameList[x].textData.Moving) // { songNameList[x].select.Bounds = new Rectangle(0, 246 + ((x - index) * 90), songNameList[x].select.Bounds.Width, songNameList[x].select.Bounds.Height); // Console.WriteLine(songNameList[x].textData.Position. // } //Console.WriteLine("why"); List <string> t = new List <String>(); t.Add(" "); diffs = new DropDownBox(game, t, new Rectangle(70, 120, 150, 35)); diffs.selected += new Action <int>(diffs_selected); string tempS = ""; if (play) { tempS = "Play"; } else { tempS = "Edit"; } playButton = new Button(game, new Rectangle(290 + 220, 768 - 170, 200, 50), tempS, delegate(int data) { if (pickDiff) { int tIndex = 0; for (int x = 0; x < currentSong.Charts.Count; x++) { if (currentSong.Charts[x].Name.Equals(diffs.BaseText.Line)) { tIndex = x; } } /*if (Config.AutoPlay && play) * { * ReplayScreen temp = (ReplayScreen)game.screens["replayScreen"]; * try * { * temp.loadSong(SongLibrary.loadSong(songNameList[index].Info), tIndex); * Game.M.setSong(songNameList[index].Info); * Game.M.play(); * Music.stop(); * Game.setScreen(game.screens["replayScreen"]); * game.Title = "Pulse | Watch replay | " + currentSong.Artist + " - " + currentSong.SongName + " [" + currentSong.Charts[tIndex].Name + "]"; * } * catch { } * } * else */if (play) { IngameScreen temp = (IngameScreen)game.screens["ingameScreen"]; try { IngameScreen.PlayType te = IngameScreen.PlayType.PLAY; if (autoB.Selected) { te = IngameScreen.PlayType.AUTO; } uint flags = 0; flags = flags | (uint)(nfB.Selected ? 1 : 0); flags = flags | (uint)(autoB.Selected ? 2 : 0); flags = flags | (uint)(mirB.Selected ? 4 : 0); flags = flags | (uint)(hdB.Selected ? 8 : 0); temp.loadSong(SongLibrary.loadSong(songNameList[index].Info), tIndex, new Mods() { Speed = dtB.Selected ? 1.5 : 1.0, Flags = flags, Scroll = Config.PlaySpeed }, null, te); Game.M.setSong(ref songNameList[index].Info); Game.M.play(); Music.stop(); temp.Calibrate = false; Game.setScreen(game.screens["ingameScreen"]); game.Title = "Pulse | " + currentSong.Artist + " - " + currentSong.SongName + " [" + currentSong.Charts[tIndex].Name + "]"; scoreDisplayText.Clear(); scoreDisplayPage = 1; } catch (Exception ex) { ErrorLog.log(ex); } } else if (!play) { EditorScreen temp = (EditorScreen)game.screens["editScreen"]; try { temp.loadSong(SongLibrary.loadSong(songNameList[index].Info), tIndex); Game.M.setSong(ref songNameList[index].Info); Game.M.play(); Music.stop(); Game.setScreen(game.screens["editScreen"]); } catch (KeyNotFoundException) { } game.Title = "Pulse|Editor|" + currentSong.Artist + "-" + currentSong.SongName + "[" + currentSong.Charts[tIndex].Name + "]"; } } }); autoB = new ToggleButton(game, new Rectangle(874 - 480, 120, 100, 40), "Auto", delegate(int data) { Config.AutoPlay = autoB.Selected; }); dtB = new ToggleButton(game, new Rectangle(874 - 370, 120, 100, 40), "DT", delegate(int data) { Config.Dt = dtB.Selected; if (Config.Dt) { Config.Ht = false; if (htB.Selected) { htB.toggle(); } } }); htB = new ToggleButton(game, new Rectangle(874 - 260, 120, 100, 40), "HT", delegate(int data) { Config.Ht = htB.Selected; if (Config.Ht) { Config.Dt = false; if (dtB.Selected) { dtB.toggle(); } } }); mirB = new ToggleButton(game, new Rectangle(874 - 480, 170, 100, 40), "Mirror", delegate(int data) { Config.Mirror = mirB.Selected; }); hdB = new ToggleButton(game, new Rectangle(874 - 370, 170, 100, 40), "HD", delegate(int data) { Config.Hidden = hdB.Selected; }); nfB = new ToggleButton(game, new Rectangle(874 - 260, 170, 100, 40), "No fail", delegate(int data) { Config.NoFail = nfB.Selected; }); closeSel = new Button(game, new Rectangle(290, 768 - 170, 200, 50), "Close", delegate(int data) { notPickDiffs(); }); rateLabel = new Label(game, new Point(874 - 460, 370), "Scroll speed: " + Config.PlaySpeed); rateDrag = new Dragbar(game, new Point(874 - 460, 400), 300, false, delegate(int d) { double temp = rateDrag.getPercentScrolled(); int x = (int)(temp / 10); Config.PlaySpeed = ((float)x / 2) + 0.5f; rateLabel.Text = "Scroll speed: " + Config.PlaySpeed; }); rateDrag.setPos(rateDrag.Bounds.X + (int)(Config.PlaySpeed * 20) + rateDrag.Bounds.Width / 10); game.Mouse.Move += new EventHandler <MouseMoveEventArgs>(Mouse_Move); }