public virtual CSong GetSong() { if (_CurrentSong >= 0 && _CurrentSong < _SongQueque.Count) { CSong song = CSongs.GetSong(_SongQueque[_CurrentSong].SongID); song = new CSong(song); switch (GetCurrentGameMode()) { case EGameMode.TR_GAMEMODE_MEDLEY: // set medley mode timings song.Start = CGame.GetTimeFromBeats(song.Medley.StartBeat, song.BPM) - song.Medley.FadeInTime + song.Gap; if (song.Start < 0f) { song.Start = 0f; } song.Finish = CGame.GetTimeFromBeats(song.Medley.EndBeat, song.BPM) + song.Medley.FadeOutTime + song.Gap; // set lines to medley mode song.Notes.SetMedley(song.Medley.StartBeat, song.Medley.EndBeat); break; case EGameMode.TR_GAMEMODE_SHORTSONG: song.Finish = CGame.GetTimeFromBeats(song.ShortEnd, song.BPM) + CSettings.DefaultMedleyFadeOutTime + song.Gap; // set lines to medley mode song.Notes.SetMedley(song.Notes.GetLines(0).Line[0].FirstNoteBeat, song.ShortEnd); break; } return(song); } return(null); }
public virtual CSong GetSong() { if (_ActualSong >= 0 && _ActualSong < _SongIDs.Count) { return(CSongs.GetSong(_SongIDs[_ActualSong])); } return(null); }
public virtual CSong GetSong(int Num) { if (Num - 1 < _SongIDs.Count) { return(CSongs.GetSong(_SongIDs[Num - 1])); } return(null); }
public virtual CSong GetSong(int Num) { if (Num - 1 < _SongQueque.Count && Num - 1 > -1) { return(CSongs.GetSong(_SongQueque[Num - 1].SongID)); } return(null); }
public CSong GetSong(int songID) { if (songID != _LastSongID) { CSong song = CSongs.GetSong(songID); _LastSong = _PrepareSong(song); _LastSongID = songID; } return(_LastSong); }
public void AddSong(int songID) { var song = new CPlaylistSong { SongID = songID, GameMode = CSongs.GetSong(songID).IsGameModeAvailable(EGameMode.TR_GAMEMODE_DUET) ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL }; Songs.Add(song); }
private bool _AddSong(int songID, EGameMode gameMode) { if (!CSongs.GetSong(songID).IsGameModeAvailable(gameMode)) { return(false); } _SongQueue.Add(new SSongQueueEntry(songID, gameMode)); return(true); }
private int _GetDataBaseSongID(int songID, SQLiteCommand command) { CSong song = CSongs.GetSong(songID); if (song == null) { return(-1); } return(_GetDataBaseSongID(song.Artist, song.Title, 0, command)); }
private void _UpdateRound() { _IsDuet = false; CPoints points = CGame.GetPoints(); CSong song; if (_FromScreenSong) { song = CSongs.GetSong(CScreenSong.getSelectedSongID()); } else { song = CGame.GetSong(_Round); } if (song == null) { return; } _Texts[_TextSongName].Text = song.Artist + " - " + song.Title; if (points != null && !_FromScreenSong && points.NumRounds > 1) { _Texts[_TextSongName].Text += " (" + (_Round + 1) + "/" + points.NumRounds + ")"; } switch ((_FromScreenSong ? (EGameMode)_Round : CGame.GetGameMode(_Round))) { case EGameMode.TR_GAMEMODE_NORMAL: _Texts[_TextSongMode].Text = "TR_GAMEMODE_NORMAL"; break; case EGameMode.TR_GAMEMODE_MEDLEY: _Texts[_TextSongMode].Text = "TR_GAMEMODE_MEDLEY"; break; case EGameMode.TR_GAMEMODE_DUET: _Texts[_TextSongMode].Text = "TR_GAMEMODE_DUET"; _IsDuet = true; break; case EGameMode.TR_GAMEMODE_SHORTSONG: _Texts[_TextSongMode].Text = "TR_GAMEMODE_SHORTSONG"; break; default: _Texts[_TextSongMode].Text = "TR_GAMEMODE_NORMAL"; break; } _Pos = 0; }
/// <summary> /// Get song of specified round /// </summary> /// <param name="round">Round (0 based)</param> /// <returns>Current song or null if out of bounds</returns> public CSong GetSong(int round) { if (round == _CurrentRound) { return(_CurrentSong); } if (round < _SongQueue.Count && round >= 0) { return(CSongs.GetSong(_SongQueue[round].SongID)); } return(null); }
private static SPlaylistSongInfo _GetPlaylistSongInfo(CPlaylistSong playlistSong, int playlistId, int playlistPos) { SPlaylistSongInfo result = new SPlaylistSongInfo(); if (playlistSong != null) { result.PlaylistId = playlistId; result.GameMode = (int)playlistSong.GameMode; result.PlaylistPosition = playlistPos; result.Song = _GetSongInfo(CSongs.GetSong(playlistSong.SongID), true); } return(result); }
public virtual bool AddSong(int AbsoluteIndex, EGameMode GameMode) { if (CSongs.AllSongs.Length > AbsoluteIndex) { int SongID = CSongs.AllSongs[AbsoluteIndex].ID; if (GameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(SongID).IsDuet) { return(false); } _SongQueque.Add(new SongQueque(SongID, GameMode)); return(true); } return(false); }
public void AddSong(int SongID) { CPlaylistSong song = new CPlaylistSong(); song.SongID = SongID; if (CSongs.GetSong(SongID).IsDuet) { song.GameMode = EGameMode.TR_GAMEMODE_DUET; } else { song.GameMode = EGameMode.TR_GAMEMODE_NORMAL; } Songs.Add(song); }
private void LoadScores() { CPoints points = CGame.GetPoints(); if (points == null) { return; } _Pos = 0; for (int round = 0; round < points.NumRounds; round++) { SPlayer player = points.GetPlayer(round, CGame.NumPlayer)[0]; CDataBase.LoadScore(ref _Scores, player); if (round == _Round) { _IsDuet = false; CSong song = CSongs.GetSong(player.SongID); Texts[htTexts(TextSongName)].Text = song.Artist + " - " + song.Title; switch (CGame.GameMode) { case EGameMode.Normal: Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_NORMAL"; break; case EGameMode.Medley: Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_MEDLEY"; break; case EGameMode.Duet: Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_DUET"; _IsDuet = true; break; default: Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_NORMAL"; break; } } } }
private void _SavePlayedSongs() { for (int round = 0; round < _Points.NumRounds; round++) { SPlayer[] players = _Points.GetPlayer(round, CGame.NumPlayers); for (int p = 0; p < players.Length; p++) { if (players[p].Points > CSettings.MinScoreForDB && players[p].SongFinished) { CSong song = CSongs.GetSong(players[p].SongID); CDataBase.IncreaseSongCounter(song.DataBaseSongID); song.NumPlayed++; song.NumPlayedSession++; break; } } } }
public int AddScore(SPlayer player) { using (var connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + _FilePath; try { connection.Open(); } catch (Exception) { return(-1); } int medley = 0; int duet = 0; int shortSong = 0; switch (player.GameMode) { case EGameMode.TR_GAMEMODE_MEDLEY: medley = 1; break; case EGameMode.TR_GAMEMODE_DUET: duet = 1; break; case EGameMode.TR_GAMEMODE_SHORTSONG: shortSong = 1; break; } using (var command = new SQLiteCommand(connection)) { int dataBaseSongID = CSongs.GetSong(player.SongID).DataBaseSongID; return(_AddScore(CProfiles.GetPlayerName(player.ProfileID), (int)Math.Round(player.Points), player.VoiceNr, player.DateTicks, medley, duet, shortSong, (int)CProfiles.GetDifficulty(player.ProfileID), dataBaseSongID, command)); } } }
public static SSongInfo GetSong(int songId) { CSong song = CSongs.GetSong(songId); return(_GetSongInfo(song, true)); }
public static string GetMp3Path(int songId) { CSong song = CSongs.GetSong(songId); return(song.GetMP3()); }
public void SavePlaylist() { if (PlaylistFile == string.Empty) { string filename = string.Empty; foreach (char chr in PlaylistName) { if (char.IsLetter(chr)) { filename += chr.ToString(); } } if (filename == String.Empty) { filename = "1"; } int i = 0; while (File.Exists(Path.Combine(CSettings.sFolderPlaylists, filename + ".xml"))) { i++; if (!File.Exists(Path.Combine(CSettings.sFolderPlaylists, filename + i + ".xml"))) { filename += i; } } PlaylistFile = Path.Combine(CSettings.sFolderPlaylists, filename + ".xml"); } XmlWriter writer; try { writer = XmlWriter.Create(PlaylistFile, _settings); } catch (Exception e) { CLog.LogError("Error creating/opening Playlist File " + PlaylistFile + ": " + e.Message); return; } if (writer == null) { CLog.LogError("Error creating/opening Playlist File " + PlaylistFile); return; } writer.WriteStartDocument(); writer.WriteStartElement("root"); writer.WriteStartElement("Info"); writer.WriteElementString("PlaylistName", PlaylistName); writer.WriteEndElement(); writer.WriteStartElement("Songs"); for (int i = 0; i < Songs.Count; i++) { CSong song = CSongs.GetSong(Songs[i].SongID); if (song != null) { writer.WriteStartElement("Song" + (i + 1).ToString()); writer.WriteElementString("Artist", song.Artist); writer.WriteElementString("Title", song.Title); writer.WriteElementString("GameMode", Enum.GetName(typeof(EGameMode), Songs[i].GameMode)); writer.WriteEndElement(); } else { CLog.LogError("Playlist.SavePlaylist(): Can't find Song. This should never happen!"); } } writer.WriteEndElement(); writer.WriteEndElement(); //end of root writer.WriteEndDocument(); writer.Flush(); writer.Close(); }