Use IsGameModeAvail for duet check

This commit is contained in:
Flamefire committed 2013-10-12 21:50:39 +02:00
1 parent b12e4156fa
commit 6de23ea428
7 files changed
+19 -22

No files matched your search

-16
View File
@@ -90,11 +90,6 @@ namespace Vocaluxe.Base
get { return _CurrentPlaylistElement.SongID; } get { return _CurrentPlaylistElement.SongID; }
} }
public static bool Duet
{
get { return _CurrentPlaylistElement.Duet; }
}
public static bool SongHasVideo public static bool SongHasVideo
{ {
get { return File.Exists(_CurrentPlaylistElement.VideoFilePath); } get { return File.Exists(_CurrentPlaylistElement.VideoFilePath); }
@@ -581,17 +576,6 @@ namespace Vocaluxe.Base
} }
} }
public bool Duet
{
get
{
if (_Song != null)
return _Song.IsDuet;
return false;
}
}
public CPlaylistElement(CSong song) public CPlaylistElement(CSong song)
{ {
MusicFilePath = string.Empty; MusicFilePath = string.Empty;
+5
View File
@@ -532,6 +532,11 @@ namespace Vocaluxe.Base
return CGame.GetTimeFromBeats(beat, bpm); return CGame.GetTimeFromBeats(beat, bpm);
} }
public float GetBeatFromTime(float time, float bpm, float gap)
{
return CGame.GetBeatFromTime(time, bpm, gap);
}
public void AddSong(int songID, EGameMode gameMode) public void AddSong(int songID, EGameMode gameMode)
{ {
CGame.AddSong(songID, gameMode); CGame.AddSong(songID, gameMode);
+6 -2
View File
@@ -52,7 +52,7 @@ namespace Vocaluxe.GameModes
{ {
protected override CSong _PrepareSong(CSong song) protected override CSong _PrepareSong(CSong song)
{ {
return song; return (song.IsGameModeAvailable(EGameMode.TR_GAMEMODE_NORMAL)) ? song : null;
} }
} }
@@ -60,7 +60,7 @@ namespace Vocaluxe.GameModes
{ {
protected override CSong _PrepareSong(CSong song) protected override CSong _PrepareSong(CSong song)
{ {
return (song.IsDuet) ? song : null; return (song.IsGameModeAvailable(EGameMode.TR_GAMEMODE_DUET)) ? song : null;
} }
} }
@@ -68,6 +68,8 @@ namespace Vocaluxe.GameModes
{ {
protected override CSong _PrepareSong(CSong song) protected override CSong _PrepareSong(CSong song)
{ {
if (!song.IsGameModeAvailable(EGameMode.TR_GAMEMODE_SHORTSONG))
return null;
var newSong = new CSong(song) {Finish = CGame.GetTimeFromBeats(song.ShortEnd.EndBeat, song.BPM) + CSettings.DefaultMedleyFadeOutTime + song.Gap}; var newSong = new CSong(song) {Finish = CGame.GetTimeFromBeats(song.ShortEnd.EndBeat, song.BPM) + CSettings.DefaultMedleyFadeOutTime + song.Gap};
// set lines to short mode // set lines to short mode
newSong.Notes.SetMedley(0, song.ShortEnd.EndBeat); newSong.Notes.SetMedley(0, song.ShortEnd.EndBeat);
@@ -80,6 +82,8 @@ namespace Vocaluxe.GameModes
{ {
protected override CSong _PrepareSong(CSong song) protected override CSong _PrepareSong(CSong song)
{ {
if (!song.IsGameModeAvailable(EGameMode.TR_GAMEMODE_MEDLEY))
return null;
var newSong = new CSong(song) {Start = CGame.GetTimeFromBeats(song.Medley.StartBeat, song.BPM) - song.Medley.FadeInTime + song.Gap}; var newSong = new CSong(song) {Start = CGame.GetTimeFromBeats(song.Medley.StartBeat, song.BPM) - song.Medley.FadeInTime + song.Gap};
if (newSong.Start < 0f) if (newSong.Start < 0f)
newSong.Start = 0f; newSong.Start = 0f;
+5 -1
View File
@@ -180,7 +180,11 @@ namespace Vocaluxe.Lib.Playlist
public void AddSong(int songID) public void AddSong(int songID)
{ {
var song = new CPlaylistSong {SongID = songID, GameMode = CSongs.GetSong(songID).IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL}; 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); Songs.Add(song);
} }
@@ -200,7 +200,7 @@ namespace Vocaluxe.Screens
CGame.ClearSongs(); CGame.ClearSongs();
var gm = EGameMode.TR_GAMEMODE_NORMAL; var gm = EGameMode.TR_GAMEMODE_NORMAL;
if (CSongs.AllSongs[songNr].IsDuet) if (CSongs.AllSongs[songNr].IsGameModeAvailable(EGameMode.TR_GAMEMODE_DUET))
gm = EGameMode.TR_GAMEMODE_DUET; gm = EGameMode.TR_GAMEMODE_DUET;
CGame.AddSong(songNr, gm); CGame.AddSong(songNr, gm);
+1 -1
View File
@@ -69,7 +69,7 @@ namespace Vocaluxe.SongQueue
private bool _AddSong(int songID, EGameMode gameMode) private bool _AddSong(int songID, EGameMode gameMode)
{ {
if (gameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(songID).IsDuet) if (CSongs.GetSong(songID).IsGameModeAvailable(gameMode))
return false; return false;
_SongQueue.Add(new SSongQueueEntry(songID, gameMode)); _SongQueue.Add(new SSongQueueEntry(songID, gameMode));
+1 -1
View File
@@ -971,11 +971,11 @@ namespace VocaluxeLib.Menu
if (!mouseEvent.LBH && DragAndDropSongID != -1) if (!mouseEvent.LBH && DragAndDropSongID != -1)
{ {
var gm = EGameMode.TR_GAMEMODE_NORMAL;
CSong song = CBase.Songs.GetSongByID(DragAndDropSongID); CSong song = CBase.Songs.GetSongByID(DragAndDropSongID);
if (song != null) if (song != null)
{ {
var gm = EGameMode.TR_GAMEMODE_NORMAL;
if (song.IsDuet) if (song.IsDuet)
gm = EGameMode.TR_GAMEMODE_DUET; gm = EGameMode.TR_GAMEMODE_DUET;